Functions List: Difference between revisions

From Dark Signs Online
Jump to navigationJump to search
(Created page with "The following functions are available in DarkSigns Online: == String Functions == <code> '''ASC''' Get the ASCII value of the specified text character '''CHR''' Get the character of the given ASCII value '''FIXQUOTES''' Return the string with double quotes like " all replaced with single quotes. '''GETKEY''' Retruns the key value of the next key pressed. '''GETASCII''' Returns the ascii value of the next ke...")
 
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
The following functions are available in DarkSigns Online:
The following functions are available in Dark Signs Online:


== String Functions ==
== String Functions ==
Line 7: Line 7:


'''[[CHR|CHR]]''' Get the character of the given ASCII value
'''[[CHR|CHR]]''' Get the character of the given ASCII value
'''[[FIXQUOTES|FIXQUOTES]]''' Return the string with double quotes like &quot; all replaced with single quotes.


'''[[GETKEY|GETKEY]]''' Retruns the key value of the next key pressed.
'''[[GETKEY|GETKEY]]''' Retruns the key value of the next key pressed.
Line 17: Line 15:


'''[[INPUT|INPUT]]''' Get input from the user, ask the specified message.
'''[[INPUT|INPUT]]''' Get input from the user, ask the specified message.
'''[[KILLQUOTES|KILLQUOTES]]''' Return the string with double quotes like &quot; removed from the string.


'''[[LCASE|LCASE]]''' Return the string in lower case characters.
'''[[LCASE|LCASE]]''' Return the string in lower case characters.
Line 39: Line 35:


'''[[RIGHT|RIGHT]]''' Extract the specified number of characters (len) from the string, starting from the right side.
'''[[RIGHT|RIGHT]]''' Extract the specified number of characters (len) from the string, starting from the right side.
'''[[URLENCODE|URLENCODE]]''' Urlencodes the given string.
</code>
</code>


Line 61: Line 59:


'''[[TIME|TIME]]''' Get the server time in a unix style timestamp.
'''[[TIME|TIME]]''' Get the server time in a unix style timestamp.
'''[[SERVERTOKEN|SERVERTOKEN]]''' Return a short-lived token to verify a user's identity outside of DSO (used with '''[[DOWNLOAD|DOWNLOAD]]''').  This is a [[Remote_function|remote function]].
</code>
</code>



Latest revision as of 17:53, 5 April 2024

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.