Dark Signs Scripting Functions Guide Back to INDEX Overview of Dark Signs scripting functions, which can be used in your scripts. Variable Functions Variable Functions are like normal commands which were developed for the purpose of scripting. When you use them, they will not display anything on the screen, but instead, will create a variable with a result depending on the given parameters. EXAMPLE //check if a file exists var thefile input thefile enter a file exists thefile //now there will be a variable called exists which was automatically created with the function //the variable name will always be the same as the function name (in this case, exists) if exists=false *say 20 bad filename goto start endif //end example EXISTS Return Variable Name: exists The variable will contain either 'true' or 'false' Usage: exists [filename] If you specify invalid parameters when using a variable function, most likely it will return false, or null. To get a list of variable functions and help on each in the game, type help vf. FUNCTION LIST Below is a complete list of all variable functions available to date. GETKEY [text] //[text] - text to be displayed on the screen while waiting for user to //press a key (optional) [returns the ascii value of the key pressed] GETTIME [returns the current time] GETDATE [returns the current date] ENCRYPT$ password string //encrypt a string based on a password [returns encrypted string] Variable Functions Variable Functions are like normal commands which were developed for the purpose of scripting. When you use them, they will not display anything on the screen, but instead, will create a variable with a result depending on the given parameters. EXAMPLE //check if a file exists var thefile input thefile enter a file exists thefile //now there will be a variable called exists which was automatically created with the function //the variable name will always be the same as the function name (in this case, exists) if exists=false *say 20 bad filename goto start endif //end example EXISTS Return Variable Name: exists The variable will contain either 'true' or 'false' Usage: exists [filename] If you specify invalid parameters when using a variable function, most likely it will return false, or null. To get a list of variable functions and help on each in the game, type help vf. FUNCTION LIST Below is a complete list of all variable functions available to date. GETKEY [text] //[text] - text to be displayed on the screen while waiting for user to //press a key (optional) [returns the ascii value of the key pressed] GETTIME [returns the current time] GETDATE [returns the current date] ENCRYPT$ password string //encrypt a string based on a password [returns encrypted string] DECRYPT$ password encryptedstring //decrypt an already encrypted string [returns decrypted string if the password is correct, otherwise useless data] DIRCOUNT directory //can be used with GETFILE to list all files in a directory [returns the number of files in the specified directory] GETFILE directory filenumber //if filenumber doesnt exist, null will be returned //to get number of files, use DIRCOUNT [returns the filename of the specified filenumber in the specified directory] EXISTS filename //check if a file exists [returns true/false] EXTRACTEMAIL [text] //extracts an email address from [text] if it exists //useful for relpying to emails (see the email.script file for ane example) [returns email or null] FILEDATA filename //get all text in a file [returns all text in the file] GETCOLOR [returns the current text forecolor] GETBACKCOLOR [returns the current background color] GETHOSTNAMEFROMIP ip_address //find an hostname which an IP address belongs to [returns the hostname of the specified ip address] GETIPFROMHOSTNAME hostname //find an IP address which a hostname belongs to [returns the IP address of the specified hostname] GETMYACCOUNT [returns your bank account number] GETMYHOSTNAME [returns your current hostname] GETMYIP [returns your current IP address] GETMYMONEY [returns your current amount of money] MYPASSWORD [returns your current password] MYUSERNAME [returns your current username] PINGPORT server port //check if a port is open on a server [returns true/false] VAREXISTS variablename //Do not use %% characters with the variable name when //using this variable function [returns true/false depending on if the specified variable exists] QPING server //check if a server exists on the networks //similar to ping with no on screen display [returns true/false] =ADVANCED FUNCTIONS UCASE string [returns the same string in upper case (hello=HELLO) LCASE string [returns the same string in lower case (HellO=hello) ISDIR path [returns true or false depending on if the specified path is a directory] ISFILE path [returns true or false depending on if the specified path is a file] CHR [ascii value 1 - 255] [returns the char value of the specified number] ASC [character] //Specify a single string character or a variable. //If the string is longer than 1 character, the first will be taken. [returns the ascii value of the specified character] CHARSINLINE filename linenumber [returns the number of characters in the specified line] FILESIZE filename [returns the size of the specified file in bytes] INSTR stringvariable1 stringvariable2 //If the string [stringvariable2] is contained in the string [stringvariable1] the //return value will be the position in [stringvariable1] where [stringvariable2] //begins, otherwise return is 0. [returns the starting position of $variable2 in $variable1 RNDIP [return a random IP address] RNDINT maxint [returns a random integer number between 0 and the specified maxint] STRCHARFILENAME filename characterposition //will return empty string on error [returns a specified character from a file] STRLEN [variablename] [returns the byte length of the string variable specified] STRLINE filename linenumber //will return empty string on error [returns the specified line number from the file] STRMID variablename startposition length //will extract part of a string from the variablename //EG: strmid myvar 3 4 //will extract 4 characters from the myvar variable, starting //from the 3rd character. REMOTEIP //used in scripts to determine the IP of the system the script //is running on [returns the IP address of user currently running the script] REMOTENAME //used in scripts to determine the hostname of the system the //script if running [returns the hostname of user currently running the script] CONNECTEDIP //used in scripts for servers to idetify the IP address of the computer //that is currently connected to them. [returns the ip address that is connected to the running server script] CONNECTEDNAME //used in scripts for servers to idetify the hostname of the computer //that is currently connected to them. [returns the hostname that is connected to the running server script] SET EMAIL VARIABLES You can set the following variables before you send an email, and the data stored in them will be used. RCPT [email address] //set the reciever of the email SUBJECT [text] //set the subject of the email BODY [text] //set the body of the email MAILFILE [filepath] //set a file to be send with the outgoing email. specify the //path of the file, or to remove a file specify no parameters SENDMAIL //use this to send the email when you have completed all other fields If you need any help using variable functions, you can ask at the Dark Signs Forums https://darksigns.pf-control.de/forum Back to INDEX