|
Brett Bjornson
Registered User
Join date: 8 Nov 2005
Posts: 25
|
02-20-2007 11:33
I've tried this: changed(integer change) { if(change & CHANGED_LINK) //Is someone sitting? { agent = llAvatarOnSitTarget(); if(agent != NULL_KEY) //Yes, someone is sitting. { llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION); if(agent == NULL_KEY) //No one is sitting. { llStopAnimation("HeadChop"  ; llPushObject(agent, 15.0 * llRot2Left(llGetRot()), <10.0,10.0,10.0>, FALSE); //Move the avatar off the object. } } } But it doesn't work. I want the avatar to be pushed several meters away from the object they were sitting on when they stand up. Thanks!
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-20-2007 14:02
From: Brett Bjornson I've tried this: changed(integer change) { if(change & CHANGED_LINK) //Is someone sitting? { agent = llAvatarOnSitTarget(); if(agent != NULL_KEY) //Yes, someone is sitting. { llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION); if(agent == NULL_KEY) //No one is sitting. { llStopAnimation("HeadChop"  ; llPushObject(agent, 15.0 * llRot2Left(llGetRot()), <10.0,10.0,10.0>, FALSE); //Move the avatar off the object. } } } But it doesn't work. I want the avatar to be pushed several meters away from the object they were sitting on when they stand up. Thanks! Your code will NEVER work as written. You first check that the agent is not NULL and then inside this check you check that it is NULL, mutually exclusive requirements. Then on top of that inside the agent si null check you try to push a NULL_KEY, aint going to work!!! Your code needs to remember who the agent was and then push them when they are no longer sitting. The code below is a reworking of your original post that should correct the problems I stated, however depending upon your full script it may still have problems.
// NEW GLOBAL variable key agent = NULL_KEY;
changed(integer change) { if(change & CHANGED_LINK) //Is someone sitting? { key current_agent = llAvatarOnSitTarget(); if(current_agent != NULL_KEY) //Yes, someone is sitting. { agent = current_agent; llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION); } else //No one is sitting. { llStopAnimation("HeadChop"); llPushObject(agent, 15.0 * llRot2Left(llGetRot()), <10.0,10.0,10.0>, FALSE); //Move the avatar off the object. agent = NULL_KEY; } } }
|