IwGetAgentData

From InWorldz Wiki
Jump to: navigation, search

Scripting Wiki

InWorldz Functions | LSL Functions | Bot / NPC Functions | Events | Bot Events | Types | Operators | Constants | Flow Control | Glossary

Function: string iwGetAgentData( key id, integer data);

Returns a string of text information similar to the text normally returned through the dataserver event by llRequestAgentData.

  • key id - The UUID of the avatar to target
  • integer scope - link number of the target prim (one of the AGENT_LIST_* constants defined for iwGetAgentList) This can be:

DATA_ONLINE - Returns 0 if the avatar is offline, or 1 if online
DATA_NAME - The requested avatar's name.
DATA_BORN - The date the avatar was born or created on, in the ISO-8601 format YYYY-MM-DD.
DATA_PAYINFO - Returns a bit mask indicating the avatar's payment info.  0x1 is set if the avatar's payment info is on file, and 0x2 is set if the avatar's payment info is used.

Returns
string = the requested data. Blank if the given UUID is not an avatar.


Important Notes



Important Issues - View All - Search Mantis for related Bugs


Examples

The following is a script that will tell you if it is your rezday when clicked, and will also speak your name. Rezday and name are both detected through iwGetAgentData.

   integer IsRezDay(key id) {
       string rezdate = llGetSubString(iwGetAgentData(id, DATA_BORN), 5,-1);
       string today = iwFormatTime(iwGetLocalTime(), FALSE, "MM-dd");
       return (rezdate == today);
   }
   
   default
   {
       touch_start(integer num)
       {
           key id = llDetectedKey(0);
           integer i = IsRezDay(id);
           string username = iwGetAgentData(id, DATA_NAME);
           if(i) llSay(0, "It is your rezday, " + username + "!");
           else llSay(0, "It is not your rezday, " + username + ".");
       }
   }

General Notes

This function is only available in InWorldz.

See Also