• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

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 22 Apr 2009, 00:24

    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 22 Apr 2009, 03:33

      ...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 22 Apr 2009, 09:32

        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 22 Apr 2009, 18:40

          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 22 Apr 2009, 18:40

            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 22 Apr 2009, 19:17

              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 22 Apr 2009, 20:57

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

                1 Reply Last reply Reply Quote 0
                • W Offline
                  Wacov
                  last edited by 23 Apr 2009, 19:33

                  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 23 Apr 2009, 22:20

                    yeah, you're right 😆

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

                    Advertisement