help with scripting

About advanced scenes, and the Thyme scripting language used in Algodoo.

help with scripting

Postby kbrtom » Sat Apr 09, 2011 1:44 am

I am trying to make a slot machine and can't get the scripting right. There are 3 wheels with 4 charactors on each. A laser is attached to each charactor on all 3 wheels and each laser is on a different collision layer (D,E,F,G) with matched targets outside the wheel. (confused yet?) What I am trying to get is to have a motor start but only if 3 matched (one on each wheel) targets are hit. I have attached the scene as I have it so far. If you can help me please be specific. I am just learning all this and I don't yet understand all the vocabulary. Thanks

Edit: If the "bucket" spawns out of control upon starting, pause the scene, hit the undo key. and delete the "bucket". That's a little bug I have not fixed yet.
Attachments
slot machine help.phz
(292.73 KiB) Downloaded 48 times
kbrtom
 
Posts: 9
Joined: Thu Mar 24, 2011 12:40 pm

Re: help with scripting

Postby mold999 » Wed Apr 20, 2011 1:54 am

Can you please explain this in simpler terms? I have no idea what you are talking about.
Phundementalism?

Ain't nobody got
thyme fo dat.
User avatar
mold999
 
Posts: 225
Joined: Sun Jan 02, 2011 1:35 am
Location: [176436, 3763234]

Re: help with scripting

Postby Someone Else » Wed Apr 20, 2011 6:44 pm

Yes, that and upload it on Algobox.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: help with scripting

Postby kbrtom » Thu Apr 21, 2011 3:22 am

Well, it's a slot machine. A button is pushed spinning 3 wheels. If all 3 wheels stop on the same charactor ( say, all cherrys), the machine pays off. If all 3 wheels do not match, nothing is payed out and the player spins again, I believe it would be an "if" statement, but I am not sure how to write it out. As far as downloading, the scene is applied to the attachment in my original message. Maybe someone could show me the proper way to write an "if" statement and I might be able to figure it out. A statement such as " if a box is collided with 3 times, then a motor will start", (or somethin similar). I have searched thru a lot of the tutorials, but I don't think I would know it if I saw it. Thanks for any help you can give.
kbrtom
 
Posts: 9
Joined: Thu Mar 24, 2011 12:40 pm

Re: help with scripting

Postby TC42 » Thu Apr 21, 2011 3:27 am

IF statement:
{condition} ? {true} : {false}
Ex: {variable1 > 3} ? {variable2=15} : {variable2=16}
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: help with scripting

Postby kbrtom » Thu Apr 21, 2011 6:22 am

Thanks TC42, that is what I needed to see. I'm still trying to learn all this.
kbrtom
 
Posts: 9
Joined: Thu Mar 24, 2011 12:40 pm

Re: help with scripting

Postby Kilinich » Thu Apr 21, 2011 11:36 am

TC42 wrote:IF statement:
{condition} ? {true} : {false}
Ex: {variable1 > 3} ? {variable2=15} : {variable2=16}


stop putting {} wherever you want :crazy:
correct syntax a ? b : c means scene.my.a = a + b > c ? 0 : 1 is correct code and you don't need {}
{} is "procedure" type.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: help with scripting

Postby Someone Else » Thu Apr 21, 2011 2:36 pm

I find it easier to comprehend code that is in braces like TC42 demonstrated.
Thus, I always do it that way.
And if I can ever find a time to download the scene, I will try to fix it myself, mainly because you, kbrtom, make absoloutely no sense. Please break up your paragraphs like I'm doing.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests