sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    Failing Formulas?

    Scheduled Pinned Locked Moved SketchyPhysics
    11 Posts 3 Posters 1.3k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      CPhillips
      last edited by

      What do you mean by "fail"?

      1 Reply Last reply
      Reply Quote 0
      • B
        BTM
        last edited by

        ...I think he means to stop working.

        1 Reply Last reply
        Reply Quote 0
        • B
          BTM
          last edited by

          yup.

          if frame==0 then setVar("foo",1);elsif frame==100 then setVar("foo",0);end;
          

          What it means: if frame is at 0, then set the variable "foo" to 1. if the frame is at 100, then get the variable "foo", and set it to 0. End.
          fails at 100.skp
          NOTE: the script can be put in the onTick box of any object.

          1 Reply Last reply
          Reply Quote 0
          • P
            Physicsguy1
            last edited by

            I need to know how to get a controlled script to fail, like a car out of gas

            1 Reply Last reply
            Reply Quote 0
            • C
              CPhillips
              last edited by

              Somewhere give it a full tank.

              setVar("gas",100) if frame==0
              

              In the motor accel

              (getVar("gas")<0? 0;1)*whatevermotorstrength;
              

              Somewhere consume the gas

              if(key("up")>0);g=getVar("gas");setVar("gas",g-1);end
              
              1 Reply Last reply
              Reply Quote 0
              • P
                Physicsguy1
                last edited by

                The example wasn't what i wanted an example for. i need a thruster on a plane to not function regardless of control inputs.

                1 Reply Last reply
                Reply Quote 0
                • B
                  BTM
                  last edited by

                  ...That is what you're looking for physicsguy, isn't it?

                  1 Reply Last reply
                  Reply Quote 0
                  • B
                    BTM
                    last edited by

                    ...my first example? all you have to do is type getVar("foo")* before each value. Here's something you may find familiar, with this technique in use πŸ˜‰
                    Dies completely (except bombs) after frame 500.

                    By the way, C.Phillips, mind explaning that script? I wouldn't mind figuring out how it works πŸ˜‰ What's g?
                    ...all I can get so far is that gas is 100, if gas is smaller than 0, then the motor stops, and when up is pressed, g is equal to gas, which is equal to one less than g, thus lowering the value by 1 each frame up is>0 (pressed). But can you just use a letter as a variable? It doesn' seem to work for me...

                    1 Reply Last reply
                    Reply Quote 0
                    • P
                      Physicsguy1
                      last edited by

                      thanks

                      1 Reply Last reply
                      Reply Quote 0
                      • C
                        CPhillips
                        last edited by

                        @unknownuser said:

                        By the way, C.Phillips, mind explaning that script? I wouldn't mind figuring out how it works πŸ˜‰ What's g?
                        ...all I can get so far is that gas is 100, if gas is smaller than 0, then the motor stops, and when up is pressed, g is equal to gas, which is equal to one less than g, thus lowering the value by 1 each frame up is>0 (pressed). But can you just use a letter as a variable? It doesn' seem to work for me...

                        Yes "g" is a temporary variable. It could have been "gas" or (almost) anything. I tested the code and it seems to work as expected. How does it not work for you?

                        1 Reply Last reply
                        Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better πŸ’—

                        Register Login
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement