Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
12-22-2005 12:20
I'm not gonna post the whole code (most of it works)...but I'll post the parts that don't work...essentially...person enters a channel they wish commands to switch to...and the channel is supposed to switch...but isn't switching...
getlisten() { integer _permittednumber = llGetListLength(permitted); llListen(channel, "", llGetOwner(),""); if(_permittednumber >= 1) { integer _y; for(_y = 0; _y < _permittednumber; _y++) { string _currentlist = llList2String(permitted, _y); llListen(channel, _currentlist, NULL_KEY, ""); } } }
removelisten() { integer _permittednumber = llGetListLength(permitted); llListenRemove(llListen(channel, "", llGetOwner(),"")); if(_permittednumber >= 1) { integer _y; for(_y = 0; _y < _permittednumber; _y++) { string _currentlist = llList2String(permitted, _y); llListenRemove(llListen(channel, _currentlist, NULL_KEY, "")); } } }
default { ....
listen(integer channel, string name, key id, string message) { if(_command == "!") { removelisten(); string _chan = (string)_listname; channel = (integer)_chan; llInstantMessage(id, "Listen channel for privacy and open commands has been switched to " + (string)channel); getlisten(); } } .... }
Thing is...the instant message fires off perfectly...so I know that "channel" is switching...but it's not reading in the getlisten() or removelisten() functions...
_____________________
--AeonVox--Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
|
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
|
12-22-2005 12:36
I think the trouble is in the llListenRemove(llListen(...)) un-idiom you are using. llListen() returns a listener handle (small integer) kind of like Unix file descriptors. If you store that handle, llListenRemove(handle) will happily remove it.
However your llListenRemove(llListen(...)) is creating a new listener which is Removed before it can do anything. Put another way, llListenRemove(llListen(...)) does nothing. You should be saving the handles given you by llListen, possibly in your getListen() function - but it is hard to tell out of context.
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
12-22-2005 12:46
O.k...I thought that might have been the problem...and that helps me get the listen remove...but doesn't do anything for adding the new listen...who knows though...I might be able to change it and get all I want...
_____________________
--AeonVox--Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-22-2005 12:53
listen(integer channel, string name, key id, string message) Do you also have 'channel' as a global variable? If you do, then anything you do to channel inside the listen handler is updating this local variable, and your global isn't getting updated. This line: channel = (integer)_chan; And this line: llListenRemove(llListen(channel, "", llGetOwner(),"")); Seem to be using different variables, both called 'channel'.
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
12-22-2005 15:15
Actually...Ziggy, you are completely right. I caught that while workin' on the previous suggestion and everything works perfectly now. Funny how you can lose yourself in things...
_____________________
--AeonVox--Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
|