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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Toggle script

    Scheduled Pinned Locked Moved SketchyPhysics
    3 Posts 2 Posters 629 Views 2 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.
    • W Offline
      Wacov
      last edited by

      This is my attempt at a script that toggles between 1 and 0 when a is pressed.'toggle' is the output value, and can be either 0.0 or 1.0. 'allow_repeat' is intended to stop the script from excecuting again until a is released. The frame detector is just to stop 'toggle' being re-declared as 0.0 every time the script restarts. In sketchyphysics, it just acts like a is the controller.

      if(frame<5);toggle=0.0;elsif(a==0.0);allow_repeat=1.0;elsif(allow_repeat==0.0);toggle;elsif(a==0.0);toggle;elsif(toggle==0.0);allow_repeat=0.0;toggle=1.0;else;allow_repeat=0.0;toggle=0.0;end

      Can anyone help?? Is there a proper way of doing this (mine seems overly complicated)??

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

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

        Does that work?

        I don't think it would. The problem is the toggle and allow_repeat are not saved from one frame to the next.

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

          Ohhhh... I was assuming they would be. Maybe something for a future release?

          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