TAMEScript Function Reference
TAMEScript Function Reference

TAMEScript Function Reference

Quick Reference

NOTE: VALUEs that mention a sub-type denote that the input value is coerced/converted to that type before evaluation, or returned as that type.

Cues

Command Name Parameters Returns Description
AddCue VALUE1(STRING), VALUE2(STRING) Nothing Adds a cue of type VALUE1 to the response with content VALUE2.
Text VALUE(STRING) Nothing Convenience for AddCue("text", VALUE)
Textln VALUE(STRING) Nothing Convenience for AddCue("text", VALUE + "\n")
Textf VALUE(STRING) Nothing Convenience for AddCue("textf", VALUE)
Textfln VALUE(STRING) Nothing Convenience for AddCue("textf", VALUE + "\n")
Pause None Nothing Convenience for AddCue("pause", "")
Wait VALUE(INTEGER) Nothing Convenience for AddCue("wait", VALUE)

Values

Command Name Parameters Returns Description
AsBoolean VALUE VALUE(BOOLEAN) Returns the boolean value of VALUE.
AsInt VALUE VALUE(INTEGER) Returns the integer value of VALUE.
AsFloat VALUE VALUE(FLOAT) Returns the floating-point value of VALUE.
AsString VALUE VALUE(STRING) Returns the string value of VALUE.
AsList VALUE VALUE(LIST) Returns VALUE encapsulated as a list, if it isn't one.
Length VALUE VALUE(INTEGER) Returns the length of VALUE. If numeric/boolean, this returns 1. If string, the length of the string in characters is returned. If list, the the amount of elements in the list is returned.
Empty VALUE VALUE(BOOLEAN) Returns TRUE if VALUE is considered "empty." If boolean and false, this returns TRUE. If numeric and 0, this returns TRUE. If string and trimmed to length 0, this returns TRUE. If list and length 0, this returns TRUE.

String Operations

Command Name Parameters Returns Description
StrIndex VALUE1(STRING), VALUE2(STRING) VALUE(INTEGER) Returns the index of the first occurrence of VALUE2 in VALUE1, or -1 if not found.
StrLastIndex VALUE1(STRING), VALUE2(STRING) VALUE(INTEGER) Returns the index of the last occurrence of VALUE2 in VALUE1, or -1 if not found.
StrContains VALUE1(STRING), VALUE2(STRING) VALUE(BOOLEAN) Returns TRUE if VALUE2 is in VALUE1, or FALSE if not.
StrStartsWith VALUE1(STRING), VALUE2(STRING) VALUE(BOOLEAN) Returns TRUE if string VALUE1 starts with string VALUE2, or FALSE if not.
StrEndsWith VALUE1(STRING), VALUE2(STRING) VALUE(BOOLEAN) Returns TRUE if string VALUE1 ends with string VALUE2, or FALSE if not.
StrReplace VALUE1(STRING), VALUE2(STRING), VALUE3(STRING) VALUE(STRING) Returns the resultant string of taking VALUE1 and replacing the first occurrence of VALUE2 with VALUE3.
StrReplaceLast VALUE1(STRING), VALUE2(STRING), VALUE3(STRING) VALUE(STRING) Returns the resultant string of taking VALUE1 and replacing the last occurrence of VALUE2 with VALUE3.
StrReplaceAll VALUE1(STRING), VALUE2(STRING), VALUE3(STRING) VALUE(STRING) Returns the resultant string of taking VALUE1 and replacing the all occurrences of VALUE2 with VALUE3.
StrConcat VALUE1(STRING), VALUE2(STRING) VALUE(STRING) Returns the resultant string of sticking two strings together: VALUE1 and VALUE2.
Substring VALUE1(STRING), VALUE2(INTEGER), VALUE3(INTEGER) VALUE(STRING) Returns a part of a larger string VALUE1, from zero-based character index VALUE2(INTEGER) (inclusive), to index VALUE3(INTEGER) (exclusive).
StrLower VALUE(STRING) VALUE(STRING) Returns VALUE as a lower-case string. May be locale-specific.
StrUpper VALUE(STRING) VALUE(STRING) Returns VALUE as an upper-case string. May be locale-specific.
StrChar VALUE1(STRING), VALUE2(INTEGER) VALUE(STRING) Returns a string consisting of one character from VALUE1 using VALUE2 as the zero-based offset into the string.
StrTrim VALUE(STRING) VALUE(STRING) Returns VALUE with superfluous whitespace removed from both the start and end.
StrSplit VALUE1(STRING), VALUE2(STRING) VALUE(LIST) Returns a list of strings that is the result of splitting VALUE1 into tokens using VALUE2 as the delimiter.
StrJoin VALUE1(LIST), VALUE2(STRING) VALUE(STRING) Returns a string that is the result of joining the tokens in VALUE1 using VALUE2 as the string in between each.
StrParam VALUE1(STRING), VALUE2(LIST) VALUE(STRING) Returns VALUE with bracketed numbers replaced with the corresponding value at the provided list's index.

RegEx

