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!
    Mac User? | Join the Rayscaper Beta for Mac Learn More

    New Toggle Script (Help Needed)

    Scheduled Pinned Locked Moved SketchyPhysics
    13 Posts 3 Posters 1.8k 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
      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
        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
          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
            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
              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
                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
                  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
                    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
                      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
                        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
                          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
                            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
                              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

                              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