|
Piginawig Lock
Person
Join date: 11 Oct 2006
Posts: 56
|
04-13-2007 07:42
Is it possible to only listen if the message equals an integer? This is currently what I have in my script: if ( message == integer ) { llSay(0,"You said a number"  ; } else { llSay(0,"You said a letter"  ; } Any help would be appreciated since I am still learning to script.
|
|
Piginawig Lock
Person
Join date: 11 Oct 2006
Posts: 56
|
Nevermind.... I found it out
04-13-2007 07:44
I figured out that this worked: if ( (integer)message > 0) { llSay(0,"You said a number"  ; } else { llSay(0,"You said a letter"  ; } If you still want to reply with something better that would be fine.
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
04-13-2007 07:54
From: Piginawig Lock I figured out that this worked: if ( (integer)message > 0) { llSay(0,"You said a number"  ; } else { llSay(0,"You said a letter"  ; } If you still want to reply with something better that would be fine. Actually that won't work if the user types something like 12ab Rj
|
|
Piginawig Lock
Person
Join date: 11 Oct 2006
Posts: 56
|
04-13-2007 08:02
Well, Im using this for an object, on rez it says a random number on channel 5 and the main script (this one) sets it's new listen to that number.
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
04-13-2007 08:02
There are a few ways to do this. Including parse it all apart, looking for non-numbers, etc. I think the method below is relatively efficient though. listen(integer channel, string name, key id, string data) { integer int; string str; int = (integer)data; str = (string)int; if (str == data) llOwnerSay("Number."); else llOwnerSay("Not number."); }
It could be squashed down more, variables made global, etc, but this should do it. Rj
|