Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Removing floating text on sit

Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
08-15-2007 03:12
I have the following script for a rotating chair - everything works well but I can't get the floating text to dissapear when the avatar sits on the chair - can anyone help?

float z = -0.5;
float x = 0.9;
float y = 0.0;
float rx = 0.0;
float ry = 3.0;
float rz = 0.0;
float s = 4.0;
string sitAnimation = "sit knees up2";

default {
on_rez(integer start_param) {
llResetScript();
}


state_entry()
{

llSitTarget(<x,y,z>,<rx, ry, rz, s>;);//ZERO_ROTATION
llTargetOmega(<0,0,1>,0.05,PI);
llSetText("Relax", <0,0,.3>, 2);

if (sitAnimation == "";) {
sitAnimation = llGetInventoryName(INVENTORY_ANIMATION, 0);

if (sitAnimation == "";) {
sitAnimation = "Sit";
}
}
}


changed(integer change) {
if (change & CHANGED_LINK) {
key avatar = llAvatarOnSitTarget();
if ( avatar != NULL_KEY ) {
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
}
}
}


run_time_permissions(integer parm) {
if(parm == PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation("sit";);
llStartAnimation(sitAnimation);
state sitting;
llSetText("", <0,0,0>, 0);
}
}
}


state sitting {
state_entry() {
}


touch_start(integer total_number) {
}


changed(integer change) {
if (change & CHANGED_LINK) {
llStopAnimation(sitAnimation);

llResetScript();
}
}


}
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
08-15-2007 04:07
You change states before you get to the llSetText. Just swap 'em:
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
08-15-2007 04:12
Thanks a lot for that :)