|
Barry Moody
Registered User
Join date: 17 Dec 2006
Posts: 24
|
09-08-2007 08:10
Okay, this is frustrating me... I have a listen () in a script that is supposed to change the color/visibility of hovering text. When I rez the object containing the script and use the chat command it works just fine, but when I give a copy of the object to someone else to test, it won't work...
listen (integer channel, string name, key id, string message) {
llInstantMessage (id, llKey2Name (id) + " has set the text to " + message); if (id == llGetOwner ()) {
//color changing code//
}
}
This is the basic version... When I enter "/100 off" into chat, it turns off the text and get the instant message that I turned it off. I've given a couple friends a copy of the same object but when they test, they get nothing at all.
Any ideas?
|
|
Hanumi Takakura
Registered User
Join date: 24 May 2006
Posts: 57
|
09-08-2007 08:24
Use this in your code
{ changed(integer change) { if(change & CHANGED_OWNER) llResetScript(); } }
Sometimes it will requiere the user to re-attach the item after the first time. But it will work from the second time and on.
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
09-08-2007 17:04
Is your listen being set up in the state_entry event, using the owner key?
If you give the object away, the state_entry won't necessarily be rerun. If that happens, the listen is still set to the previous owner, which is you.
Using the script reset function will rerun it, as Hanumi showed. It also doesn't hurt to that it resets any global variables.
|