Function Reference

[Command Reference] [Function Reference] [Predefined Variables] [Expressions]

The following functions are defined within zMUD:

 

Color/Appearance:

ansi return the ANSI codes for the given colors

btncol change the color of a button

btnenable change then enable state of a button

btnimage change the image assigned to a button

color converts a descriptive color into an attribute value

colorname converts an HTML color name to an RGB color value

DDE:

ddeopen open a DDE connection to the specified server and topic

ddeclose close a DDE connection

dde fetch data from a dde server

ddemacro tell the specified dde server to execute the macro in s

ddepoke poke the data in value to a dde server

Lists:

ismember return the word number if s is a member of the given string list, otherwise it returns zero (false)

additem add the string s to the specified string list. Duplicate items are allowed

delitem delete item s from the given string list. If there are duplicate items, only the first is removed

delnitem removes the nth item from a string list and returns the new list

replaceitem replaces the nth item in a list

item returns the nth item of the given stringlist

numitems returns the number of items in a stringlist

dups return the list with duplicate items removed

sort returns the list with items sorted in alphabetical order

push adds an item to the start of the list

pop retrieves the first element of a list and removes it from the list

expandlist allows reformatting of a list

Database functions:

db returns the value of the key property of the given database record

iskey returns the key number if the key exists in the record, otherwise returns zero (false)

addkey add a key-value pair to a database record and return the modified record

delkey deletes a key property from the given database record and return the modified record

numkeys returns the number of keys in a database record

countlist count the number of times each item appears in a string list and return a database record with the items as key properties, and the count of each item as the value of the key

dbget retrieves a database record

find returns a list of records matching a query

query returns a list of records matching a query

viewrec returns the specified record from the view

numrec returns the number of records in a view

expanddb allows reformatting of a database variable

Database column functions:

sum return the sum of a column

average returns the average of a column times 100

stdev returns the standard deviation of a column times 100

dbmin returns the minimum of a column

dbmax returns the maximum of a column

count returns the number of non-empty cells in a column

dblist returns the column as a string list

String Manipulation:

len return the length of the string s

pos return the position of pattern p in string s. Return 0/false if not found

match return the position of string s in trigger pattern p.

regex return the position of string s in regular expression p.

subregex substitute a regular expression in string s with a new string

begins true if string s1 starts with string s2

ends true if string s1 ends with string s2

concat return all strings concatenated together (up to nine parameters)

copy return a portion of string s, starting at character position i, and returning n characters. Strings are 1-based.

delete return the string s with n characters starting at position I deleted.

remove Remove substring p from string s

insert return the string s with pattern p inserted at position I.

replace return s with all occurrences of p replaced with r

subchar replace a list of characters in a string with a new list

left return the leftmost n characters of the string s

leftback return the leftmost part of s, n characters from the end

right return the rightmost part of s following n characters

rightback return the rightmost n characters of the string s.

repeat return s repeated n times

trim trim spaces from beginning and end of s

trimleft trim leading spaces from s

trimright trim trailing spaces from s

numwords return the number of words in the string s delimited by the substring d. Default for d is a space.

word return the ith word of the string s delimited by substring d. Default for d is a space.

stripansi removes ANSI control codes from a string

stripq removes internal quotes from a string

nltocr converts newlines (CR/LF) to just CR characters

crtonl converts CR to newlines (CR/LF)

String Formatting:

upper return the string s in uppercase

lower return the string s in lowercase

proper convert s to proper case (lowercase except for first letter)

quote returns the string s with any special characters quoted with the current quote character

format use a format string to format the values of a,b,c, etc.

time return the current date/time.

Arrays:

array create an array

arrget get an element from an array

arrset set an array element to a value

arrhigh return the highest index of an array

User Input:

prompt prompt the user for a value for the variable v.

pick display a picklist and let the user choose one or more strings from the list.

yesno Displays question in string s and returns true or false depending upon which button is clicked.

window return true if the named window is open

File I/O:

