Functions List

From Dark Signs Online
Jump to navigationJump to search

The following functions are available in Dark Signs Online:

String Functions

ASC Get the ASCII value of the specified text character

CHR Get the character of the given ASCII value

GETKEY Retruns the key value of the next key pressed.

GETASCII Returns the ascii value of the next key pressed.

INSTR If string 2 is contained within string 1, return its starting character position, otherwise return 0. Parameters in this function should be surrounded in double quotes.

INPUT Get input from the user, ask the specified message.

LCASE Return the string in lower case characters.

LEFT Extract the specified number of characters (len) from the string, starting from the left side.

LEN Get the length of the string as an integer.

MID Extract the specified part of the string, starting at startpos.

RANDOM Get a random number between the specific lower and higher number.

REPLACE Replace the specified text with the specified text if it exists in the string. Parameters in this function should be surrounded in double quotes.

REVERSE What this function does will depend on the data you pass to it. If you send it 'true' it will return 'false', if you send it 'false' it will return 'true'. If you send it a text string, the text string will be reversed. '1' and '0' will also alternate.

TRIM Return the string without surrounding spaces.

UCASE Return the string in upper case characters.

RIGHT Extract the specified number of characters (len) from the string, starting from the right side.

URLENCODE Urlencodes the given string.

File Functions

FILE Return text data from a file, starting at the specified line.

Connection Functions

DOWNLOAD Download data from an *external* server on the *real* internet. The HTML or data will be returned into the variable. This is a remote function.

GETDOMAIN Get the domain name of the server. The server can be a domain name (in which case the data will not be modified) or an IP address. The function will return 0 if the server is not found. This is a remote function.

GETIP Get the IP address of the server. The server can be a domain name or an IP address (in which case the data will not be modified). The function will return 0 if the server is not found. This is a remote function.

PING Return 1 if the specified server exists, or 0 if it is not found. This is a remote function.

PINGPORT Return 1 if a script is running on the specified server and port, or 0 if no script is detected. This is a remote function.

TIME Get the server time in a unix style timestamp.

SERVERTOKEN Return a short-lived token to verify a user's identity outside of DSO (used with DOWNLOAD). This is a remote function.

Misc. Functions

RUN Return the output of the specified command, instead of printing it directly to the console. WARNING - The RUN function can be imperfect at times.

Usage

Generally functions are used like this:

$var = functionname(parameters)

However, you may use multiple functions on a single line.

$var = chr(65)chr(66)chr(67)chr(68)

The above code will put "ABCD" inside $var.

Functions marked as remote functions, and the INPUT function, can not be used multiple times on one line.