User:Toy Wylie/RLV Documentation/getoutfit

From Second Life Wiki
Jump to navigation Jump to search


@getoutfit

Type

General

Implemented

Implemented since RLV version 1.10

Usage

@getoutfit[:clothingtype]=<channel>

Purpose

Gets a list of clothes worn by the avatar. The list will be sent as chat to the specified channel. The response is a string of "0" and "1", "0" meaning, the clothing type is not worn, "1" meaning, the clothing type is worn. The index of the number in the string corresponds to the following list:
  • gloves,jacket,pants,shirt,shoes,skirt,socks,underpants,undershirt,skin,eyes,hair,shape,alpha,tattoo
If a clothing type is specified it returns only the status of this single clothing type.

Notes

* Make sure to have a timeout while waiting for the list to appear, because viewers without RLV won't answer this query at all.

See Also

Example

<lsl>integer channel;

integer listener;

list clothingTypes= [

   "gloves","jacket","pants","shirt","shoes","skirt","socks","underpants",
   "undershirt","skin","eyes","hair","shape","alpha","tattoo"

];

removeListener() {

   if(listener!=0)
   {
       llListenRemove(listener);
       listener=0;
   }
   llSetTimerEvent(0.0);

}

default {

   state_entry()
   {
       listener=0;
       llOwnerSay("Touch me to find out which clothing types you are wearing.");
   }

   touch_start(integer total_number)
   {
       if(listener!=0)
       {
           llOwnerSay("We are already looking for clothes. Please wait for the scan to finish.");
           return;
       }
       channel=(integer) (llFrand(100000)+100000);
       listener=llListen(channel,"",llDetectedKey(0),"");
       llSetTimerEvent(5.0);
       llOwnerSay("Scanning for clothes ...");
       llOwnerSay("@getoutfit="+(string) channel);
   }

   listen(integer channel,string name,key sender,string message)
   {
       removeListener();
       integer index;
       integer len=llGetListLength(clothingTypes);

       for(index=0;index<len;index++)
       {
           if(llGetSubString(message,index,index)=="1")
           {
               string name=llList2String(clothingTypes,index);
               llOwnerSay("Clothing type '"+name+"' is worn.");
           }
       }
       llOwnerSay("Scan complete.");
   }

   timer()
   {
       removeListener();
       llOwnerSay("Scan timeout. You are probably not using RLV.");
   }

}

</lsl>