Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

weird stuff happening!!

Naryu Yue
Interrupted?
Join date: 23 Jul 2007
Posts: 15
11-14-2007 11:28
heres what happens:

whenever anyone uses my camp thingy, it is the owner of the thingy who starts to dance. I know why it happens: i ask for permission debt and trigger animation together, so that i can have both when i need to make the person dance.

point is: i cant figure out how to make the permission for debt stick on it and still get permissions for starting an animation on the person who is sitting....

CODE

//camp script by Naryu Yue


//==================== setings ============================
integer cash = 4; //lindens to pay out
integer delay = 15; //time to wait between pays in minutes
integer maxCamp = 2; //how many times can a person be paid by the script per sit
//=========================================================

integer count = 0; //how many times the person has already been paid

integer permissionResult = FALSE;
key agentKey = NULL_KEY;

default
{
on_rez(integer param)
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT|PERMISSION_TRIGGER_ANIMATION);
}

state_entry()
{
llSetSitText("Camp!");
llSitTarget(<0,0,0.1>,<0,0,0,1>);
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if ( agentKey == NULL_KEY && agent != NULL_KEY ) //someone is dancing
{
agentKey = agent;

llStopAnimation("sit");
llStartAnimation("The Butt Shake Dance");
llSetTimerEvent(delay*60);
}
else if ( agentKey != NULL_KEY && agent == NULL_KEY) //person has gone away
{
if (permissionResult) //but the script has been initialized already
{
//Stop animating the avatar
llStopAnimation("The Butt Shake Dance");
llSetTimerEvent(0);
agentKey = NULL_KEY;
count = 0;
}
//llResetScript();
}
}
}

run_time_permissions(integer value)
{
if (value == PERMISSION_DEBIT|PERMISSION_TRIGGER_ANIMATION)
{
permissionResult = TRUE;
llSay(0, "Sistema inicializado");
}
}

timer()
{
llGiveMoney(agentKey, cash);
count += 1;
if (count==maxCamp)
{
llUnSit(agentKey);
}

}
}
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
11-14-2007 16:11
From lslwiki.net :

From: someone
Further, multiple agents may not grant permissions to the same script at the same time. For an object to have permissions for multiple agents simultaneously, one script is needed for each agent. They may still be within the same prim, however.

It may be best to use a separate script to handle the money, and communicate between the two scripts using llMessageLinked().

http://lslwiki.net/lslwiki/wakka.php?wakka=llRequestPermissions
http://lslwiki.net/lslwiki/wakka.php?wakka=llMessageLinked