|
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
|
08-02-2007 10:20
This should be very simple but... Why do I get a return of all zero's on the detected key with this code? From: someone integer RegionChannel = 1005; key ObjectOwner; default { on_rez(integer start_param) { llResetScript(); } state_entry() { llListenRemove(0); key owner = llGetOwner(); llListen(RegionChannel,"",NULL_KEY,""  ; } listen( integer channel, string name, key id, string message ) { ObjectOwner = llDetectedOwner(0); llSay(0, "Key: " + (string)ObjectOwner);//Debug Message if(ObjectOwner != llGetOwner()){return;} if(llToLower(message) == "kill fulcrum"  { llDie(); } } }
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
08-02-2007 10:27
llDetected* functions are only designed to return valid values in sensor(), touch*(), and similar events. They are not valid in the listen() event. If you want to get the owner of something talking in that event, use llGetOwnerKey(id).
Also, I would recommend against assuming that your listener handle is always 0. There's no guarantee that the first/only listener handle is any particular value. Save it in a variable and use it in the llListenRemove() call.
|
|
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
|
08-02-2007 10:32
From: Talarus Luan llDetected* functions are only designed to return valid values in sensor(), touch*(), and similar events. They are not valid in the listen() event. If you want to get the owner of something talking in that event, use llGetOwnerKey(id). Also, I would recommend against assuming that your listener handle is always 0. There's no guarantee that the first/only listener handle is any particular value. Save it in a variable and use it in the llListenRemove() call. Ah thanks. Yeah this is just a test I was running so I didn't bother with handles yet. Thanks for the info. 
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
08-02-2007 15:48
You could also take a look at llGetOwnerKey(id) in the listen. That may solve an issue too. http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetOwnerKeyBest /esc
_____________________
http://slurl.com/secondlife/Together
|