Command Name Parameters Returns Description
IsRegex VALUE(STRING) VALUE(BOOLEAN) Returns TRUE if the provided string is a valid RegEx.
RegexContains VALUE1(STRING), VALUE2(STRING) VALUE(BOOLEAN) Returns TRUE if VALUE2 contains a substring that matches RegEx VALUE1.
RegexFind VALUE1(STRING), VALUE2(STRING) VALUE(INTEGER) Returns the starting index in VALUE2 of the first substring that matches RegEx VALUE1, -1 otherwise.
RegexFindList VALUE1(STRING), VALUE2(STRING) VALUE(INTEGER) Returns the starting index in VALUE2 of the last substring that matches RegEx VALUE1, -1 otherwise.
RegexGet VALUE1(STRING), VALUE2(STRING) VALUE(STRING) or VALUE(BOOLEAN) Returns the first substring in VALUE2 that matches RegEx VALUE1, FALSE on no match.
RegexGetLast VALUE1(STRING), VALUE2(STRING) VALUE(STRING) or VALUE(BOOLEAN) Returns the last substring in VALUE2 that matches RegEx VALUE1, FALSE on no match.
RegexGetAll VALUE1(STRING), VALUE2(STRING) VALUE(LIST) Returns all substrings in VALUE2 that matches RegEx VALUE1 in the order found.
RegexMatches VALUE1(STRING), VALUE2(STRING) VALUE(BOOLEAN) Returns TRUE if VALUE2 matches RegEx VALUE1 completely, FALSE otherwise.
RegexSplit VALUE1(STRING), VALUE2(STRING) VALUE(LIST) Splits VALUE2 into multiple strings using RegEx VALUE1 as a delimiter pattern.
RegexReplace VALUE1(STRING), VALUE2(STRING), VALUE3(STRING) VALUE(STRING) Returns a new string where the substrings in VALUE3 that match RegEx VALUE1 are replaced with VALUE2.

List Operations

Command Name Parameters Returns Description
ListNew VALUE(INTEGER) VALUE(LIST) Creates a new list of length VALUE.
ListAdd VALUE1(LIST), VALUE2 VALUE(BOOLEAN) Adds VALUE2 to a list, VALUE1, returns TRUE if added, FALSE otherwise.
ListAddAt VALUE1(LIST), VALUE2, VALUE3(INTEGER) VALUE(BOOLEAN) Adds VALUE2 to a list, VALUE1, at index VALUE3, returns TRUE if added, FALSE otherwise.
ListRemove VALUE1(LIST), VALUE2 VALUE(BOOLEAN) Removes VALUE2 from a list, VALUE1, returns TRUE if removed, FALSE otherwise (strict compare).
ListRemoveAt VALUE1(LIST), VALUE2(INTEGER) VALUE Removes a value from a list, VALUE1, at index VALUE2. Returns the value removed, or FALSE otherwise.
ListConcat VALUE1(LIST), VALUE2(LIST) VALUE(LIST) Concatenates two lists (or two values as though they were lists) and returns a new list.
ListIndex VALUE1(LIST), VALUE2 VALUE(INTEGER) Returns the index of a value in the list (strict compare), or -1 if not found.
ListContains VALUE1(LIST), VALUE2 VALUE(BOOLEAN) Returns TRUE if a value in the list exists (strict compare), or FALSE if not found.

Mathematics

