Commit ffd232d6 authored by Denis Walker's avatar Denis Walker

Readded files, with correct symlinks in place. Fixes #7

parent 7ca8b7cc
Math Instructions
NAME
ADD - Numerically add two values
SUB - Numerically subtract two values
MUL - Numerically multiply two values
DIV - Numerically divide two values
MOD - Numerically modulous two values
ABS - Returns the numerical absolute of a value
SYNOPSIS
ADD variable value
SUB variable value
MUL variable value
DIV variable value
MOD variable value
ABS variable value
DESCRIPTION
These functions act upon the contents of a named variable and
a given value, the result is then placed in the named variable.
Thus ADD is the equivalent of the C '+=' operator.
Both the contents of the variable, and the value must be
integers, otherwise no action is performed.
abs
\ No newline at end of file
Bitwise Instructions
NAME
AND - Bitwise AND the two values
OR - Bitwise OR the two values
XOR - Bitwise XOR the two values
SYNOPSIS
AND variable value
OR variable value
XOR variable value
DESCRIPTION
These functions act upon the contents of a named variable and
a given value, the result is then placed in the named variable.
Each bit of the variable's value is logically AND/OR/XORed with
that of the supplied value.
Both the contents of the variable, and the value must be
integers, otherwise no action is performed.
The NOT operator can be simulated by using an XOR with a value
that has every bit set.
Examples
operation AND OR XOR
variable 11001010 11001010 11001010 (202)
value 11110000 11110000 11110000 (240)
result 11000000 11111010 00111010
as integer 192 250 58
Miscellaneous Instructions
NAME
BEEP - Makes a beep on the local terminal
SYNOPSIS
BEEP
DESCRIPTION
Allows a user to make a beep sound (character 7) on the local
terminal.
NAME
BOARDEXEC - Execute board command
MUDEXEC - Execute mud command
SCREXEC - Execute script command
SYNOPSIS
BOARDEXEC command [args...]
MUDEXEC command [args...]
SCREXEC command [args...]
DESCRIPTION
BOARDEXEC executes the named board command as if it was
entered at the prompt.
MUDEXEC executes the named mud command as if it was entered
at the talker prompt while in mud mode.
SCREXEC executes the named script command as in a script.
Event Instructions
NAME
USER - Get the username that initiated the event
BODY - Get the 'body' of the event text, ie with timestamps stripped
SYNOPSIS
USER variable
BODY variable
DESCRIPTION
These instructions only make sense in a function that was called
from an event handler. USER places the username of the person that
initiated the event into variable, and BODY places the body of
the text message, with timestamps and any other prefixes removed,
into variable.
Comparison Commands
NAME
BOOLOPT - Checks if text is true/false
SYNOPSIS
BOOLOPT text
DESCRIPTION
This command checks the given text, and updates the comparison
counter as to whether it is a 'true/false' string. (see: condition)
Valid text is: on, off, true, false, 1, 0, y, n, yes, no
An invalid text will count as a 'false'.
Miscellaneous Instructions
NAME
CALL - Call a function and store its result in a variable
JUMP - Jump to location
RETURN - Returns from the current function
SYNOPSIS
CALL function variable [arguments...]
JUMP location [arguments...]
RETURN [value]
DESCRIPTION
CALL calls a subroutine which returns a value. The returned
value (if any) is stored in the specified variable. CALL cannot
be used to jump to a label within a function.
JUMP branches execution to the listed location.
If the supplied location is a local branch, then execution
branches there and continues as normal, i.e. a GOTO
Otherwise, if it is a function, then that function is executed,
when that function finishes execution will continue from the
same location.
There is a special argument that can be used with JUMP. Like the
arguments '$1', '$*' etc.. there is an argument '$^' which only
works when given to a JUMP instruction. It will append the arguments
$2, $3 ... $n from the calling function. For example the code:
function test
JUMP test2 hello $1 world $^ $2
endfunc
function test2
PRINT $*
endfunc
will give:
> ,test a b c
hello a world b c b
> ,test a
hello a world
RETURN causes execution of the current function to stop,
and returns execution to the location from which this function
was called. If this was the first function called, then script
execution ends. If a return value is given and the current
function was called using the CALL instruction, this value is
stored in the variable specified by the caller. Otherwise no
variables are affected.
NAME
CHECKONOFF - Handler for joining/leaving events
SYNOPSIS
CHECKONOFF function
DESCRIPTION
Use CHECKONOFF to bind a function to be called when a user
changes their login status - ie, logs onto the board, or off the talker
etc...
Scripts executed using this method recieve certain arguments:
$0 = "CheckOnOff"
$1 = <code>
$2 = <method>
$3 = <is_quiet>
$4 = <sourceuser>
$5 = <version>
$6 = <reason>
Where <code> can be one of:
0 - leave the talker
1 - enter the talker
2 - leave the board
3 - enter the board
For each of the <code> values, <method> has several meanings:
For leaving the board (2):
0 - normal (by user)
1 - timeout
2 - connection dropped
M 3 - get mrodded
S 4 - get banned
S 5 - crash / error
S 6 - deleted
For leaving the talker (0):
0 - normal (by user)
Z 1 - zodded
S 2 - chatmode -c
3 - straight to shell (!quit etc...)
For joining the board (3):
0 - normal (by user)
1 - straight to talker (-autochat)
For joining the talker (1):
0 - normal (by user)
U 1 - summoned
S 2 - chatmode +c
The extra letters in front of the <method> indicate certain privs are
needed:
M - needs mrod priv to detect
S - needs SU to detect
U - needs summon to detect
Z - needs zod to detect
So, for example, if a user were to log on using "-autochat", two messages
would be created:
<code=3> <method=1>
<code=1> <method=0>
These are the main two values that most people will use - along with
"USER <variable" to get the user that caused the checkonoff message.
Added to these two values, <is_quiet> simply returns:
0 - user logged on normally
1 - user logged on with messages supressed
This allows script writers to only display their own messages if a user
is logged on quietly if they so wish.
<sourceuser> is more tricky. This is the person that caused the initiation
of the checkonoff code in the first place. ie, for most messages, it is
the same as the user the broadcast came from. However, in cases such as
zod, mrod, or chatmode +/-c alteration, <sourceuser> will be the person
that performed that operation.
ie, SUPERUSER bans USER
<code=0> <method=3>
<code=2> <method=4> <user=USER> <sourceuser=SUPERUSER>
<version> is mainly for being able to work out which version
of checkonoff is used. this ranges from "1" to "3" currently, but if you
wish, you can simply check if any of the arguments is left blank "" and
work out what needs to be done from there.
and finally, <reason> is given only for ZoDs and MRoDs and contains the
optional reason that's said by Zebedee when the user is removed
from the talker.
NAME
CLEARVARS - Destroy variable(s) matching argument mask
SYNOPSIS
CLEARVARS argument mask
DESCRIPTION
Destroys variables matching argument mask. For example,
if you wanted to destroy all variables beginning with the letter
"r", you would use:
CLEARVARS r
If you want to destroy all variables, use:
CLEARVARS *
Milliways Scripting language
Instructions
SAY - puts text to the talker
EMOTE - emotes text to the talker
RAW - raws text to the talker
PRINT - prints text just to your console
INPUT - prompt for user input
EXEC - executes a talker command
SET - sets a variable
GETVAR - copies variables
UNSET - removes a variable
JUMP - calls a function, or gosubs a label
FJUMP - calls a function, with arguments $2..$n of current function
RETURN - return from function, or gosub
END - immediately terminates running script
WHOAMI - gets your current username
BEEP - makes a beep on your computer
RAND - gets a random value
QUIT - quits the mw board
SLEEP - pauses script execution
ROOM - changes rooms
SPLIT - splits off the first word from a string
BOARDEXEC - executes a board command
TALKPRIV - gets users output priviledges
WHOLIST - gets a string of user currently in talker
For help on seperate topics, type '.scrhelp instruction'
Comparison Commands
NAME
EQ - Equal To ( == )
NE - Not Equal To ( != )
LT - Less Than ( < )
GT - Greater Than ( > )
LE - Less Than or Equal To ( <= )
GE - Greater Than or Equal To ( >= )
SYNOPSIS
EQ value value
DESCRIPTION
This set of commands performs a comparison operation on the
two supplied values, and update the comparison counters
accordingly (see: condition)
If both values are numbers, then the comparison is done
numerically, otherwise both are treated as strings and
the comparison is done lexically. (case insensitive)
Milliways Scripting language
Conditions & Comparison Functions
EQ - tests equality between two values
NE - tests two values aren't equal
LT - tests value less than value
GT - tests value greater than value
LE - tests value less than or equal value
GE - tests value greater than or equal value
ISON - tests is person is on talker
REGEX - tests for a regex pattern in a string
IREGEX - tests for a case insensitive regex pattern in a string
INLIST - tests if arg1 is equal to another argument
IINLIST - tests if arg1 is case insensitively equal to another argument
RANGE - tests if arg1 is in the range [arg2..arg3]
BOOLOPT - tests if text is true/false
IFANY - if any comparisons were true, call function or label
IFFAIL - if any comparisons were false, call function or label
IFALL - if all " " true " " " "
IFNONE - if all " " false " " " "
IFCLEAR - clear the compare counters
For help on seperate topics, type '.scrhelp condition'
Miscellaneous Instructions
NAME
DATE - Get your current system date and time
SYNOPSIS
DATE variable
DESCRIPTION
Places the system date and time into the given variable in the format:
dd/mm/yyyy HH:MM:SS
Since all fields are always of the same length, STRMID may be used
to easily strip out the relevant data.
abs
\ No newline at end of file
say
\ No newline at end of file
Miscellaneous Instructions
NAME
END - Ends script execution
SYNOPSIS
END
DESCRIPTION
This causes execution of the current function to stop,
but unlike RETURN, program flow does not return to the calling
point, instead all functions are exitied immediately and
script executions stops.
comparison
\ No newline at end of file
Milliways Scripting language
Event functions
USER - gets the username of the last person to say something
OUTPUT - sets whether you see the activating text of an event
For help on seperate topics, type '.scrhelp function'
NAME
EXEC - Execute talker command
SYNOPSIS
EXEC command [args...]
DESCRIPTION
This command executes the named talker command as if it was
entered at the command prompt.
comparison
\ No newline at end of file
set
\ No newline at end of file
comparison
\ No newline at end of file
Miscellaneous Instructions
NAME
IDLETIME - Get your current idle time
SYNOPSIS
IDLETIME variable
DESCRIPTION
Places into the given variable the time your user has been idle
(ie, no input) for in seconds
Branch Instructions
NAME
IFANY - Jump if any comparisons matched
IFFAIL - Jump if any comparisons failed
IFALL - Jump if all comparisons matched
IFNONE - Jump if all comparisons failed
IFCLEAR - Zero the comparison counters
SYNOPSIS
IFANY location
IFFAIL location
IFALL location
IFNONE location
IFCLEAR
DESCRIPTION
These functions use the number of comparisons done, and the number
of comparisons that actually matched, to decided if the program
should branch to the listed location.
If the supplied location is a local branch, then execution
branches there and continues as normal, i.e. a GOTO
Otherwise, if it is a function, then that function is executed,
when that function finishes execution will continue from the
same location.
IFCLEAR zeros the comparison counters so that new comparisons
can be evaluated seperately.
ifall
\ No newline at end of file
ifall
\ No newline at end of file
ifall
\ No newline at end of file
ifall
\ No newline at end of file
inlist
\ No newline at end of file
NAME
INLIST - Check if arg1 is equal to another argument
IINLIST - Check if arg1 is equal to another arg (ignore case)
SYNOPSIS
INLIST item [items...]
IINLIST item [items...]
DESCRIPTION
These functions check if item matches any of the other arguments
supplied. If a match is found, the IF counter is incremented.
(see: condition)
INLIST is case sensitive, IINLIST is not.
Miscellaneous Instructions
NAME
INPUT - Get user input
SYNOPSIS
INPUT variable [prompt]
DESCRIPTION
This function prompts the user to input a line of text, using the
optional [prompt] value as a hint. The resulting string is placed
into variable.
regex
\ No newline at end of file
isanum
\ No newline at end of file
Comparison Commands
NAME
ISANUM - Check if given text is a valid number
ISADEC - Check if given text is a valid decimal number
SYNOPSIS
ISANUM variable
ISADEC variable
DESCRIPTION
Checks if the variable is a valid number, and updates the comparison
counters accordingly. (see: condition)
ISANUM checks for hexadecimal and decimal numbers, ISADEC
checks only for decimal signed integers.
sed
\ No newline at end of file
sed
\ No newline at end of file
Comparison Commands
NAME
ISON - Check if user is currently on talker
SYNOPSIS
ISON username
DESCRIPTION
This command checks if the named user is currently on the talker, and
updates the comparison counters accordingly (see: condition)
call
\ No newline at end of file
comparison
\ No newline at end of file
Miscellaneous Instructions
NAME
LISTVARS - Get the variable list (with optional argument)
SYNOPSIS
LISTVARS variable
DESCRIPTION
Puts a string containing a compressed list of the variables used by your
scripts into variable. The compression works by sorting the
variables into alphabetical order, then, for each variable name, it
removes any common characters with the previous variable from the start,
and replaces them with a character telling you how many characters are
repeated. The characters used are 0-9A-Za-z to indicate 0-61 repeated
characters.
For example the variable names:
test, test_all, trick, tyrant, zephyr_longstring1, zephyr_longstring2
translate to the string
"0test 4_all 1rick 1yrant 0zephyr_longstring1 H2"
To decompress the string, you can use the something like the following
code. The area within the **** comments is where you can do what you
want with the variable name:
function decompress_listvars
# set up all local variables
LOCAL varlist name prevname compchar
# get compressed form of variable list
LISTVARS varlist
# set up previous name
SET prevname ""
# start name stripping iteration loop
loop:
# get variable name off from list
SPLIT $varlist name varlist
# if nothing left to strip off, exit the loop
IFCLEAR
EQ $name ""
IFALL endloop
# strip off first character as the compression char
STRMID compchar 0:0 $name
STRMID name 1: $name
# convert the compression char into a number
STRCHR compchar $compchar "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
# get this many characters from the previous variable name
STRMID compchar 0:$[compchar-1] $prevname
# append the rest of the string name
SET name ${compchar}${name}
#************************************
PRINT "${name}"
#************************************
# set the new previous word
SET prevname $name
# continue the loop
JUMP loop
endloop:
# no more variable names left
endfunc
Miscellaneous Instructions
NAME
LOCAL - Sets a variable from global to local within function
SYNOPSIS
LOCAL variable [variable...]
DESCRIPTION
Takes a list of variable names, that may or may not have been
defined yet. When this variable is then used, will create it as a
local variable to the current function. The variable will be unset
when leaving the current function.
Miscellaneous Instructions
NAME
LOGONINFO - Finds out how the user accessed the talker
SYNOPSIS
LOGONINFO variable
DESCRIPTION
Returns a string to variable showing how you logged on. If you
logged on normally, the variable is empty.
Letters that can appear in the string:
Q - quiet
S - summoned
comparison
\ No newline at end of file
String Instructions
NAME
MAKESTR - Creates a string of characters
SYNOPSIS
MAKESTR variable number string
DESCRIPTION
Given a number (greater than 0), and a non-empty string, will return
a string which is 'n' lots of that string.
Eg. 'MAKESTR test 5 "a"' puts 'aaaaa' in $test.
Milliways Scripting language
Math Functions
ADD - add a value to a variable
SUB - subtract a value from a variable
MUL - multiply a value onto a variable
DIV - integer divide a variable by a value
MOD - modulus a variable by a value
ABS - return the numerical absolute of a value
AND - bitbise AND a variable by a value
OR - bitwise OR a variable by a value
XOR - bitwise XOR a variable by a value
For help on seperate topics, type '.scrhelp math function'
abs
\ No newline at end of file
boardexec
\ No newline at end of file