Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sorting a Listen

Sebastian Magpie
Registered User
Join date: 16 Mar 2005
Posts: 7
04-19-2005 04:35
If I could get some help with this request, I would really appreciate it :).

I would like to set up a listen that listens for certain words, and can pick them from the middle of any sentance.

An example word to listen for would be something like; "funny".

Ex. That was funny.
llSay(0,"lol";);
Ex. Funny people are great.
llSay(0,"lol";);
Ex You think it's funny punk?
llSay(0,"lol";)'

Thank you in advance for any help :).
_____________________
Chip Midnight Rocks My Sox!!!
Kali Dougall
Purple and Spikey
Join date: 5 Feb 2005
Posts: 98
04-19-2005 04:46
CODE
listen(integer channel, string name, key id, string message) {
if (llSubStringIndex(message, "funny") != -1) {
llSay(0, "lol");
}
}

Enjoy.
gene Poole
"Foolish humans!"
Join date: 16 Jun 2004
Posts: 324
04-19-2005 06:53
Excellent, Kali. Might I offer one slight improvement?

CODE
listen(integer channel, string name, key id, string message) {
if (llSubStringIndex(llToLower(message), "funny") != -1) {
llSay(0, "lol");
}
}

Case-insensitive, mang! :D Don't forget to put your replacement word for "funny" in lower-case, Seb.