Thyme If Statement help
7 posts • Page 1 of 1
Thyme If Statement help
So I've been toying around with chemist's ball on a plane scene, and I figured it'd be nice to add some sort of visual effect to show what way the board is tilting.
I started using a texture, and just following mouse pos but I'm pretty bad at photoshop so gave up on that
Anyways I decided to use squares opacity to show this.
In the update box
However instead of this code saying "if Ypos >= 0 AND Xpos <= 0 ? {then} : {else}"
I want it to say "if Ypos ?= 0 OR Xpos <=0 ? {then} : {else}"
I had a search on the forums but if and or get excluded from the search...
And since theres a sign for AND I figured there'd be one for OR?
Thanks!
Mr.G
P.S. Even if I do just use textures (it might look better), this would still be handy to know
I started using a texture, and just following mouse pos but I'm pretty bad at photoshop so gave up on that
Anyways I decided to use squares opacity to show this.
In the update box
- Code: Select all
(e)=>{
app.mousePos(1) >= 0 && app.mousePos(0) <= 0 ? {
color = {
[0.0, 0.0, 0.0, ((app.mousePos(0) ^ 2) ^ 0.5) / 4 + ((app.mousePos(1) ^ 2) ^ 0.5) / 4]
}
} : {
color = [0.0, 0.0, 0.0, 0.0]
}
}
However instead of this code saying "if Ypos >= 0 AND Xpos <= 0 ? {then} : {else}"
I want it to say "if Ypos ?= 0 OR Xpos <=0 ? {then} : {else}"
I had a search on the forums but if and or get excluded from the search...
And since theres a sign for AND I figured there'd be one for OR?
Thanks!
Mr.G
P.S. Even if I do just use textures (it might look better), this would still be handy to know
- MrGlinzz
- Posts: 13
- Joined: Tue Mar 19, 2013 11:51 pm
Re: Thyme If Statement help
Pseudo code:
essentially, creating an IF script with the code inside the both of the conditions, so lets do a truth diagram
As you may know, 1 = true, 0 - false
A 1 1 1 0 0
B 0 1 0 1 0
--------------
O 1 1 1 1 0
- Code: Select all
IF (CONDITION A) THEN {
//DO SOMETHING
}
ELSE {
{ IF (CONDITION B) THEN {
//DO SOMETHING
}
}
essentially, creating an IF script with the code inside the both of the conditions, so lets do a truth diagram
As you may know, 1 = true, 0 - false
A 1 1 1 0 0
B 0 1 0 1 0
--------------
O 1 1 1 1 0
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: Thyme If Statement help
So in my example would the code be
- Code: Select all
(e)=>{
app.mousePos(1) >= 0 ? {
color = {
[0.0, 0.0, 0.0, ((app.mousePos(0) ^ 2) ^ 0.5) / 4 + ((app.mousePos(1) ^ 2) ^ 0.5) / 4]
}
} : {
app.mousePos(0) <= 0 ? {
color = {
[0.0, 0.0, 0.0, ((app.mousePos(0) ^ 2) ^ 0.5) / 4 + ((app.mousePos(1) ^ 2) ^ 0.5) / 4]
}
} : {
color = [0.0, 0.0, 0.0, 0.0]
}
}
}
- MrGlinzz
- Posts: 13
- Joined: Tue Mar 19, 2013 11:51 pm
Re: Thyme If Statement help
Yep, that looks like it should work fine!
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: Thyme If Statement help
s_noonan wrote:AND = &&
OR = ||
Just use this, OP. That other bit of code is nasty.
- BlockJuice
- Posts: 4
- Joined: Mon Jul 22, 2013 1:49 am
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests



