Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

First Script Ever for Noob, Please Help~

Venusvelvet Cazalet
Registered User
Join date: 22 Feb 2007
Posts: 16
02-24-2007 04:47
i did search on the Scripting Tips forum but no luck (also the wiki page is dead atm :S). Anyway, this should be simple for anyone. What i want to do is to enable when the owner of the object touches it, the owner starts to fly; and when the owner is not touching it, he/she goes back on the ground. Here is the code:


default
{

touch_start(integer i)
{
// it requires the permission for animation.
llRequestPermissions(current_agent, PERMISSION_TRIGGER_ANIMATION);
llStartAnimation("fly";);

}

touch_end(integer i)
{
llStartAnimation("falldown";);
}

}


It's obviously got an error for the current_agent, but i don't know how to assign the object's owner (or my avatar in this case). Can anyone help please? :)
Ginge Reymont
Registered User
Join date: 10 Oct 2005
Posts: 190
02-24-2007 05:00
CODE

default
{

touch_start(integer i)
{
// it requires the permission for animation.
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
llStartAnimation("fly");

}

touch_end(integer i)
{
llStartAnimation("falldown");
}

}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-24-2007 12:12
You need to handle the run time permissions via its event.
Also it will be llDetectedKey(0) not llGetOwner() as it may not be the owner touching it,

CODE

default
{
state_entry()
{
}

touch_start(integer total_number)
{
// ask the owner for permission to trigger animations and to attach
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
}

touch_end(integer total_number)
{
llStopAnimation("fly");
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation("fly");
}
}
}
Venusvelvet Cazalet
Registered User
Join date: 22 Feb 2007
Posts: 16
02-25-2007 00:35
thanks guys, i'll give it a try !~