|
Magelo Kidd
Registered User
Join date: 30 Jun 2007
Posts: 4
|
10-05-2007 11:09
Ok well here is my problem. I have a simple cloaking script that uses llGetOwner();. I am using it to cloak a door/wall and decloak it for entrance something a little different form the normal boring door scripts. My issue is it will only cloak and uncloak for me and no one else. Even after the owner of the item changes it refuses to do it. Here it the script code I am using. default { state_entry() { key owner = llGetOwner(); llWhisper(1,"Cloaking ready"  ; llListen(1,"",owner,""  ; } listen( integer channel, string name, key id, string message ) { if( message == "cloak" ) { llSetStatus(STATUS_PHANTOM, TRUE); llWhisper(1,"Cloaking"  ; llSetAlpha(0,ALL_SIDES); } if( message == "uncloak" ) { llSetStatus(STATUS_PHANTOM, FALSE); llWhisper(1,"Uncloaking"  ; llSetAlpha(1,ALL_SIDES); } } } I have even tried adding a llResetScript(); at the end of this but it still won't change ownership to allow anyone else to cloak/uncloak the door/wall.
|
|
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
|
10-05-2007 11:12
suggest add llResetScript() in an on_rez event within default
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
10-05-2007 11:38
or within the changed event like changed( integer vBitChanges ){ if (vBitChanges & CHANGED_OWNER){ llResetScript(); } }
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-05-2007 14:35
This is how it looks if you do what Debbie suggested: default { state_entry(){ key owner = llGetOwner(); llWhisper(1,"Cloaking ready"); llListen(1,"",owner,""); } listen( integer channel, string name, key id, string message ){ if( message == "cloak" ){ llSetStatus(STATUS_PHANTOM, TRUE); llWhisper(1,"Cloaking"); llSetAlpha(0,ALL_SIDES); } if( message == "uncloak" ){ llSetStatus(STATUS_PHANTOM, FALSE); llWhisper(1,"Uncloaking"); llSetAlpha(1,ALL_SIDES); } } on_rez(integer start_param){ llResetScript(); } }
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
|
10-05-2007 15:34
...and, of course, there is no reason why you could not use both solutions simulataneously  This would be especially beneficial if the script you presented evolves over time to include declared variables.
integer FutureVariable1 = 10; vector FutureVariable2 = <1.0,1.0,1.0>;
default { state_entry(){ key owner = llGetOwner(); llWhisper(1,"Cloaking ready"); llListen(1,"",owner,""); }
listen( integer channel, string name, key id, string message ){ if( message == "cloak" ){ llSetStatus(STATUS_PHANTOM, TRUE); llWhisper(1,"Cloaking"); llSetAlpha(0,ALL_SIDES); } if( message == "uncloak" ){ llSetStatus(STATUS_PHANTOM, FALSE); llWhisper(1,"Uncloaking"); llSetAlpha(1,ALL_SIDES); } }
changed( integer vBitChanges ){ if (vBitChanges & CHANGED_OWNER){ llResetScript(); } }
on_rez(integer start_param){ llResetScript(); } }
|
|
Shyan Graves
Registered User
Join date: 10 Feb 2007
Posts: 52
|
10-06-2007 06:15
Hi all,
The apply of llResetScript() was a good thing, to avoid malefunction after you gave the script/prim to another avi.., but I still have the impression that it will not fix the originally problem. After rereading the question I think Magelo wants to have the script work for differnt avis after it is setup, so that not only the owner can cloak/uncloak. But this will not be possible if the listen event is only listening to the owner. Maybe I get it wrong, but if this is what Magelo wants, the listen event and the llListen call have to be changed, so that everybody (you want this to be restricted by a list of allowed users or a special group) can issue a command. Shyan
|