Show/Hide Prim by Pose

Show/Hide Prim by Pose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/******************************************************************
* This example will hide a prim when certain poses are played.
* Place this script into the prim you want to make invisible.
******************************************************************/

// POSES: List of poses we want to make the prim invisible.
list POSES = ["Pose1","Pose2"];

// SITTER: If we only show/hide for a certain SITTER, or use -1 for all sitters.
integer SITTER=-1;

/******************************************************************
 * DON'T EDIT BELOW THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
******************************************************************/

default{
    link_message(integer sender, integer num, string msg, key id){
        if(num==90045){
            list data = llParseStringKeepNulls(msg,["|"],[]);
            integer SITTER_NUMBER = (integer)llList2String(data,0);
            if(SITTER==-1 || SITTER==SITTER_NUMBER){
                string POSE_NAME = llList2String(data,1);
                if(llListFindList(POSES,[POSE_NAME])!=-1){
                    llSetAlpha(0,ALL_SIDES);//invisible
                }
                else{
                    llSetAlpha(1,ALL_SIDES);//visible
                }
            }
        }
        else if(num==90065){//sitter stands up
            if(llGetAgentSize(llGetLinkKey(llGetNumberOfPrims()))==ZERO_VECTOR || (integer)msg==SITTER){
                llSetAlpha(1,ALL_SIDES);//visible
            }
        }
    }
}

Trending Tags