Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to set an action after sitting

Marcio Moo
Registered User
Join date: 22 Mar 2007
Posts: 2
01-09-2008 19:16
How can I trigger a function just right after an agent sits on a target?
I've tried to put the call to that function following the llSitTarget(pos,rot) line but nothing happened.
Thanks,
Marcio Moo
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
01-09-2008 19:32
The script will get at changed() event, specifically CHANGED_LINK, when someone sits. Then you can test to see if you've got an llAvatarOnSitTarget(). Might consult the Scripting Library for poseball scripts to see an example.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-09-2008 21:13
bored so I'll toss this out

CODE

string gStrAnimationName = "animation name";

default{
state_entry(){
//--sit target code goes here
}

changed( integer vBitChanges){
if (CHANGED_LINK & vBitChanges){
gKeyAvatar = llAvatarOnSitTarget();
if (gKeyAvatar){
llRequestPermissions( gKeyAvatar, PERMISSION_TRIGGER_ANIMATION );
}//-- may need an else here to cancel animations when they get up, can't remember
}
}

run_time_permissions( integer vBitPermissions ){
if (PERMISSION_TRIGGER_ANIMATION & vBitPermissions){
llStartAnimation( gStrAnimationName );
}
}
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Marcio Moo
Registered User
Join date: 22 Mar 2007
Posts: 2
01-10-2008 04:47
Thank you very much, guys. It worked.
M.