Noobie question
11 posts • Page 1 of 1
Noobie question
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;
Any help?
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}}
- Code: Select all
{scene.my.orange}
Any help?
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Noobie question
How did you write scene.my.orange into the console?
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Noobie question
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}}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Noobie question
to karate brot, i tapped F11 and typed
To StandardToaster what makes it into a comparison? isnt my formula the same as yours?
- Code: Select all
scene.my.orange = false
To StandardToaster what makes it into a comparison? isnt my formula the same as yours?
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Noobie question
@standardtoaster:
oh damn i didn't see that theres only one "="
I thought he didn't assign the variable scene.my.orange to a boolean
@o0shadow0o:
look closely. just at the beginning. == and not =
oh damn i didn't see that theres only one "="
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.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Noobie question
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
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
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Noobie question
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?:
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
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Noobie question
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?
oh...
and what do u mean "motor =" line? do you mean in hinge menu or elsewhere?
Made In PHUN And PHOTOSHOP CS4
-
o0shadow0o - Posts: 14
- Joined: Fri Feb 05, 2010 7:09 pm
Re: Noobie question
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.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
11 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests