If statement parse error
3 posts • Page 1 of 1
If statement parse error
Hey all, I'm still having a lot of trouble with my if statements. It seems no matter how I write them it tells me that I have a parse error and that I am missing a period ('.') somewhere. But I can't for the life of me figure out where. The only places I should even have periods are in my variables, such as scene.my.whatever and scene.my.example, and thats where they all are, exactly where they should be! I don't get what I am doing wrong, and it is becoming extremely frustrating. The code I'm trying to use is
Also, yes, I have looked at the thyme tutorials at the top of the page. That is what I am doing to get my examples.
Thanks again!
-Jake
- Code: Select all
scene.my.iftest1 = (scene.my.color1)=>{scene.my.color1 == [0.0,0.0,1.0,1.0]}?{scene.my.colortest1 = 1}:{scene.my.colortest1 = 0}
Also, yes, I have looked at the thyme tutorials at the top of the page. That is what I am doing to get my examples.
Thanks again!
-Jake
- VFB1210
- Posts: 5
- Joined: Sun Oct 03, 2010 4:48 am
Re: If statement parse error
First, you mess with local and global variables, scene.my.blablabla cannot be used as argument.
Also, you better not use {} everywhere - it means "procedure" type.
So correct code is:
btw - in your example "if" is unnecessary
Also, you better not use {} everywhere - it means "procedure" type.
So correct code is:
- Code: Select all
scene.my.iftest1 = (color) => {color == [0.0,0.0,1.0,1.0] ? {scene.my.colortest1 = 1} : {scene.my.colortest1 = 0}}
btw - in your example "if" is unnecessary
- Code: Select all
scene.my.iftest1 = (color) => {scene.my.colortest1 = (color == [0.0,0.0,1.0,1.0])}
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: If statement parse error
Thank you very much! I finally got it to work! 
- VFB1210
- Posts: 5
- Joined: Sun Oct 03, 2010 4:48 am
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests



