Kelli Mounier
Registered User
Join date: 28 Oct 2005
Posts: 17
|
01-14-2006 16:41
I'm trying to start writing simple scripts but I've hit a problem on my first one that I can't get past. I can't figure out why this is always true no matter what I say in chat and executes the if statement? I can print out the "message" string with llOwnerSay but no matter what it is or what "objectstate" is it tests true and executes the if. Does if not work with strings this way? string objectstate = "down"; listen( integer channel, string name, key id, string message ) { if (message == "objectup" && objectstate == "down"  ; { insert whatever } }
|
Elvawin Rainbow
Registered User
Join date: 30 Aug 2005
Posts: 172
|
01-14-2006 17:22
well dont know what to tell you - yhe code you have is missing some pieces but I just tested this and it works string objectstate = "down"; default { state_entry() { llListen( 0, "", NULL_KEY, "" ); } listen( integer channel, string name, key id, string message ) { if (message == "objectup" && objectstate == "down"  llSay(0, "hmm"  ; } }
_____________________
"Off with their Heads"
|
Zippy Overlord
Registered User
Join date: 23 Nov 2005
Posts: 3
|
01-14-2006 17:38
reason it didn't work right is the semi-colon on the line with the if....
if(condition) { // then } else { // else }
|
Kelli Mounier
Registered User
Join date: 28 Oct 2005
Posts: 17
|
01-14-2006 18:04
Yes I just figured that out and came back to post, silly semi colons.
Thanks!
|