Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

touch_start attachment animation

Enigma Kidd
Registered User
Join date: 10 Feb 2007
Posts: 10
12-24-2007 12:11
After attaching the prim, when touching it, i would the animate verification menu to come up and on selecting ok, then animate the AV.

If I rez it and touch it works. But if i attach it, it doesn't. I'd appreciate any help.
This is as far as i've been able to get:


CODE

string gAnimName = "sleep";

default{
touch_start(integer num_detected) {
llWhisper(0, "touch_start");
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}

run_time_permissions(integer perm) {
llWhisper(0, "run_time_permissions");
if (perm & PERMISSION_TRIGGER_ANIMATION) {
llStartAnimation(gAnimName);
llSleep(3.0);
llStopAnimation(gAnimName);
}
}

on_rez(integer start_param) {
llWhisper(0, "on_rez");
llResetScript();
}

attach(key id){
llWhisper(0, "attach");
integer perm = llGetPermissions();
llWhisper(0, "perm: "+ (string)perm);
llWhisper(0, "id: "+ (string)id);

if (id != NULL_KEY) {
if (! (perm & PERMISSION_TRIGGER_ANIMATION)){
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
else{
if (perm & PERMISSION_TRIGGER_ANIMATION){
llStopAnimation(gAnimName);
}
}
}

}
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
12-24-2007 16:50
When you sit on or attach an object, the animate permission is granted by default (when requested). So, there is no need for the pop-up dialog asking for those permissions.
Enigma Kidd
Registered User
Join date: 10 Feb 2007
Posts: 10
12-25-2007 02:32
That would makes sense then. Think I'll create a menu on touch. Thanks Edison.
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
01-02-2008 08:33
This script works to animate an avatar when the item worn is touched.
This uses one of the SL built in animations (which does not loop), so it uses a timer to keep repeating it. You may not need that if your animation loops.

CODE

//touching worn object will open close mouth

string ANIMATION = "express_open_mouth";
integer TouchSW;

default
{
state_entry()
{
llSay(0, "Open Mouth Animation");
if (!(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION))
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}

changed(integer change)
{
if(change & 128) // You'd better put the this changed() event when you use llGetOwner
{ // by way of precaution.
llResetScript();
}
}

touch_start(integer total_number)
{
if(TouchSW == FALSE)
{
//llOwnerSay("Tongue Out");
llSetTimerEvent(0.5);
}
else
{
//llOwnerSay("Tongue In");

llSetTimerEvent(0);
}
TouchSW = !TouchSW;
}
timer()
{
llStopAnimation(ANIMATION);
llStartAnimation(ANIMATION);
}
}

_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo