Where can I find a comprehensive, complete script tutorial?
-
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?
-
For the example: setVar('variablename',value)
To get a variable, put in getVar('variablename')
for example: setVar('sketchy',1) getVar('sketchy') -
if key('e')==1;setVar('foo',1);elsif key('q')==1;setVar('foo',2);endMeans, 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.
-
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

-
@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
-
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!
-
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.
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 LoginAdvertisement