|
Squash Otoro
Registered User
Join date: 20 Jun 2006
Posts: 6
|
09-13-2006 09:04
Hello,
I've noticed there' s a command to override the "Sit" text that appears when someone right clicks an object, but I don't see a command or event that handles when they actually click the Sit placeholder.
I've seen diving boads where, when you right-click them, you can dive off the board, so I know it's possible.
I can't use the touch event because that's reserved for something else.
I don't want them sitting on the object; I want, when that option is selected, to run some code I fill in.
What do I do?
|
|
Frans Charming
You only need one Frans
Join date: 28 Jan 2005
Posts: 1,847
|
09-13-2006 09:32
Basicly you want to do something like this. // When an avatar sits on the object containing this script, // the object will say "Get off!" and then force the avatar to stand up. default { state_entry() { llSitTarget(<0, 0, 0.1>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work } changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change // llSleep(0.5); // llUnSit works better with this delay <<< This comment is probably incorrect now! if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me llSay(0, "Get off!"); llUnSit(llAvatarOnSitTarget()); // unsit avatar } } } } C&P from a temp lsl wikiAs far as i know you can't really prevent sit, only stop it quickly. What the diving board does, is sit the av on a position and then override it with a diving animation. If you want different options on a touch you could look into llDialog
|
|
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
|
09-13-2006 10:42
Well ... the "Sit" option in the pie menu is just a default. You can override this by means of a script - best put in state_entry - and the command is llSetSitText("Put your text here"  . You are limited to just a few letters, though. This is just, however, changing the text. So if you do a bed and change the text to "Sleep" the avatar will still sit on it. To make the avatar actually sleep, additional code is needed - usually the sitting animation is stopped and a custom animation is played. If you'd be a bit more precise what you actually want to do further help would sure be incoming. 
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
Here's a quick sit replacement demo script
09-13-2006 20:16
key agent; default { state_entry() { //Your prompt here llSetSitText("Your Text Here"  ; } on_rez(integer num) { llResetScript(); } changed(integer change) { if (change & CHANGED_LINK) { agent = llAvatarOnSitTarget(); if ((agent != NULL_KEY) { llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION); //stop sit animation and replace with your own this one turns you 180 degrees llStopAnimation("sit"  ; llStartAnimation("turn_180"  ; //you probally want to add a sleep here llUnSit(agent); } } } }
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
Sample sit replacement script - replace prompt and animation
09-13-2006 20:37
default { state_entry() { llSitTarget(<0, 0, 0.1>, ZERO_ROTATION); llSetSitText("Your Text Here"  ; } changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change // llSleep(0.5); // llUnSit works better with this delay <<< This comment is probably incorrect now! if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION); //stop sit animation and replace with your own this one turns you 180 degrees llStopAnimation("sit"  ; llStartAnimation("turn_180"  ; //you probally want to add a sleep here before unsiting llUnSit(llAvatarOnSitTarget()); } } } }
|