|
Vinicius Saintlouis
Registered User
Join date: 6 Dec 2006
Posts: 3
|
01-18-2007 02:42
i want to touch and play the animation touch again stop animation but lRequestPermissions is not working ... HELP MEEEE integer TouchSW; string gAnimName = "doublebassanim";
default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); }
touch_start(integer num_detected) { if(!TouchSW) { llStartAnimation(gAnimName) ; } else { llStopAnimation(gAnimName) ; } TouchSW = !TouchSW; }
}
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
01-18-2007 06:36
What do you mean by "llRequestPermissions is not working?" Do you not get the blue dialog box asking for permission when the script is saved/reset, or do you get a script error when you touch the object?
Is this in an attachment or a free-standing object? For attachments (and objects an avatar is sitting on), some permissions (including PERMISSION_TRIGGER_ANIMATION) are granted automatically and silently when asked for, so that the user isn't constantly bombarded by permission requests.
|
|
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
|
01-18-2007 08:24
Not sure why it's not working, but you should put a changed() handler in there and print what you get. Might give you a clue.
And you need to answer Deanna's questions.
|
|
Vinicius Saintlouis
Registered User
Join date: 6 Dec 2006
Posts: 3
|
01-18-2007 12:13
Is a attachment, it works with me but when another person wear the object it dont work. Blue box dont appear
|
|
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
|
01-18-2007 12:23
Of course it doesn't, because it asked YOU for permission, not the new owner. Objects do not change state or reinitialize when they change owners. You have to code it to handle ownership change. The simplest way to solve these problems is to add the following to every state -- assuming you want the object to completely restart on ownership change. This is the safe thing to do until you understand better and decide why not to do this for a specific script. changed(integer change) { if (change & CHANGED_OWNER) { llResetScript(); } }
|
|
Vinicius Saintlouis
Registered User
Join date: 6 Dec 2006
Posts: 3
|
Eureka.... It Works
01-18-2007 12:34
Thank you for your help guys. It works now. Special thank for Learjeff Innis integer TouchSW; string gAnimName = "doublebassanim";
default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } changed(integer change) { if (change & CHANGED_OWNER) { llResetScript(); } }
touch_start(integer num_detected) { if(!TouchSW) { llStartAnimation(gAnimName) ; } else { llStopAnimation(gAnimName) ; } TouchSW = !TouchSW; }
}
|