Command Name Parameters Returns Description
Floor VALUE(FLOAT) VALUE(FLOAT) Returns the mathematical floor of VALUE.
Ceiling VALUE(FLOAT) VALUE(FLOAT) Returns the mathematical ceiling of VALUE.
Round VALUE(FLOAT) VALUE(FLOAT) Returns VALUE rounded to the nearest whole number (banker's rounding).
Fix VALUE1(FLOAT), VALUE2(INTEGER) VALUE(FLOAT) Returns VALUE1 rounded to the nearest digit place denoted by VALUE2.
Sqrt VALUE(FLOAT) VALUE(FLOAT) Returns the square root of VALUE.
PI None VALUE(FLOAT) Returns the value of the mathematical constant Pi (π).
E None VALUE(FLOAT) Returns the value of Euler's Number.
sin VALUE(FLOAT) VALUE(FLOAT) Returns the mathematical Sine of VALUE.
cos VALUE(FLOAT) VALUE(FLOAT) Returns the mathematical Cosine of VALUE.
tan VALUE(FLOAT) VALUE(FLOAT) Returns the mathematical Tangent of VALUE.
min VALUE1, VALUE2 VALUE Returns the comparative minimum of VALUE1 and VALUE2.
max VALUE1, VALUE2 VALUE Returns the comparative maximum of VALUE1 and VALUE2.
Clamp VALUE1(FLOAT), VALUE2(FLOAT), VALUE3(FLOAT) VALUE(FLOAT) Returns VALUE1 clamped between the range of VALUE2 and VALUE3.
IRandom VALUE(INTEGER) VALUE(INTEGER) Returns a random integer from 0 up to VALUE (but not VALUE).
FRandom None VALUE(FLOAT) Returns a random float from 0.0 (inclusive) to 1.0 (exclusive).
GRandom VALUE1(FLOAT), VALUE2(FLOAT) VALUE(FLOAT) Returns a random Gaussian-distributed float from mean VALUE1 and standard deviation VALUE2.

Time

Command Name Parameters Returns Description
Time None VALUE(INTEGER) Returns the current system time as an integer value (milliseconds since UNIX Epoch).
TimeFormat VALUE1(INTEGER), VALUE2(STRING) VALUE(STRING) Returns a time value formatted into text.

Elements

Command Name Parameters Returns Description
ObjectHasName OBJECT, VALUE(STRING) VALUE(BOOLEAN) Returns TRUE if OBJECT can be referred to as VALUE, FALSE if not.
AddObjectName OBJECT, VALUE(STRING) Nothing Adds a name VALUE to OBJECT. Affected by determiners.
RemoveObjectName OBJECT, VALUE(STRING) Nothing Removes a name VALUE from OBJECT. Affected by determiners.
ObjectHasTag OBJECT, VALUE(STRING) VALUE(BOOLEAN) Returns TRUE if OBJECT has a tag called VALUE, FALSE if not.
AddObjectTag OBJECT, VALUE(STRING) Nothing Adds a tag called VALUE to OBJECT.
AddObjectTagToAllIn OBJECT-CONTAINER, VALUE(STRING) Nothing Adds a tag called VALUE to all objects in OBJECT-CONTAINER.
RemoveObjectTag OBJECT, VALUE(STRING) Nothing Removes a tag called VALUE from OBJECT.
RemoveObjectTagFromAllIn OBJECT-CONTAINER, VALUE(STRING) Nothing Removes all tags called VALUE from objects in OBJECT-CONTAINER.
GiveObject OBJECT-CONTAINER, OBJECT Nothing Sets the ownership of OBJECT to OBJECT-CONTAINER.
RemoveObject OBJECT Nothing Removes OBJECT from its current owner.
HasObject OBJECT-CONTAINER, OBJECT VALUE(BOOLEAN) Returns TRUE if OBJECT-CONTAINER is the owner of OBJECT, FALSE otherwise.
MoveObjectsWithTag OBJECT-CONTAINER1, OBJECT-CONTAINER2, VALUE(STRING) Nothing Sets the ownership of all objects in OBJECT-CONTAINER1 with tag VALUE to OBJECT-CONTAINER2.
ObjectHasNoOwner OBJECT VALUE(BOOLEAN) Returns TRUE if OBJECT does not have an owner, FALSE otherwise.
ObjectCount OBJECT-CONTAINER VALUE(INTEGER) Returns how many objects are in OBJECT-CONTAINER.
Browse OBJECT-CONTAINER Nothing For each object in OBJECT-CONTAINER, execute the proper "browse" block for it.
BrowseTagged OBJECT-CONTAINER, VALUE(STRING) Nothing For each object in OBJECT-CONTAINER with tag VALUE, execute the proper "browse" block for it.
SetPlayer PLAYER Nothing Sets the current player to PLAYER.
CurrentPlayerIs PLAYER VALUE(BOOLEAN) Returns TRUE if the current player is PLAYER, FALSE otherwise.
NoCurrentPlayer None VALUE(BOOLEAN) Returns TRUE if no current player is set, FALSE otherwise.
SetRoom PLAYER, ROOM Nothing Sets the current room on PLAYER to ROOM. Clears PLAYER's room stack, first.
PushRoom PLAYER, ROOM Nothing Pushes ROOM room on PLAYER's current room stack.
PopRoom PLAYER Nothing Restores the previous room on PLAYER's current room stack. Error if no room.
SwapRoom PLAYER, ROOM Nothing Swaps the current room with ROOM on PLAYER's current room stack. The rest of the stack is unaffected.
PlayerHasRoomInStack PLAYER, ROOM VALUE(BOOLEAN) Returns TRUE if PLAYER's current room is ROOM, FALSE otherwise.
CurrentRoomIs PLAYER, ROOM VALUE(BOOLEAN) Returns TRUE if the current room for PLAYER is ROOM, FALSE otherwise.
NoCurrentRoom PLAYER VALUE(BOOLEAN) Returns TRUE if PLAYER has no current room, FALSE otherwise.
PlayerCanAccessObject PLAYER, OBJECT VALUE(BOOLEAN) Returns TRUE if PLAYER can access OBJECT in its current state, FALSE otherwise.
ElementHasAncestor ELEMENT1, ELEMENT2 VALUE(BOOLEAN) Returns TRUE if ELEMENT1 inherits from ELEMENT2 within its lineage somewhere, or FALSE otherwise.

Miscellaneous

Command Name Parameters Returns Description
NoOp None Nothing Does nothing.
Identity ELEMENT VALUE(STRING) Returns the internal identity of ELEMENT.
Header VALUE(STRING) VALUE(STRING) Returns the value of the module header called VALUE.
×

Modal Header