Noobie question

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

Noobie question

Postby o0shadow0o » Fri Feb 05, 2010 9:40 pm

I am making a color sorting machine and i am having a Problem.
i am trying to have a trap door and have imputted this formula into the "oncollide" box;
Code: Select all
(e)=>{e.other.color=[1.0, 0.5, 0.0, 1.0] ? {scene.my.orange=true} : {scene.my.orange=false}}
, which the comoputer accepts. then on my motor of the trapdoor i enter in the "motor" box i have;
Code: Select all
{scene.my.orange}
. however, this doesnt work.

Any help?
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Noobie question

Postby KarateBrot » Fri Feb 05, 2010 10:29 pm

How did you write scene.my.orange into the console?
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Noobie question

Postby standardtoaster » Fri Feb 05, 2010 10:31 pm

You just forgot to make it a comparison. Currently, it's setting the color and then performing an if, which won't work.
Code: Select all
(e)=>{e.other.color == [1.0, 0.5, 0.0, 1.0] ? {Scene.my.orange = true} : {Scene.my.orange = false}}
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Noobie question

Postby o0shadow0o » Fri Feb 05, 2010 10:39 pm

to karate brot, i tapped F11 and typed
Code: Select all
scene.my.orange = false


To StandardToaster what makes it into a comparison? isnt my formula the same as yours?
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Noobie question

Postby KarateBrot » Fri Feb 05, 2010 10:39 pm

@standardtoaster:
oh damn i didn't see that theres only one "=" :D
I thought he didn't assign the variable scene.my.orange to a boolean

@o0shadow0o:
look closely. just at the beginning. == and not =
Last edited by KarateBrot on Fri Feb 05, 2010 10:41 pm, edited 1 time in total.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Noobie question

Postby o0shadow0o » Fri Feb 05, 2010 10:41 pm

Ahhhhhhhhhhhh...

...i see what i did wrong... :oops:
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Noobie question

Postby o0shadow0o » Sat Feb 06, 2010 11:00 am

Great.

i took your advice and entered the code, and it works! however, after adding other boxes, the whole thing doesn't work.
have a look for yourself

http://www.algodoo.com/algobox/details.php?id=37411
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Noobie question

Postby KarateBrot » Sat Feb 06, 2010 4:33 pm

What's the problem? Ok, it doesn't work because the variables aren't saved to the script line "motor =" but after i added them again it works and everything gets sorted.
What did you exactly do? Did you write it like that in the "motor =" line?:
Code: Select all
{scene.my.red}

{scene.my.orange}

{scene.my.yellow}

... and so on
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Noobie question

Postby o0shadow0o » Sat Feb 06, 2010 4:49 pm

when i set it to play the orange balls go into the orange pot but nothing else goes in the corresponding pot occasionally the orange motor vibrates and lets in/catapults other colors.

oh...


and what do u mean "motor =" line? do you mean in hinge menu or elsewhere?
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm

Re: Noobie question

Postby KarateBrot » Sun Feb 07, 2010 5:17 pm

Select your motor and go to the scripting menu. There's a line called "motor =". There you have to put in your variable with { } brackets around it. And this way you do it for the rest of your sorting mechanisms. I tried it and it worked perfectly. Every color got sorted just right.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Noobie question

Postby o0shadow0o » Fri Feb 12, 2010 8:18 pm

ty
Image Made In PHUN And PHOTOSHOP CS4
User avatar
o0shadow0o
 
Posts: 14
Joined: Fri Feb 05, 2010 7:09 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests

cron