sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    New Toggle Script (Help Needed)

    Scheduled Pinned Locked Moved SketchyPhysics
    13 Posts 3 Posters 1.1k 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.
    • M Offline
      MrPlanet
      last edited by MrPlanet

      if key("space")==1 && getVar("piston")==1 then setVar("piston",0);elsif key("space")==1 && getVar("piston")==0 then setVar("piston",1);end;
      

      Can somebody please help me? When i enter this into the controller, it does a syntax error. What am i doing wrong? ❓

      (Thanks β€’BTM!)

      I reject your reality and substitute my own.

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

        main problem I can see right off-the-bat: elsif. You wrote elseif. Basically, you spelled it wrong.

        1 Reply Last reply Reply Quote 0
        • W Offline
          Wacov
          last edited by

          I see what you're trying to do, but honestly, it won't work. Mine is long for a reason πŸ˜„

          There's a 50/50 chance of actually toggling. I mean that literally. Oh, and hold down space, see what happens... I'll let you figure out what's going on.

          !!201ST POST! YAY!!

          http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

          1 Reply Last reply Reply Quote 0
          • M Offline
            MrPlanet
            last edited by

            @wacov said:

            I see what you're trying to do, but honestly, it won't work. Mine is long for a reason πŸ˜„

            There's a 50/50 chance of actually toggling. I mean that literally. Oh, and hold down space, see what happens... I'll let you figure out what's going on.

            !!201ST POST! YAY!!

            I sort of want it to that, i want to give an effect of 'old' machinary, which does not always work.

            I reject your reality and substitute my own.

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

              Yeah, I know that wacov, but he was wondering why the script didn't work at all, so I told him why. Let him find the rest out on his own πŸ˜‰ (I see he corrected the spelling mistake after)

              1 Reply Last reply Reply Quote 0
              • M Offline
                MrPlanet
                last edited by

                (By the way, please excuse me, i have only figured out how to write If commands 3 days ago)

                I reject your reality and substitute my own.

                1 Reply Last reply Reply Quote 0
                • W Offline
                  Wacov
                  last edited by

                  @unknownuser said:

                  @wacov said:

                  I see what you're trying to do, but honestly, it won't work. Mine is long for a reason πŸ˜„

                  There's a 50/50 chance of actually toggling. I mean that literally. Oh, and hold down space, see what happens... I'll let you figure out what's going on.

                  !!201ST POST! YAY!!

                  I sort of want it to that, i want to give an effect of 'old' machinary, which does not always work.

                  ... really? And the whole spastic vibration thing is alright with you? πŸ˜‰

                  http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MrPlanet
                    last edited by

                    Nevermind, i've figured out a way to fix it using onTouch.

                    I reject your reality and substitute my own.

                    1 Reply Last reply Reply Quote 0
                    • W Offline
                      Wacov
                      last edited by

                      πŸ˜„ Are you really this inclined to avoid using my script?

                      http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        MrPlanet
                        last edited by

                        Nope. Your script i by far better, but it is REALLY hard to remember from the top of one's head πŸ˜„

                        I reject your reality and substitute my own.

                        1 Reply Last reply Reply Quote 0
                        • W Offline
                          Wacov
                          last edited by

                          http://www.sketchucation.com/forums/scf/viewtopic.php?f=61&t=17981 ... I wish Chris would stickify it... or make a sticky post with all the good scripts in...

                          http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

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

                            I think everyone's been trying to find easier ways. Mine was a simple 2 button switch, but I can't seem to figure out any other way to make a one buttoned one, and when I do, they turn out almost exactly like yourse. πŸ˜†

                            1 Reply Last reply Reply Quote 0
                            • W Offline
                              Wacov
                              last edited by

                              I'll be happier than anyone if there's a simpler way, but the problem is detecting key presses as individual events. I believe that onButton/Key events will be added in the next version, or at least before SPIV; that'll make things a whole lot easier... but I'm more excited about the ability to detect what onTouch is hitting. For the next motorsketch, I'll (hopefully) be able to add AI opponents that follow routes through the track, attacking each other and the player, along with a lap counter!

                              http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement