File: Basic.em

Description: Functions for converting and manipulating number, character, and string values.
Last Modified: 6/23/2006

Bin(number)
Parameters:
NameType
numberThe number to convert
Explanation
Returns the binary coded value of 'number'
Return values
A binary coded number



CAsc(string)
Parameters:
NameType
stringString to convert
Explanation
Converts the first character of string to an ASCII code
Return values
ASCII code



CAscZ(string)
Parameters:
NameType
stringString to convert
Explanation
Converts the string to an array of the character's ASCII codes
Return values
Array of ASCII values



CChr(integer)
Parameters:
NameType
numberInteger to convert
Explanation
Converts an ASCII value to a string consisting of one character.
Return values
A character



CChrZ(array)
Parameters:
NameType
arrayArray of ASCII values
Explanation
Converts an array of ASCII values to a string
Return values
A string



CDbl(variable)
Parameters:
NameType
variableA variable Int or String
Explanation
Converts a string or int to a real. Only strings containing digits and '.' will return a predicatable result. Ints will be expanded.
Return values
A Real



CInt(variable)
Parameters:
NameType
variableA variable Real or String
Explanation
Converts a string or real to an integer. Only strings containing digits and '.' will return a predicatable result. Doubles will be truncated.
Return values
An Int



CStr(variable)
Parameters:
NameType
variableA variable Int or Real
Explanation
Converts a real or int to a string.
Return values
A String



Hex(number)
Parameters:
NameType
numberThe number to convert
Explanation
Returns the hexidecimal value of 'number'
Return values
A hexidecimal



Pack(object)
Parameters:
NameType
objectAn object to pack
Explanation
Packs a variable into POL's packed data string format. Note that object references CANNOT be saved with the world, but may be passed to other running scripts, or with an event.
Return values
A string



SizeOf(expression)
Parameters:
NameType
expressionAn expression to evaluate
Explanation
Returns an estimate of the memory used
Return values
An int



SplitWords( str, delimiter := " " )
Parameters:
NameType
stringThe string to split
delimiterThe delimiter to use
Explanation
Returns an array of words contained in 'string'. Words are separated by the delimiter.
Return values
An array



TypeOf(variable)
Parameters:
NameType
variablea script var
Explanation
Returns a string, depending on the variable type of the parameter. Is one of: "Dictionary", "AccountRef", "ConfigFileRef", "ConfigElemRef", "DataFileRef", "DataElemRef", "ScriptExRef", "GuildRef", "BoundingBox", "DebugContext", "Package", "MenuRef", "MobileRef", "OfflineMobileRef", "ItemRef", "BoatRef", "MultiRef", "Unknown", "Uninit", "String", "Integer", "Double", "Array", "ApplicPtr", "ApplicObj", "Error", "Struct", "Packet".
Return values
A string



Unpack(string)
Parameters:
NameType
stringA string to unpack
Explanation
Unpacks a "packed data string" into the variable it represents. See Pack().
Return values
A variable



find(string, search, start)
Parameters:
NameType
stringThe string to search in
searchThe string to search for
startThe index to start searching at
Explanation
Returns the index of the first occurance of 'search' after 'start' within 'string'
Return values
An int



left(string, count)
Parameters:
NameType
stringThe string to search
countAn int to start from
Explanation
Returns 'count' characters starting from the leftmost character in string 'string'. Reportedly not working in 095. Instead use substrings- Str[start_index,length] returns a substring.
Return values
An Int



len(string|array)
Parameters:
NameType
string|arrayA string or array
Explanation
For strings, returns string length. For arrays, returns number of elements. Does not work for structs or dictionaries, use .size() for those.
Return values
An Int



lower(string)
Parameters:
NameType
stringA string to convert
Explanation
Converts 'string' to lowercase (doesn't work with high-ascii characters or unicode)
Return values
A string



print(anything)
Parameters:
NameType
anythingAny object, or primitive.
Explanation
Prints 'anything' to the console. If it's a string or number, it will show the value. If it's an array, struct or dictionary, it will show the contents of the structure fairly nicely. On Packets it will show the content. Else, it shows the type of object, i.e. 'ItemRef'.
Return values
Nothing



upper(string)
Parameters:
NameType
stringA string to convert
Explanation
Converts 'string' to uppercase (doesn't work with high-ascii characters or unicode)
Return values
A string




If you know if any information is incorrect on these pages, mail your corrections to shinigami@gmx.net

Copyright ©2003-2011 David Carpman and Shinigami, all rights reserved. DO NOT REPRODUCE, MIRROR, ALTER, SPINDLE, MUTILATE, OR SIT ON.