LlDetermineType - Second Life Wiki

LlDetermineType

From Second Life Wiki

Second Life Wiki > LlDetermineType
Jump to: navigation, search

Template:Needs Translation/LSL/de Template:Needs Translation/LSL/es Template:Needs Translation/LSL/el Template:Needs Translation/LSL/fr Template:Needs Translation/LSL/he Template:Needs Translation/LSL/it Template:Needs Translation/LSL/ja Template:Needs Translation/LSL/ko Template:Needs Translation/LSL/nl Template:Needs Translation/LSL/hu Template:Needs Translation/LSL/no Template:Needs Translation/LSL/da Template:Needs Translation/LSL/sv Template:Needs Translation/LSL/tr Template:Needs Translation/LSL/pl Template:Needs Translation/LSL/pt Template:Needs Translation/LSL/ru Template:Needs Translation/LSL/uk Template:Needs Translation/LSL/zh-Hans Template:Needs Translation/LSL/zh-Hant

Image:Emblem-important-yellow.png LSL Feature Request
The described function does not exist. This article is a feature request.

Contents

Summary

Function: integer llDetermineType( string source, integer start, integer end );
REQUEST Function ID
0.0 Delay
0.0 Energy

Returns an integer to represent the type of the part of the string.

• string source The string that you are determining the type of a part of.
• integer start The start point in the string of what you are determining.
• integer end The end point in the string of what you are determining.

start & end do not support negative indexes.

Type Description
TYPE_INTEGER 1 integer
TYPE_FLOAT 2 float
TYPE_STRING 3 string
TYPE_KEY 4 key
TYPE_VECTOR 5 vector
TYPE_ROTATION 6 rotation
TYPE_INVALID 0 none

Caveats

  • If either start or end are out of bounds the script continues to execute without an error message.

Search JIRA for related Bugs

Examples

 
default
{
    state_entry()
    {
        llListen(0,"",llGetOwner(),"");
    }
    listen(integer chan, string name, key id, string msg)
    {
        if(llDetermineType(msg,0,-1) == TYPE_INTEGER)
        {
            integer new_number = (integer)msg;
            vector also = <new_number,new_number*8,new_number/3>;
            llOwnerSay("The number you just said was "+(string)new_number+" and put in a vector, it is "+also+".");
        }
    }    
}
 

Notes

Should make it easier for scripters to determine the types of parts of strings in order to get accurate results as opposed to manually deriving them from the string. Could anyone delete the unnecessary parts to this page? This is my first time editing and I can't find it :P

Deep Notes

Comments

The trouble is, that when it comes to floats it's hard to tell them from integers if the decimal has been stripped. Or strings from keys... or strings that look like any of the other types. You can guess but you can't be sure; if you are building a function on top of logic that isn't perfect then you end up with something that isn't all that useful. -- Strife (talk </div></div>