carolina

carolina

CREATING A POSE BALL

1-Go to inventory >> Create >> new script >> named as you like >> double click to open >> paste the following between lines

-------------------------------------------------------------

//This text will appear in the floating title above the ball
string TITLE="sit";          
//You can play with these numbers to adjust how far the person sits from the ball. ( )
vector offset=<0.0,0.0,0.5>;          

///////////////////// LEAVE THIS ALONE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
string ANIMATION;
integer visible = TRUE;
key avatar;

vector COLOR = <1.0,1.0,1.0>;
float ALPHA_ON = 1.0;
float ALPHA_OFF = 0.0;

show(){
    visible = TRUE;
    llSetText(TITLE, COLOR,ALPHA_ON);      
    llSetAlpha(ALPHA_ON, ALL_SIDES);
}

hide(){
    visible = FALSE;
    llSetText("", COLOR,ALPHA_ON);      
    llSetAlpha(ALPHA_OFF, ALL_SIDES);
}

default{
    state_entry() {
        llSitTarget(offset,ZERO_ROTATION);
        if((ANIMATION = llGetInventoryName(INVENTORY_ANIMATION,0)) == ""){
            llOwnerSay("Error: No animation");
            ANIMATION = "sit";
            }
        llSetSitText(TITLE);
        show();
    }

    touch_start(integer detected) {
        //llOwnerSay("Memory: " + (string)llGetFreeMemory());
        if(visible){ hide(); }
        else       { show(); }
    }

    changed(integer change) {
        if(change & CHANGED_LINK) {
            avatar = llAvatarOnSitTarget();
            if(avatar != NULL_KEY){
                //SOMEONE SAT DOWN
                hide();
                llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
                return;
            }else{
                //SOMEONE STOOD UP
                if (llGetPermissionsKey() != NULL_KEY){ llStopAnimation(ANIMATION); }
                show();
                return;
            }
        }
        if(change & CHANGED_INVENTORY) { llResetScript(); }
        if(change & CHANGED_OWNER)     { llResetScript(); }
    }

    run_time_permissions(integer perm) {
        if(perm & PERMISSION_TRIGGER_ANIMATION) {
            llStopAnimation("sit");
            llStartAnimation(ANIMATION);
            hide();
        }
    }
}

-------------------------------------------------------------
Save and close.

2-You need the desired animation in your inventory.
3-Rez a sphere prim and give desired size and color.
Go to Content tab and grab-drop script and animation from your inventory.
4-RC on prim and sit or stand on it. Move and rotate prim untill your avatar get the right position.

No hay comentarios:

Publicar un comentario