From Dreamnation
Jump to: navigation, search

Some built-in functions not described elsewhere

 C#-style argument substring functions:
   string xmrSubstring (string s, integer offset)
   string xmrSubstring (string s, integer offset, integer length)
 Java-style argument substring function:
   string xmrJSubstring (string s, integer beg, integer end)
 C#-style string searches:
   integer xmrStringIndexOf (string haystack, string needle)
   integer xmrStringIndexOf (string haystack, string needle, integer startat)
   integer xmrLastStringIndexOf (string haystack, string needle)
   integer xmrLastStringIndexOf (string haystack, string needle, integer startat)
   integer xmrStringStartsWith (string haystack, string needle)
   integer xmrStringEndsWith (string haystack, string needle)
 These functions convert strings to the given type
 but unlike standard LSL policy of return something even if wrong,
 they will throw an exception on conversion error:
   float xmrString2Float (string s)
   integer xmrString2Integer (string s)
   rotation xmrString2Rotation (string s)
   vector xmrString2Vector (string s)
 These functions convert values to strings
 with a C#-style formatting argument.
 Use "" to take the C# default.
   string xmrFloat2String (float val, string fmt)
   string xmrInteger2String (integer val, string fmt)
   string xmrRotation2String (rotation val, string fmt)
   string xmrVector2String (vector val, string fmt)
 Seat an avatar on a prim:
   integer xmrSeatAvatar (integer owner)
       owner = 0 : seat avatar that has granted this script PERMISSION_TRIGGER_ANIMATION
               1 : seat avatar that owns the prim this script is in
        0 : successful
       -1 : PERMISSION_TRIGGER_ANIMATION not granted
       -2 : no permissions requested by script
       -3 : avatar not present in region

36-character UUID string to/from Base64 string (provides a 22-char representation of a UUID):

   string xmrUUIDToBase64 (string uuidashexandhyphens)
       uuidashexandhypends = 36-char UUID as hex digits and hyphens
       22-char UUID as base64
   string xmrBase64ToUUID (string uuidasbase64)
       uuidasbase64 = 22-char UUID as returned by xmrUUIDToBase64()
       36-char UUID as hex digits and hyphens