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

    Where can I find a comprehensive, complete script tutorial?

    Scheduled Pinned Locked Moved SketchyPhysics
    7 Posts 5 Posters 652 Views 5 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
      Platypus5
      last edited by

      It has been a while since I have been able to use sketchyphysics (you can thank a trip to mexico for that) and I must have missed out on a lot. I need to catch up with the new scripting techniques, but it is hard. The sketchyphysics wiki doesn't have a comprehensive tutorial yet (it is still somewhat obscure to me) so ya. What should I do?

      For example, how do you create a variable?

      1 Reply Last reply Reply Quote 0
      • P Offline
        Physicsguy1
        last edited by

        For the example: setVar('variablename',value)
        To get a variable, put in getVar('variablename')
        for example: setVar('sketchy',1) getVar('sketchy')

        1 Reply Last reply Reply Quote 0
        • P Offline
          phy
          last edited by

          if key('e')==1;setVar('foo',1);elsif key('q')==1;setVar('foo',2);end
          

          Means, if key('e') is down it sets the variable foo to one, but if key('q') is down it sets the variable foo to two.

          Put

          getVar('foo')
          

          in a motors controller field and when you push key('e') the motor will act normally but when you push key('q') the motor will double it's speed.

          Hope that will help.

          Tableau de comparaison de Staxyn s'agit d'un mГ©dicament uniquement sur ordonnance.

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

            Well, to get you up to speed, most people now know what get/set/getSetVar do, and most people in the SP Warehouse Community can now write IF commands, so, yeah, you've missed out a lot 😉

            I reject your reality and substitute my own.

            1 Reply Last reply Reply Quote 0
            • S Offline
              Sgt.A.Johnson
              last edited by

              @unknownuser said:

              most people in the SP Warehouse Community can now write IF commands

              I guess im in the sector that cant write if commands. I can mod them but not make them

              1 Reply Last reply Reply Quote 0
              • P Offline
                Physicsguy1
                last edited by

                How to write an if command: if means if, of course. so, lets say "if frame=0 then blah blah". that means that if the frame is equal to zero, then do something. now you need to add the command to be executed. so, for example: if frame==0 then playsound('blah.wav');end. So now it will play the sound blah if the frame is equal to 0. be sure to add ";end" to the end of your if script. remember, you can also change the actions, for example: if getVar('blah')==1 then setVar('bounce',2);end, or: if getVar('blah')==5 then playsound('blah.wav');end. Hope this helps!

                1 Reply Last reply Reply Quote 0
                • P Offline
                  Platypus5
                  last edited by

                  This does help, but when I tried the things you told me, no luck.

                  I have recently started to try to make an exploding artillery shell. In theory, an impact would push an object on a slider joint, into a magnet. This would trigger an onTouch event that causes the magnet to activate, blowing the shell apart.

                  Now, in the "ontouch" field, I put this in: setVar("Boom",1) In the section that designates the magnet's strength, I put this in: getVar("boom")*-1000

                  It isn't working. What am I doing wrong?

                  UPDATE: Fixed. I realized the variables are case-sensitive.

                  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