filesize returns the number of lines or number of records in the ith file (opened with the #FILE command)

grep search the ith file and return lines that match the pattern in s

read read the specified record from the ith file.

write write string s to the ith file at record rec.

Math:

abs return the absolute value of I

max return the maximum value of the parameters

min return the minimum value of the parameters

mod return a modulus b

sqrt returns the square root of a number

random return a random integer

bitand returns the bitwise AND of the two numbers

bitor returns the bitwise OR of the two numbers

bitxor returns the bitwise XOR of the two numbers

bitnot returns the bitwise inverse of the number

Dice functions

dice returns a random dice roll

dicemin returns the minimum possible dice roll

dicemax returns the maximum possible dice roll

diceavg returns the average roll of a dice

dicedev returns the standard deviation of a dice

Conditionals:

if if expression is true, return the true-value otherwise return the false-value

case if I=1, return s1, if I=2, return s2, etc. Up to 8 strings can be given

Type checking and conversion:

float converts item to floating point number

int converts item to integer

isfloat returns true if item is a floating point value

round converts item to integer, but rounds instead of truncates

norm normalizes a floating point value

string converts item to a string

defined returns true of s is a defined alias, variable, macro, or path

isnumber true if s represents a valid number

null return true if s is the null string

number convert a string to a number

ascii returns the ascii value of the first character of the given string

char return the ASCII character associated with the number I. This function is also used to translate the system characters (;:@%!.) to their current values if they have been changed.

COM/OLE:

comcreate creates a new COM object and returns it

comactive returns an existing COM object already running on the system

comget returns a property value for a COM object

comset sets a properly value for a COM object

Miscellaneous:

alias expand the value of alias s

expand expand variables and functions with the string s

literal returns the parameters untouched by expansion or evaluation

numbuttons returns the number of defined buttons

trigger return the state of the given trigger class

class return the state of the given class

state returns the current state number of a trigger

clip return or set the text in the clipboard

exec executes arguments as commands and returns results separated by | character

eval evaluate parameter p as an expression and return the result

numparam returns the number of parameters passed to an alias

param return the nth parameter passed to an alias

getglobal return the value of global variable name (stored in the INI file)

setglobal set the value of the global variable name (stored in the INI file)

handle returns the Window handle number of the named window

mss evaluate an expression with external scripting agent

gsl return last value sent in GSL tag

mcp return the last values sent in an MCP command

alarm set or return the time left on an ALARM in milliseconds

Characters:

charcomment set/retrieve the comments for the current character

charnotes set/retrieve the notes for the current character

AutoMapper functions:

lastdir Returns the current direction on the mapper command stack

destroom Returns the key value of the destination room of the last speedwalk.

walkroom Returns key value of current room executing Walk script.

maplocked Return or set the lock state of the map

mapfilter Return or set the current filter for all map functions

mapquery Execute an SQL search and return a string list of matched room IDs

roommode Return or set the mode for map functions

inwalk Returns true if there are still speedwalk directions to be processed

walkactive Returns true if speedwalk is not paused or stopped

walkconfirm Returns true if step confirmed by #OK

parsemode Returns or set the fashion in which speedwalk paths are processed

look sets or returns the "look command" used by the mapper

numrooms Return the number of rooms in the current zone

roomname Return or set the name of the room to string s

roomdesc Return or set the description of the room to string s

mapvnum Converts an absolute room number to a virtual room number

roomvum Converts an absolute room number to a virtual room number

pathfrom Returns a path from one room to another

pathexpand Expands a speedwalk path to a string list

pathcompress Compress a string list into a speedwalk path

pathreverse Reverses a speedwalk path

reversedir Reverses a direction command

portal Return or set the destination of a portal

portalenabled Return of set the status of a portal

nextdir Returns the next direction to be sent in a speedwalk

roomnum Returns or set the virtual number of a room

roomzone Returns or set the zone number of a room

roomcontents Returns or set the contents of a room

roomid Return or set the short name (ID) of the room to string s

roomcom Return or set the command assigned to the room to string s

roomcol Return or set the color of a room

roomnote Return or set the Notes of the room to string s

roomexit Return or set the exit string of the room to string s.

roomobj Return or set the number of objects in the room to i

roommob Return or set the number of mobs in the room to i

roomcost Return or set the cost of entering a room to i

roomkey Return the key number of room i

roomkind Return or set the type of the room to i.

roomload Return or set the Reload flag of the room to i

roomflags Return or set the user-defined flags for a room

roomlink Return or set the link in direction dir to the room number i.

roomportal Return or set a non-standard exit (portal).

doorname Return the name of a door in a given direction

walk Return the speedwalk string needed to get to room i

walkmode Return or set the current speedwalk mode

numzones Return the number of zones in the map

zonename Return or set the name of the zone to string s

zonenum Return the number of a zone

zonevnum Return the relative number of a zone



Contents Command Reference Predefined Variables