Listen channel question..
|
|
Macphisto Angelus
JAFO
Join date: 21 Oct 2004
Posts: 5,831
|
06-08-2008 02:34
Hi. I have a script that will hide/show an item when a voice command is used. It only works on Channel 0. I want to change it to another channel so the chat is not out loud when I make it appear/vanish. Here is the script: From: someone default { state_entry() { llListen(0,"",llGetOwner(),""  ; llSetAlpha(0.0,ALL_SIDES); llSetStatus(STATUS_PHANTOM,TRUE); } on_rez(integer sp) { llResetScript(); } listen( integer channel, string name, key id, string message ) { if( message == "/Hide" ) { llSetStatus(STATUS_PHANTOM, TRUE); //llWhisper(0,"Cloaking"  ; llSetAlpha(0,ALL_SIDES); llPlaySound("sound1", 1); } if( message == "/Show" ) { llSetStatus(STATUS_PHANTOM, FALSE); llSetAlpha(1,ALL_SIDES); llPlaySound("sound2", 1); } } } I changed the 0 in this string: llListen(0,"",llGetOwner(),""  ; but it didn't work. Obviously I am a scripting noob.  Can someone please tell me how to get this to work? Thanks for reading. 
_____________________
From: Natalie P from SLU Second Life: Where being the super important, extra special person you've always been sure you are (at least when you're drunk) can be a reality! From: Ann Launay I put on my robe and wizard ha... Oh. Nevermind then.
|
|
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
|
06-08-2008 02:44
Changing the zero is the correct thing to do, i think the confusion maybe over what you then type for the command.
For example if you change the 0 to 99, then as the script stands you would have to type
/99 /Hide or /99 /Show.
to get rid of having to use the second / remove it from the listen commands
eg change
if( message == "/Hide" ) to if( message == "Hide" )
and
if( message == "/Show" ) to if( message == "Show" )
then you would only need to type /99 Hide and /99 Show
Hope this helps.
|
|
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
|
06-08-2008 02:46
As well as changing the zero in "llListen(0,"",llGetOwner(),""  ;" to the channel number that you wish to use, also remove the slash "/" characters in front of the words "Hide" and "Show" in the lines "if( message == "/Hide" )" and "if( message == "/Show" )" respectively
integer ChannelNumber = 123;
default { state_entry() { llListen(ChannelNumber,"",llGetOwner(),""); llSetAlpha(0.0,ALL_SIDES); llSetStatus(STATUS_PHANTOM,TRUE); } on_rez(integer sp) { llResetScript(); }
listen( integer channel, string name, key id, string message ) { if( message == "Hide" ) { llSetStatus(STATUS_PHANTOM, TRUE); //llWhisper(0,"Cloaking"); llSetAlpha(0,ALL_SIDES); llPlaySound("sound1", 1); } if( message == "Show" ) { llSetStatus(STATUS_PHANTOM, FALSE); llSetAlpha(1,ALL_SIDES); llPlaySound("sound2", 1); } } }
EDIT: What Beverly said while I was typing 
_____________________
http://wiki.secondlife.com/wiki/User:debbie_Trilling
|
|
Macphisto Angelus
JAFO
Join date: 21 Oct 2004
Posts: 5,831
|
06-08-2008 02:51
Thank you both so much! I will try that right away. I appreciate your help. 
_____________________
From: Natalie P from SLU Second Life: Where being the super important, extra special person you've always been sure you are (at least when you're drunk) can be a reality! From: Ann Launay I put on my robe and wizard ha... Oh. Nevermind then.
|
|
Cookie Bertone
Music & Audio
Join date: 13 May 2006
Posts: 13
|
Changing Chat Channel
07-04-2008 05:49
I have a very similar question, so similar I though it best I post here instead of in a completely new thread. I have a script listening on a specific channel. I want to make it so the channel on which the device listens can be changed if it conflicts with another object. At the moment you can select the object, display a dialog, tell it to lower the channel and go to the correct bit of the script that should change the integer but no matter what I do it will not change and it keeps listening on the same channel. I would also like it to say in chat what the new channel is after it has been changed. I have copied what I think are the important bits out of the script below. integer chatchan = 97; default { state_entry() { llListen(chatchan, "", NULL_KEY, ""  ; } listen(integer channel, string name, key id, string message) { if (message=="down"  { llSay(0, "Down selected."  ; chatchan - 1; } } }
_____________________
Bertone Audio Systems Rossa (212, 98, 79)
Thanks to these forums the supplier of probably the best parcel music player in Second Life.
|
|
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
|
07-04-2008 06:22
From: Cookie Bertone I have a very similar question, so similar I though it best I post here instead of in a completely new thread. I have a script listening on a specific channel. I want to make it so the channel on which the device listens can be changed if it conflicts with another object. At the moment you can select the object, display a dialog, tell it to lower the channel and go to the correct bit of the script that should change the integer but no matter what I do it will not change and it keeps listening on the same channel. I would also like it to say in chat what the new channel is after it has been changed. I have copied what I think are the important bits out of the script below. integer chatchan = 97; default { state_entry() { llListen(chatchan, "", NULL_KEY, ""  ; } listen(integer channel, string name, key id, string message) { if (message=="down"  { llSay(0, "Down selected."  ; chatchan - 1; } } } chatchan - 1; //not right chatchan--; //should work and in fact this is what you need to do in your listen event: listen(integer channel, string name, key id, string message) { if (message=="down"  { llSay(0, "Down selected."  ; //Remove the old listen llListenRemove(chatchan); //Decrease the channel number chatchan--; // and start a new listen llListen(chatchan, "", NULL_KEY, ""  ; } }
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-04-2008 11:12
llListenRemove() takes a listen handle, not the channel you were listening to. You need to either switch states (to automatically end all listens), or introduce another variable: integer chatchan = 97; integer listenHandle = 0;
default { state_entry() { listenHandle = llListen(chatchan, "", NULL_KEY, ""); }
listen(integer channel, string name, key id, string message) { if (message=="down") { --chatchan; llSay(0, "Down selected. New channel is "+(string)chatchan);
llListenRemove(listenHandle); listenHandle = llListen(chatchan, "", NULL_KEY, ""); } } }
|
|
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
|
07-04-2008 22:37
From: Hewee Zetkin llListenRemove() takes a listen handle, not the channel you were listening to. You need to either switch states (to automatically end all listens), or introduce another variable:
You are right of course. That will teach me not to fire off code without checking it. 
|