sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Coding Field

    Scheduled Pinned Locked Moved SketchyPhysics
    9 Posts 4 Posters 868 Views 4 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.
    • P Offline
      Physicsguy1
      last edited by

      Can there be another field that won't have to function on a certain event? i ran into this when i was building an arm, which had a receiver that calculated and processed everything, but the ontouch and ontick fields require an event to trigger them. Can there be a simple field for code like: if getVar('sens')==1 then setVar('claw',0.6);end
      if a==1 then setVar('claw',0);end?

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

        ...ontick does it fine, but there can't be 2 ends, one should be elsif.

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

          Actually there can be as many ends as you want. But in this case, there could be a conflict, so you may as well use elsif. Also, onTick works fine and doesn't need an event to trigger it; it's a 'frame' event, occuring every frame or every rate frame. Next version there should be global script, which'd be perfect for this.

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

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

            if getVar('sens')==1 then setVar('claw',0.6);elseif joybutton("a")==1 then setVar("claw",0);end;
            

            I reject your reality and substitute my own.

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

              I think thats it...

              I reject your reality and substitute my own.

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

                You don't need the first 'then'... but yeah

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

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

                  the second time you use setVar("claw"), should be getSetVar.

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

                    If it's going in onTick, what's the point?

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

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

                      yeah, you're right 😆

                      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