" ? :" not work ?
7 posts • Page 1 of 1
" ? :" not work ?
here:
(e)=>{(x)=>{scene.my.auto_drive_speed = 6 ? {scene.my.auto_drive_speed = 3}}}
but it seems not working....
i wanna do this:
when scene.my.auto_drive_speed = 6 then
scene.my.auto_drive_speed become 3
please help....thanks
(e)=>{(x)=>{scene.my.auto_drive_speed = 6 ? {scene.my.auto_drive_speed = 3}}}
but it seems not working....
i wanna do this:
when scene.my.auto_drive_speed = 6 then
scene.my.auto_drive_speed become 3
please help....thanks
- dogwong
- Posts: 8
- Joined: Wed Oct 21, 2009 12:28 pm
Re: " ? :" not work ?
(e)=>{scene.my.auto_drive_speed == 6 ? {scene.my.auto_drive_speed = 3} : {} }
There you go?
There you go?
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem
No really just PM me if you have a problem
-
Sniperkasa - Posts: 493
- Joined: Tue Sep 01, 2009 5:34 pm
- Location: The bottom of a lake.
Re: " ? :" not work ?
dogwong wrote:here:
(e)=>{(x)=>{scene.my.auto_drive_speed = 6 ? {scene.my.auto_drive_speed = 3}}}
but it seems not working....
i wanna do this:
when scene.my.auto_drive_speed = 6 then
scene.my.auto_drive_speed become 3
please help....thanks
The reason is that <X> = <Y> assigns <X> to <Y>, the infixed operation of "? :" requires a true/false (boolean) value, this can be achieved using the equality operator ("==") or the other operators (">", "<", ">=", "<=" and "!="), the infixed if_then_else structure also requires both then and else structures too, it will not work if you only send the boolean value and the then or else functions.
The code you seem to want is:
- Code: Select all
(e)=>{Scene.my.auto_drive_speed == 6 ? {Scene.my.auto_drive_speed = 3} : {}}
Hopefully this helped.
/Grady
- gradyfitz
- Posts: 174
- Joined: Tue Sep 01, 2009 8:33 am
- Location: Victoria, Australia
Re: " ? :" not work ?
Grady that code is like copy pasted from mine and i got no thank yous
And I even posted before you
And I even posted before you
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem
No really just PM me if you have a problem
-
Sniperkasa - Posts: 493
- Joined: Tue Sep 01, 2009 5:34 pm
- Location: The bottom of a lake.
Re: " ? :" not work ?
Sniperkasa wrote:Grady that code is like copy pasted from mine and i got no thank yous
And I even posted before you
Sorry, I didn't copy and paste it from your post, nor did I read your post before I clicked the "Submit" button, I finished writing my post then finished watching the show on TV (it's on ABC, so there were no ads where I'd finish the last line, there was about 10 minutes to go when I finished writing my post). I prefer to explain why it didn't work, how to do it the correct way, and perhaps one way the system could be achieved . A lot of the time, I forget I was even writing a post, though that happens far less now because of the new forum system (I checked all the posts before I posted again (and because of it, got distracted) in the old forum system, but in the new forum system, I don't have to worry about all the new post marks disappearing and having to look for the new posts manually). It rarely hurts to have a second person to help though .
Sorry if it looked like I copied you, but that's not what happened .
- gradyfitz
- Posts: 174
- Joined: Tue Sep 01, 2009 8:33 am
- Location: Victoria, Australia
Re: " ? :" not work ?
Yes but it looks like I'm not even noticed for trying to help
He only replied once you posted.. generally same thing as I with an explanation..
But never mind I'm getting used to this allready..
He only replied once you posted.. generally same thing as I with an explanation..
But never mind I'm getting used to this allready..
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem
No really just PM me if you have a problem
-
Sniperkasa - Posts: 493
- Joined: Tue Sep 01, 2009 5:34 pm
- Location: The bottom of a lake.
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 8 guests