If Structures question?
3 posts • Page 1 of 1
If Structures question?
Hi,
I am makeing a computer that is based off thyme but i am haveing problems with my if structures. Every time i try to make one it doesint work. I have tryed to follow the thyme tutorial but i still cant get it to work. Here is the code
For example, block 1 is the receving block, block 2 is blue and block 3 is red.
Block 1 is scripted with a true false script that only activates when the block it is hit with is blue
Block 1 hits block 3 but it does nothing, but block 1 hits block 2 and it copys the color and text to its self.
What is wrong with my script?
Thanks,
9373
I am makeing a computer that is based off thyme but i am haveing problems with my if structures. Every time i try to make one it doesint work. I have tryed to follow the thyme tutorial but i still cant get it to work. Here is the code
- Code: Select all
(e)=>{e.other.color = [1.0, 0.0, 0.0, 1.0] ? {e.this.text = e.other.text; e.this.color = e.other.color} : {e.this.color = [0.0, 0.0, 0.0, 1.0]}}
For example, block 1 is the receving block, block 2 is blue and block 3 is red.
Block 1 is scripted with a true false script that only activates when the block it is hit with is blue
Block 1 hits block 3 but it does nothing, but block 1 hits block 2 and it copys the color and text to its self.
What is wrong with my script?
Thanks,
9373
- 9373
- Posts: 12
- Joined: Tue Oct 27, 2009 10:54 pm
Re: If Structures question?
- Code: Select all
(e)=>{{e.other.color == [1.0, 0.0, 0.0, 1.0]} ? {e.this.text = e.other.text; e.this.color = e.other.color} : {e.this.color = [0.0, 0.0, 0.0, 1.0]}}
Fix'd
So in English it now reads:
If other color is [1, 0, 0, 1] then change this text to the other text and this color to the other color. Otherwise change this color to [0, 0, 0, 1]
Your mistake was forgetting the double plus sign "==" for the first section.
In the "If" stage the rules go like this
== If equal to
< If less then
> If more then
>= If more then or equal to
<= If less then or equal to
!= If not equal to
Simple guide to remember
{If}?{Then}:{Else}
-

Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests



