What's wrong with the "if" function now?
|
|
Lachlan Campbell
Registered User
Join date: 21 Mar 2006
Posts: 4
|
07-13-2006 08:22
I can't get the "if" function to work in my new scripts now. I have simply cut and pasted the "example" lines into the standard default script created by the "New Script: ++++++++++++++++++++++++++++++++++++++++++ if (llFrand(1.0) > 0.5) llSay(0, "heads"  ; else llSay(0, "tails"  ; ++++++++++++++++++++++++++++++++++++++++++ Regarless of where I place it in the default, and regardless of the nesting, when i try to compile it I consistenly get syntax errors that point to the beginning of the "if" line. Anybody have ideas on what is causing the syntax error? Lachlan Campbell
|
|
Foolish Frost
Grand Technomancer
Join date: 7 Mar 2005
Posts: 1,433
|
07-13-2006 08:45
From: Lachlan Campbell I can't get the "if" function to work in my new scripts now. I have simply cut and pasted the "example" lines into the standard default script created by the "New Script: ++++++++++++++++++++++++++++++++++++++++++ if (llFrand(1.0) > 0.5) llSay(0, "heads"  ; else llSay(0, "tails"  ; ++++++++++++++++++++++++++++++++++++++++++ Regarless of where I place it in the default, and regardless of the nesting, when i try to compile it I consistenly get syntax errors that point to the beginning of the "if" line. Anybody have ideas on what is causing the syntax error? Lachlan Campbell Use this: if (llFrand(1.0) > 0.5) { llSay(0, "heads"  ; } else { llSay(0, "tails"  ; }
|
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
07-13-2006 09:29
try default { state_entry() { if (llFrand(1.0) > 0.5) llSay(0, "heads"); else llSay(0, "tails"); } }
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
|
Lachlan Campbell
Registered User
Join date: 21 Mar 2006
Posts: 4
|
07-13-2006 12:00
From: Foolish Frost Use this: if (llFrand(1.0) > 0.5) { llSay(0, "heads"  ; } else { llSay(0, "tails"  ; } Tried this, still doesn't work. Any other ideas?
|
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
07-13-2006 12:07
I would try Strife's code. You might just be placing it in the wrong spot-- what errors is the compiler giving you?
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
07-13-2006 21:19
From: Lachlan Campbell Regarless of where I place it in the default, and regardless of the nesting, when i try to compile it I consistenly get syntax errors that point to the beginning of the "if" line. The beginning of the if line means the end of the previous line's error, such as missing a semi-colon or a closed bracket, doesn't it?
_____________________
 Seagel Neville 
|
|
Draco18s Majestic
Registered User
Join date: 19 Sep 2005
Posts: 2,744
|
07-14-2006 10:07
From: Seagel Neville The beginning of the if line means the end of the previous line's error, such as missing a semi-colon or a closed bracket, doesn't it? Should be.
|
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
07-14-2006 16:03
Try sticking it in lslint. It might give you a better answer then the SL compiler. ==Chris
|