Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Whisper and listen

Anders otis
Registered User
Join date: 7 Oct 2004
Posts: 7
10-26-2004 14:31
Can somone please write a working whisper and listen script I can use as a guide. I am really new to scripting and I am tring to make things like if you say Hello box It will respond acrodingly. I wrote a code that should work and I dont know why it does not but I would greatly appreciate if somone could right a short one for me to use as a guide and a reference.
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
10-26-2004 14:48
From: Anders otis
Can somone please write a working whisper and listen script I can use as a guide. I am really new to scripting and I am tring to make things like if you say Hello box It will respond acrodingly. I wrote a code that should work and I dont know why it does not but I would greatly appreciate if somone could right a short one for me to use as a guide and a reference.


I'm writing this off the top of my head, so there might be some syntax errors. Consider it extra credit for fixing them
CODE

default
{
state_entry()
{
llListen(
0, // 0 is the channel avatars talk on by default
"", // do not filter for a specific name
NULL_KEY, // do not filter for a specific key
""); // do not filter for a specific message
}

listen (integer nChannel, string szWho, key kWhoKey, string szMessage)
{
llWhisper(0, // whisper the message on channel 0
"Hi there " + szWho + " I heard you say: " + szMessage + " on channel " + (string) nChannel);

}
}
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
10-26-2004 14:51
Aw, rats, Wednesday! I had just completed a listen script that would use the phrase "Dag, yo!" You're too darn fast. :D
_____________________
- Making everyone's day just a little more surreal -

Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
10-26-2004 18:42
Evil EVIL. Ya ya I know it only calls the listen in the state entry event so it shouldn't stack up (unless multiple states are used), but that' no reason not to give him a piece of code that shows the proper cleanup for listens.

Declare a global integer (above the default state

CODE

integer listen1;

default
{
state_entry()
{
llListenRemove(listen1);
listen1 = llListen(... etc so forth...
}
.
.
.
}


it keeps the ol' listen que nice and clean if you always do it this way. Specially when you get into bigger projects. Always do things explicitly (on purpose) rather than assuming the nice programming language will do it for you.
_____________________