How To Create "if" "then" Statements?

Discussion in 'Buildbox 3.0' started by Logan242, Sep 29, 2018.

  1. Logan242

    Logan242 Avid Boxer

    Joined:
    Sep 28, 2018
    Messages:
    106
    Likes Received:
    15
    Hello,
    I am wondering if it is possible to create a statement of if the user gets to a certain score then it will change worlds. Any feedback is appreciated!
     
  2. AndyG

    AndyG Miniboss Boxer

    Joined:
    Sep 25, 2015
    Messages:
    1,100
    Likes Received:
    915
  3. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    Hi Andy and Logan, I'd have to disagree with Andy. If/then is exactly what the scripting is all about. The question is, does the API provide access to the components you need to do what you want to. The Add Point node is scriptable, so it's very possible to track the score from there and if the score reaches a certain number take some action. With that said, it does not appear there is an API call to switch worlds(at least not documented). Looks like you can switch scenes with this.scene().addLevel( name ), but I haven't tried it, and maybe this would allow switching to scenes in other worlds, but I haven't tried that either. Also, you may have to use your own variable to track the score because there does not seem to be a call to get the current score, only add or subtract to/from the score.

    Andy is right that the event observer will do what you want but won't provide the flexibility of scripting . If you don't know how to script, definitely don't waste your time and go with Andy's suggestion.
     
  4. thatguyminib

    thatguyminib Serious Boxer

    Joined:
    Jul 1, 2017
    Messages:
    552
    Likes Received:
    309
    First question would also be is if he is using bb2 or bb3. If bb2 @AndyG reply is the perfect response since there is no scripting or nodes within bb2.
     
  5. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    I assumed since it was in the 3.0 thread he was talking about BB3. Please clarify Logan242. Of course if he's talking BB2 and just posted in the wrong thread. Andy is absolutely right.
     
  6. Logan242

    Logan242 Avid Boxer

    Joined:
    Sep 28, 2018
    Messages:
    106
    Likes Received:
    15
    Hi, thank you all for your responses. I am using BB3 and that why I was just wondering if there was a way to script it but I don't know how to but I tried Andy's way and it seemed to work just fine. I can imagine there is a lot more things you can do with scripting though. Again, thanks for all the help!
     
  7. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    I'm glad Andy's method worked for you. Yes, the advantages of scripting is that you can do infinitely more than without it, though that advantage will narrow in time as more nodes are developed and shared.
     

Share This Page