3.2.5 MUF Reference
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
Note: Some listed functions are only available in MUCK server version
fb6.0 and following. Such cases are marked with the notation `(fb6.0+)'
in individual entries.
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
+ - * / % ( x1 x2 -- i )
These words perform arithmetic operations on integer and floating
point numbers.
|
+ is addition: |
x1 + x2 |
- is subtraction: |
x1 - x2 |
* is multiplication: |
x1 times x2, or x1 * x2 |
/ is division: |
x1 divided by x2, or x1 / x2 |
% is modulo: |
remainter of x1 / x2, or x1 % x2 |
The result of an integer division is truncated of fractions.
Modulo cannot be used on floating point values: see
MODF.
All math operations may also be performed where x1 is a
variable type. This is mainly useful in calculating an offset for a
variable array. [top]
< > = <= >= ( x1 x2 -- i )
Perform relational operations on integers or dbrefs x1
and x2. These return i as 1 if
the expression is true, and i as 0
otherwise. [top]
@ ( v -- x )
Retrieves variable v's value x. (Pronounced
`fetch'.) [top]
! ( x v -- )
Sets variable v's value to x. See also VARIABLE, VAR, LVAR,
LOCALVAR, and miscellaneous. (Pronounced
`store'.) [top]
ABORT ( s -- )
Aborts the MUF program with an error. For example, `"Bad
vibes." abort' would stop the MUF program and tell the user a
message like:
Programmer error. Please tell Revar the following message:
#1234 (line 23) ABORT: Bad vibes.
[top]
ACOS ( f -- f' )
Returns the inverse cosine of f . (fb6.0+) [top]
ADDPENNIES ( d i -- )
d must be a player or thing object. Adds i
pennies to object d. Without Wizard permissions,
addpennies may only give players pennies, limited to
between zero and MAX_PENNIES. [top]
ADDPROP ( d s1 s2 i -- )
Sets property associated with s1 in object
d. Note that if s2 is null "",
then i will be used. Otherwise, s2 is always
used. All four parameters must be on the stack; none may be omitted. If
the effective user of the program does not control the object in
question and the property begins with an underscore `_',
the property cannot be changed. The same goes for properties beginning
with a dot `.' which cannot be read without permission. If
you store values, you must ensure that it they are never zero.
Otherwise, when the user stores a non-zero number into the string field,
(users may only access string fields) the next time TinyMUCK is dumped
and loaded up again, the value field will be replaced with
atoi (string field). If it is necessary to store zero, it
is safer to just add 1 to everything. [top]
ADDRESS? ( ? -- i )
Returns true if the top stack item is a function address.
[top]
AND ( x y -- i )
Performs the boolean `and' operation on x and
y, returning i as 1 if both
i1 and i2 are TRUE, and returning
i as 0 otherwise. [top]
ARRAY? ( ? -- i )
Returns true if the top item on the stack is an array. (fb6.0+)
[top]
ARRAY_COUNT ( a -- i )
Returns a count of the items in an array. (fb6.0+) [top]
ARRAY_DELITEM ( a @ -- a' )
Removes a given item from an array. (fb6.0+) [top]
ARRAY_DELRANGE ( a @ @ -- a' )
Deletes a range of items from an array, between two indexes,
inclusive. Returns the resulting array. (fb6.0+) [top]
ARRAY_FIRST ( a -- @ i )
Returns first the index in array, and a boolean. Bool is false if no
items are in array. (fb6.0+) [top]
ARRAY_EXPLODE ( a -- {@ ?} )
Explodes array into stackrange of index/value pairs, such as
"idx0" "val0" "idx1" "val1" 2 . (fb6.0+) [top]
ARRAY_GETITEM ( a @ -- ? )
Gets a given item from an array. (fb6.0+) [top]
ARRAY_GETRANGE ( a @ @ -- a' )
Gets range between two indexes (inclusive) from an array, returning
it as an array. (fb6.0+) [top]
ARRAY_INSERTITEM ( ? a @ -- a')
Inserts a given value into an array. (fb6.0+) [top]
ARRAY_INSERTRANGE ( a1 @ a2 -- a' )
Inserts items from array a2 into a1,
starting at the given index. Returns the resulting array. (fb6.0+)
[top]
ARRAY_KEYS ( a -- {@} )
Returns the keys of an array in a stackrange. (fb6.0+) [top]
ARRAY_LAST ( a -- @ i )
Returns last index in array, and a boolean. Bool is false if no items
are in array. (fb6.0+) [top]
ARRAY_MAKE ( {?} -- a )
Makes a list array from a stackrange. (fb6.0+) [top]
ARRAY_MAKE_DICT ( {@ ?} -- a )
Makes a dictionary associative array from a stackrange of index/value
pairs. (fb6.0+) [top]
ARRAY_NDIFF ( {a} -- a )
Returns a list array, containing the difference of all the given arrays.
Multiple arrays are consecutively processed against the results of the
previous difference, from the top of the stack down. (fb6.0+) [top]
ARRAY_NINTERSECT ( {a} -- a )
Return a list array, containing the intersection of all the given
arrays. Multiple arrays are consecutively processed against the results
of the previous intersection, from the top of the stack down.
(fb6.0+) [top]
ARRAY_NEXT ( a @ -- @ i )
Returns the next index in array, following index a, and
a boolean. Bool is false if no items left. (fb6.0+) [top]
ARRAY_NOTIFY (a1 a2 -- )
Notifies all dbref items in array a2 with all string
items in array a1. (fb6.0+) [top]
ARRAY_NUNION ({a} -- a)
Returns a list array, containing the union of values of all the given
arrays. (fb6.0+) [top]
ARRAY_PREV ( a @ -- @ i )
Returns previous index in array, following index a, and
a boolean. Bool is false if no items left. (fb6.0+) [top]
ARRAY_SETITEM ( ? a @ -- a' )
Overwrites item a from array @ with value ?. (fb6.0+) [top]
ARRAY_SETRANGE (a1 @ a2 -- a')
Sets items in list a1 to values from list
a2, starting at the given index. Returns the resulting
array. (fb6.0+) [top]
ARRAY_VALS ( a -- {?} )
Returns the values of an array in a stackrange. (fb6.0+) [top]
ASINE ( f -- f' )
Returns the inverse cosine of f. Operates in the range
of -pi/2 to pi/2. (fb6.0+) [top]
ATAN ( f -- f' )
Returns the inverse tangent of f. Operates in the range
of -pi/2 to pi/2. (fb6.0+) [top]
ATAN2 ( fy fx -- f )
Equivalent to ATAN, but takes the signs
of the arguments into account, and avoids division-by-zero errors.
(fb6.0+) [top]
ATOI ( s -- i )
Turns string s into integer i. If
s is not a string, then 0 is pushed onto the
stack. [top]
AWAKE? ( d -- i )
Passed a player's dbref, returns the number of connections they have
to the game. This will be 0 if they are not
connected. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
BACKGROUND ( -- )
A way to turn on multitasking. Programs in the background let the
program user go on and be able to do other things while waiting for the
program to finish. You cannot use the READ command in a background
program. Once a program is put into background mode, you cannot set it
into foreground or preempt mode. A program will remain in the background
until it finishes execution. [top]
BEGIN ( -- )
Marks the beginning of begin-until or begin-repeat loops. [top]
BG_MODE ( -- i )
pr_mode
fg_mode
These are all standard built in defines. They are used with
MODE and SETMODE to show what mode the program
is running in, or to set what mode it will run in. For example,
MODE returns an integer on the stack, that you can compare
against pr_mode, fg_mode, or
bg_mode, to determine what mode the program is in.
pr_mode is defined as 0, fg_mode
is defined as 1, and bg_mode is defined as
2. [top]
BITOR ( x x -- i )
Does a mathematical bitwise or. [top]
BITAND ( i i -- i )
Does a mathematical bitwise and. [top]
BITSHIFT ( i i -- i )
Shifts the first integer by the second integer's number of bit
positions. This works like the C << operator. If the
second integer is negative, it is equivalent to
>>. [top]
BITXOR ( i i -- i )
Does a mathematical bitwise exclusive or. [top]
BREAK ( -- )
Breaks out of the innermost loop. Jumps execution to the instruction
after the UNTIL or REPEAT for the current loop. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
CALL ( d -- ?? )
Calls another program d. d must have been
compiled already. d will inherit the values of
ME, LOC, TRIGGER, and all other
variables. [top]
CALLER ( -- d )
Returns the dbref of the program that called this one, or the dbref
of the trigger, if this wasn't called by a program. [top]
CEIL ( f -- f )
Returns the next highest integer number as a float. (fb6.0+) [top]
CHECKARGS ( ??? s -- )
Takes a string argument that contains an expression that is used to
test the arguments on the stack below the given string. If they do not
match what the expression says should be there, then it aborts the
running program with an appropriate Program Error message.
The expression is formed from single character argument tests that refer
to different argument types. The tests are:
|
a - function address |
|
d - dbref |
(#-1, #-2, #-3 are okay) |
D - valid, non-garbage dbref |
(#-1, #-2 NOT allowed #-3 is okay) |
e - exit dbref |
(#-1, #-2 allowed) |
E - exit dbref |
(#-1, #-2 NOT allowed) |
f - program dbref |
(#-1, #-2 allowed) |
F - program dbref |
(#-1, #-2 NOT allowed) |
i - integer |
|
p - player dbref |
(#-1, #-2 allowed) |
P - player dbref |
(#-1, #-2 NOT allowed) |
r - room dbref |
(#-1, #-2 allowed) (#-3 is a room) |
R - room dbref |
(#-1, #-2 NOT allowed) (#-3 is a room) |
s - string |
|
S - non-null string |
|
t - thing dbref |
(#-1, #-2 allowed) |
T - thing dbref |
(#-1, #-2 NOT allowed) |
v - local or global variable |
|
? - any stack item type |
|
Tests can be repeated multiple times by following the test with a
number. For example, "i12" checkargs would test the stack
for 12 integers.
The last test in the string expression will be done on the top stack
item. Tests are done from the top of the stack down, in order, so the
last test that fails in a string expression will be the one that the
Program Error will be given for. ie: "sdSi" checkargs will
test that the top stack item is an integer, then it tests that the next
item down is a non-null string, then it tests the third item from the
top to see if it is a dbref, and lastly it tests to make sure that the
4th item from the top is a string.
Spaces are ignored, so s d i is the same as
sdi. However, multipliers are ignored if they follow a
space, so s 4d i is also the same as sdi. This
is because you are basically telling it to repeat the space 4 times, and
since spaces are ignored, it has no effect.
If you have a function that takes a stack item of any type, you can
use the ? test. ? will match a string,
integer, dbref, or any other type.
Since sometimes arguments are passed in ranges, such as the way that
the explode primitive returns multiple strings with an integer count on
top, there is a way to group arguments, to show that you expect to
recieve a range of that type. For example, "{s}" checkargs
would test the stack for a set of strings like "first" "second"
"third" "fourth" 4 where the top stack item tells how many
strings to expect within the range.
Sometimes a function takes a range of paired arguments, such as:
"one" 1 "two" 2 "three" 3 "four" 4 4 where the count on the
top of the range refers to the number of pairs. To test for the range
given above, you would use "{si}" checkargs to tell it that
you want to check for a range of paired strings and integers. You can
group as many argument tests together in a range as you would like. ie:
you could use {sida} as an expression to test for a range
of related strings, integers, dbrefs, and function addresses.
Since the argument multipliers refer to the previous test
OR range, you can test for two string ranges with the test
"{s}2" checkargs. ie: It would succeed on a stack of:
"one" "two" "three" 3 "four" "five" 2. "{s2}" checkargs,
however, would test for one range of paired strings. ie: It would
succeed with a stack of: "one" "1" "two" "2" "three" "3"
3.
If, for some reason, you need to pass a range of ranges to a function,
you can test for it by nesting the braces. ie: "{{s}}"
checkargs .
Now, as one last example, the primitive notify_exclude,
if we were to test the arguments passed to it manually, would use the
test "R{p}s" checkargs to test for a valid room dbref, a
range of player dbrefs or #-1s, and a string. [top]
CHECKPASSWORD ( d s -- )
Returns true if the password of player d. (wizbit
only) [top]
CLEAR ( -- )
Clears all error flags. See also CLEAR_ERROR , ERROR? , ERROR_STR , ERROR_NAME , ERROR_BIT , ERROR_NUM , IS_SET? , and SET_ERROR (fb6.0+) [top]
CLEAR_ERROR ( i -- )
Clears error flag i . See also CLEAR , ERROR? , ERROR_STR , ERROR_NAME , ERROR_BIT , ERROR_NUM , IS_SET? , and SET_ERROR (fb6.0+) [top]
CONBOOT ( i -- )
Takes a connection number and disconnects that connection from the
server. (wizbit only) [top]
CONCOUNT ( -- i )
Returns how many connections to the server there are. (Requires Mucker
Level 3) [top]
CONDBREF ( i -- d )
Returns the dbref of the player connected to this connection.
(Requires Mucker Level 3) [top]
CONDESCR ( i -- i )
Takes a connection number and returns the descriptor number
associated with it. (Requires Mucker Level 3) See DESCRIPTORS, DESCRCON . [top]
CONHOST ( i -- s )
Returns the hostname of the connection. (wizbit only) [top]
CONIDLE ( i -- i )
Returns how many seconds the connection has been idle. (Requires
Mucker Level 3) [top]
CONNOTIFY ( i s -- )
Sends a string to a specific connection to the server. (Requires
Mucker Level 3) [top]
CONTENTS ( d -- d' )
Pushes the dbref of the first thing contained by d. This
dbref can then be referenced by next to cycle through all
of the contents of d. d may be a room or a
player. [top]
CONTIME ( i -- i )
Returns how many seconds the given connection has been connected to
the server. (Requires Mucker Level 3) [top]
CONTINUE ( -- )
Jumps execution to the beginning of the current loop. [top]
COPYOBJ ( d -- d' )
Creates a new object (returning d' on top of the stack),
that is a copy of object d. Each program is allowed to
create only one new object per run. [top]
COS ( f -- f' )
Returns the cosine of f. Operates in the range of -pi/4
and pi/4. (fb6.0+) [top]
CTOI ( s -- i )
Converts the first character in a string to its ASCII
equivalent integer. (fb6.0+) [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
DATE ( -- i i i )
Returns the monthday, month, and year. For example, if it were
February 6, 1992, date would return 6 2 1992
as three integers on the stack. [top]
DBCMP ( d1 d2 -- i )
Performs comparison of database objects d1 and
d2. If they are the same object, then i is
1, otherwise i is 0. [top]
DBREF ( i -- d )
Converts integer i to object reference
d. [top]
DBREF? ( x -- i )
Returns true if x is a dbref. [top]
DBTOP ( -- d)
Returns the dbref of the first object beyond the top object of the
database. dbtop ok? would return a false value. [top]
DEPTH ( -- i )
Returns the number of items on the stack. [top]
DESC ( d -- s )
Takes object d and returns its description
(@desc ) string field. [top]
DESCRCON ( i -- i )
Takes a descriptor and returns the associated connection number, or
0 if no match was found. See DESCRIPTORS,
CONDESCR. [top]
DESCRFLUSH ( i -- )
Flushes output text on the given descriptor. If -1 is
passed as the descriptor, it flushes output on all connections.
[top]
DESCRIPTORS ( d -- ix...i1 i )
Takes a player dbref, or #-1, and returns the range of
descriptor numbers associated with that dbref (or all for
#-1 ) with their count on top. Descriptors are numbers that
always stay the same for a connection, while a connection number is the
relative position in the WHO list of a connection. See DESCRCON, CONDESCR. [top]
DICTIONARY? ( ? -- i )
Returns true if the top item on the stack is a dictionary array.
(fb6.0+) [top]
DIST3D ( fx fy fz -- f )
Returns the distance of XYZ coords (fx, fy,
fz) from the origin. (fb6.0+) [top]
DROP ( d -- s )
Takes object d and returns its drop (@drop )
string field. [top]
DUP ( x -- x x )
Duplicates the item at the top of the stack. [top]
DUPN ( ?n...?1 i -- ?n...?1 ?n...?1 )
Duplicates the top N stack items. See also
LDUP. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
ELSE
(See IF ) [top]
ENVPROPSTR ( s d -- s d )
Takes a starting object dbref and a property name and searches down
the environment tree from that object for a property with the given
name. If the property isn't found, it returns #-1 and a
null string. If the property is found, it will return the dbref of the
object it was found on, and the string value it contained. [top]
ERROR? ( -- i )
Returns true if any error flags have been set. See also CLEAR , CLEAR_ERROR , ERROR_STR , ERROR_NAME , ERROR_BIT , ERROR_NUM , IS_SET? , and SET_ERROR (fb6.0+) [top]
ERROR_BIT ( s -- i )
Given the error flag string name, returns the bit identifier. See
also CLEAR , CLEAR_ERROR , ERROR? , ERROR_STR , ERROR_NAME , ERROR_NUM , IS_SET? , and SET_ERROR (fb6.0+) [top]
ERROR_NAME ( i -- s )
Given the error flag bit identifier, returns the string name for the
error flag. See also CLEAR , CLEAR_ERROR , ERROR? , ERROR_STR , ERROR_BIT , ERROR_NUM , IS_SET? , and SET_ERROR (fb6.0+) [top]
ERROR_NUM ( -- i )
Returns the total number of error flag types.
DIV_ZERO |
(0) |
Division by zero attempted |
NAN |
(1) |
Result was not a number |
IMAGINARY |
(2) |
Result would be imaginary |
FBOUNDS |
(3) |
Floating-point inputs were out of range |
IBOUNDS |
(4) |
Calculation resulted in an integer overflow or
underflow |
See also CLEAR , CLEAR_ERROR , ERROR? , ERROR_STR , ERROR_NAME , ERROR_BIT , IS_SET? , and SET_ERROR (fb6.0+) [top]
ERROR_STR ( i -- s )
Given an error identifier, returns a user-readable error string.
See also
CLEAR ,
CLEAR_ERROR ,
ERROR? ,
ERROR_NAME ,
ERROR_BIT ,
ERROR_NUM ,
IS_SET? , and
SET_ERROR (fb6.0+)
[top]
EXECUTE ( a -- ?? )
Executes the function pointed to by the address a on the stack.
[top]
EXIT ( -- )
Exits from the word currently being executed, returning control to the
calling word, at the statement immediately after the invokation of the
call (exiting the program if applicable). [top]
EXIT? ( d -- i )
Returns 1 if object d is an exit object,
0 if otherwise. See also player?,
program?, room?, thing?,
ok?. [top]
EXITS ( d -- d' )
Returns the first exit in the linked exit list of room/player/object
d. This list can be transversed with
next. [top]
EXP ( f -- f' )
Returns e raised to the fth power. (fb6.0+)
[top]
EXPLODE ( s1 s2 -- ... i )
s2 is the delimiter string, and s1 is the
target string, which will be fragmented, with i pushed on
top of the stack as the number of strings s1 was broken
into. For instance:
"Hello world" " " explode
will result in
"world" "Hello" 2
on the stack. (Note that if you read these items off in order, they
will come out "Hello" first, then "world" .)
For TinyMUCK 2.2, s2 may be any length. But ""
(null string) is not an acceptable string for parameter
s2. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
FABS ( f -- f' )
Returns the absolute value of f. (fb6.0+) [top]
FAIL ( d -- s )
Takes object d and returns its fail (@fail )
string field. [top]
FG_MODE ( -- i )
pr_mode
bg_mode
These are all standard built in defines. They are used with
MODE and SETMODE to show what mode the program
is running in, or to set what mode it will run in. For example,
MODE returns an integer on the stack, that you can compare
against pr_mode, fg_mode, or
bg_mode, to determine what mode the program is in.
pr_mode is defined as 0, fg_mode
is defined as 1, and bg_mode is defined as
2. [top]
FLAG? ( d s -- i )
Reads the flag of object d, specified by s,
and returns its state: 1 = on ; 0 = off.
Different flags may be supported in different installations.
flag? returns 0 for unsupported or
unrecognized flags. You can check the "interactive" flag
to see if a player is currently in a program's READ, or if
they are in the MUF editor. [top]
FLOAT ( i -- f )
Converts i to a floating point. (fb6.0+) [top]
FLOAT? ( x -- i )
Returns true if x is a floating point. (fb6.0+) [top]
FLOOR ( f -- f )
Returns the next lowest integer number as a float. (fb6.0+)
[top]
FOREACH ( a -- @ ? )
A loop construct for arrays. (fb6.0+) [top]
FMTSTRING
FMTSTRING can be used to format complicated and long
strings, as well as multi-lined (with embedded new-lines) strings.
These strings can consist entirely of user-specified text, formatted
variable entries (as values taken from the stack) or a combination of
both.
The syntax for the format string is as follows:
Format -+---+-%[-,|][+,
][0][number][.number]type->+----->
^ | |
| +-text---------------------------------->|
| |
+------------------------------------------+
Here, text can be any string that does not contain a %
percent mark. This can be circumvented by replacing any occurance of a
% with %%. Number is any
standard integer number, and type should be one of the following single
character identifiers (case is important):
i - integer argument
s - string argument
? - unknown type argument, will print a string stating what the variable type is
d - dbref number, in the form of #123
D - dbref name reference; given a dbref, will print the associated name for that object - terminates on bad reference
l - pretty-lock, given a lock, will print the
description
f - float in xxx.yyy form
e - float in x.yyEzz form
g - shorter of forms e or f
A sample format string might look something like:
"There are %i apples in the box."
If there was an integer value of '5' on the stack, this would
return:
"There are 5 apples in the box."
Variables can be formatted in very specific manners. For numeric
entries, zero padding can be specified, as well as control over the sign
field. The total output field size for the variable can be specified,
as well as the minimum and maximum output lengths. Within a field,
output can be left, right or center justified. The [-,|]
denotes the justification style to use. With no argument, a field will
be right justified. A - will change this to left and a
| will make the field centered. If justification is to be
used, the first numeric entry must be specified. This denotes the total
size of the variable field. If the output of the variable is not
limited by the maximum output number (see below), and the total size of
the output is greater than the given field width, justification will
have no meaning. The second number field (after the period) specifies
the maximum number of characters to be printed for string variables, or
the precision for numerics. When dealing with numerics, the
+, ' ' and '0' characters also
can be used before the numeric fields. Specifing + will
make sure that a sign character is always printed before the number,
wether it be a plus or a minus. Default is to only print a minus sign
as needed. If a ' ' is used instead of the +,
a positive number will be prefaced with a space instead of a plus-sign.
When a 0 is given, zeros will be prefaced to the printed
number in order to fill the field width.
Tabbing and new-lines are allowed within the format strings as well.
Tabs are defaulted to the equivilent of eight spaces. Starting a new
line with \r will reset the tab count. Unless explicitly
reset with a new-line character, tab will continue to count in mod-eight
across the given output line. To insert a tab character, use
\t.
Variables should be on the stack `under' the format string, and should
be in order of reference. The first variable referenced by the format
string should be the next item in the stack, and so forth. (fb6.0+) [top]
FOR ( i1 i2 i3 -- i )
A loop structure, iterating from i1 to i2,
with a step of i3. The current count is pushed onto the
stack at each iteration. FOR is used just like
BEGIN, marking the beginning of a loop, with
REPEAT or UNTIL marking the end. However
unlike other loops, FOR loops are limited to a ridiculously
high nesting of 512, enforced at runtime. The FOR
primitive is actually ( i1 i2 i3 -- ) and the
FORITER primitive, used to control the iteration count is
( -- [i] i1) where i1 is a boolean signaling
weather or not to continue, and if continuing, i is the
currnet count. The primitive FORPOP ( -- ) cleans up the
FOR nesting stack by popping off the data for the nested
loop. [top]
FORCE ( d s -- )
Forces player d to do action s as if they were @forced. (wizbit only) [top]
FOREGROUND ( -- )
To turn on multitasking, you can issue a foreground command. While a
program is in foreground mode, the server will be multitasking and
handling multiple programs at once, and input from other users, but it
will be blocking any input from the user of the program until the
program finishes. You cannot foreground a program once it is running in
the background. A program will stay in foreground mode until it finishes
running or until you change the mode. [top]
FORK ( -- i )
This primitive forks off a BACKGROUND (muf) process from the
currently running program. It returns the pid of the child process to
the parent process, and returns a 0 to the child. If the
timequeue was full, then it returns a -1 to the parent
process, and there is no child process. (Requires Mucker Level 3)
[top]
FRAND ( -- f )
Returns a random number between 0 and 1.
(fb6.0+) [top]
FTOSTR ( f -- s )
Converts a floating point value to a string. (fb6.0+) [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
GETLINK ( d -- d' )
Returns what object d is linked to, or #-1
if d is unlinked. The interpretation of link depends on the
type of d: for an exit, returns the room, player, program,
action, or thing that the exit is linked to. For a player, program, or
thing, it returns its `home', and for rooms returns the drop-to.
[top]
GETLINKS ( d -- dn..d1 n )
Returns information on metalinks. Returns 0 when the
obj is an unlinked exit, or if the obj is a
program. Returns 0 if the obj is a room with
no dropto. Returns #-3 and a count of
1 if the dropto is linked to HOME.
(fb6.0+) [top]
GETLOCKSTR ( d -- s )
Returns the lock expression for the given object in the form of a
string. Returns *UNLOCKED* if the object doesn't have a
lock set. [top]
GETPROPSTR ( d s -- s' )
Retrieves string associated with property s on object
d. The value stored in s must be a string. If the property
is cleared, "" (null string) is returned. [top]
GETPROPFVAL ( d s -- f )
Retrieves the floating point associated with property s
on object d. The value stored in s must be a float. If the
property is cleared, <<<?>>> is
returned. [top]
GETPROPVAL ( d s -- i )
s must be a string. Retrieves the integer value
i associated with property s in object
d. If the property is cleared, 0 is
returned. [top]
GETSEED ( -- s )
Returns the the current SRAND seed string. See also SETSEED and SRAND (fb6.0+) [top]
GMTOFFSET ( -- i )
Returns the machine's offset from GMT in seconds. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
IF ... [ else ... ] then ( x -- )
Examines boolean value x. If x is
TRUE, the sequence of statements after the if
up until the then (or until the else if it is
present) performed. If it is fails, then these statements are
skipped, and if an else is present, the statements between
the else and the then are performed. Control
continues as usual at the statement after the then. Note
that checking the top of the stack actually pops it, so if you want to
re-use it, you should dup (see DUP ) it
before the if. For every IF in a word, there must
be a then, and vice-versa. ELSE is optional.
[top]
INF ( -- f )
Returns an infinite result. (fb6.0+) [top]
INSTR ( s s1 -- i )
Returns the first occurrence of string s1 in string
s, or 0 if s1 is not found. See
also RINSTR. [top]
INSTRING ( s s1 -- i )
Returns the first occurrence of string s1 in string
s, or 0 if s1 is not found.
Non-case sensitive. See also RINSTRING, INSTR, and RINSTR . This is an inserver define to
tolower swap tolower swap instr . [top]
INT ( x -- i )
Converts variable or object x to integer
i. [top]
INT? ( x -- i )
Returns true if x is an integer. [top]
INTERP ( d d2 s -- ?)
Takes a program dbref to run, the trigger to use, and the top stack item
string. It runs the MUF program with the given trigger
(with the given string on top of the stack) and returns the top stack
item that the MUF program exits with. [top]
INTOSTR ( x -- s )
x must be an integer or a dbref. Converts x
into string s. [top]
IS_SET? ( i -- i )
Returns true if a specific error flag is set.
See also CLEAR , CLEAR_ERROR , ERROR? , ERROR_STR , ERROR_NAME , ERROR_BIT , ERROR_NUM , and SET_ERROR
(fb6.0+) [top]
ISPID? ( i -- i)
Takes a process id and checks to see if an event with that pid is in
the timequeue. It returns 1 if it is, and 0 if
it is not. NOTE: since the program that is running is not on
the timequeue while it is executing, but only when it is
swapped out letting other programs run, pid ispid? will
always return 0. [top]
ITOC ( i -- s )
Converts an integer to its ASCII equivalent character. If it is not a
valid display character, a null string is returned. (fb6.0+) [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
JMP ( a -- )
The JMP primitive takes an address like those supplied by `funcname and
moves execution to that point. It is one early way that was used to do
tail-recursion loops without as much overhead, and without failing due
to system stack overflows. It is mostly obsolete now, except that it's
one of the three or four internal primitives used to implement
if-else-then and begin-while-repeat loops and such.
Example of JMP as a tail-recursion optimization:
: countforever ( i -- )
1 +
dup intostr .tell
`countforever jmp
;
A better ways to do the same thing with looping primitives would
be:
: countforever ( i -- )
begin
1 +
dup intostr .tell
repeat
;
[top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
KILL ( i -- i )
Attempts to kill the given process number. Returns 1 if
the process existed, and 0 if it didn't. Any process can
kill itself; killing other processes equires Mucker Level 3. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
LDUP ( {?} -- {?} {?} )
Duplicates a stackrange on top of the stack. See also DUPN. [top]
LOCALVAR ( i -- l )
Takes an integer and returns the respective local variable. Similar to
the VARIABLE primitive. [top]
LOCATION ( d -- d' )
Returns location of object d as object
d'. [top]
LOCK? ( ? -- i )
Returns true if the top stack item is a lock. See also GETPROP, SETPROP, PARSELOCK, UNPARSELOCK, PRETTYLOCK, and TESTLOCK. [top]
LOCKED? ( d d -- i )
Takes, in order, the dbref of the object to test the lock on, and the
dbref of the player to test the lock against. It tests the lock, running
programs as necessary, and returns a integer of 0 if it is
not locked against her, or 1 if it is. [top]
LOG ( f -- f' )
Returns the natural log of f. f must be
greater than zero. Very small values will return INF. [top]
LOG10 ( f -- f' )
Returns the log base 10 of f. f must be
greater than zero. Very small values will return INF. [top]
LREVERSE ( ?n...?1 i -- ?1...?n i )
Reverses top N items, leaving count. See also REVERSE. [top]
LVAR <varname>
This declares a variable as a local variable, that is local to a
specific program. If another program calls this program, the values of
the local variables will not be changed in the calling program, even if
the called program changes them. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
MATCH ( s -- d )
Takes string s, first checks all objects in the user's
inventory, then checks all objects in the current room, as well as all
exits that the player may use, and returns object d which
contains string s. If nothing is found, d =
#-1. If ambiguous, d = #-2. If HOME, d =
#-3. [top]
MIDSTR ( s1 i1 i2 - s2 )
Returns the sub-string specified by positions i1 to
i2 (inclusive) from within string s1.
[top]
MLEVEL ( d -- i )
Returns the Mucker (or Priority) Level of the given object. [top]
MODE ( -- i )
Returns an integer denoting the current multitasking mode. This
ignores BOUND bits on programs. The integer this returns
will be the same as one of those defined by the standard
$defines bg_mode, fg_mode, and
pr_mode, being background,
foreground, and preempt mode, respectively.
Also see PR_MODE. [top]
MODF ( f -- f f )
Returns the integral and fractional parts of f, both as
floating point numbers. Ex:
1.5 MODF
would put
1.0 0.5
on the stack. [top]
MOVEPENNIES ( d1 d2 i -- )
Moves i pennies from player/thing d1 to
player or thing d2. (fb6.0+) [top]
MOVETO ( d1 d2 -- )
Moves object d1 to object d2. MOVETO is affected by the following rules:
- If the object being moved is
!Jump_OK and is it
being moved by someone other than the object's owner, then the moveto
fails.
- If the object being moved is a person and either the source or
destination rooms (if not owned by the person being moved) are
!Jump_OK, the moveto fails.
- If the object being moved is not a player, is owned by the owner
of either the source or destination rooms, and either room where the
ownership matches is
!Jump_OK, the moveto fails.
The MOVETO succeeds under any other circumstances.
MOVETO rules follow the permissions of the current
effective userid. MOVETO will run programs in the
@desc and @succ/@fail of a room when moving a
player. If the object to be moved is an exit, the program must be
M3. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
NAME ( d -- s )
Takes object d and returns its name (@name )
string field. [top]
NEWEXIT ( d s -- d )
Takes a location and name and returns the new exit's dbref. Owner is the
person running the program. (wizbit only) [top]
NEWOBJECT ( d s -- d )
Takes a location and name and returns the new thing's dbref. Owner is
the person running the program. (wizbit only) [top]
NEWROOM ( d s -- d )
Takes the dbref of the parent and the name of the room. It returns the
dbref of the created room. Owner is the person running the program.
(wizbit only) [top]
NEXT ( d -- d' )
Takes object d and returns the next thing in the linked
contents/exits list of d's location. [top]
NEXTDESCR ( i -- i )
Takes a descriptor number, and returns the next connected descriptor
number. To get the first descriptor number, use 1
condescr. Between these, you can step through the descriptors
list. If you try to use nextdescr on an invalid descriptor, it will
return 0. If you have reached the end of the descriptor
list, it returns 0. (requires Mucker Level 3.) [top]
NEXTOWNED ( d -- d )
Returns the dbref of the first object owned by player d.
When called this object's dbref, NEXTOWNED returns the next
object owned by the same player. When there are no more objects left
owned by that player, then #-1 is returned. The order of
the objects is not guarenteed, but when used correctly, each object
owned by that player will be returned exactly once. The player object
itself will not be returned. This is used similarly to the
NEXT primitive. Ex:
me @ begin dup while dup unparseobj .tell nextowned repeat
(fb6.0+) [top]
NEXTPROP ( d s -- s )
This takes a dbref and a string that is the name of a property and
returns the next property name on that dbref, or returns a null string
if that was the last. To start the search, give it a propdir, or a
blank string. For example,
#10 "/" NEXTPROP
or
#28 "/letters/" NEXTPROP
A blank string is the same as "/". (Requires Mucker
Level 3) NEXTPROP will skip properties if they would not be
readable by the program with the given permissions and effective user
id. [top]
NOT ( x -- i )
Performs the boolean `not' operation on x, returning
i as 1 if x is
FALSE, and returning i as 0
otherwise. [top]
NOTIFY ( d s -- )
d must be a player object. s must be a
string. Tells player d message s. If s is
null it will print nothing. This primitive will trigger the
_listen 'er property on the object the message is sent to,
unless the program that would be run is the same as one one currently
running. [top]
NOTIFY_EXCEPT ( d1 d2 s -- )
d1 must be a room object, s must be a string. Tells
everyone at location d1 except object d2
message s. If object d2 is not a player or
NOTHING (#-1 ) all players are notified. If
s is null it prints nothing. Note:
notify_except is now only an inserver $define.
It is translated to 1 swap notify_exclude. See also NOTIFY_EXCLUDE [top]
NOTIFY_EXCLUDE ( d dn ... d1 n s -- )
Displays the message s to all the players (or
_listening objects), excluding the n given players,
in the given room. For example:
#0 #1 #23 #7 3 "Hi!" notify_exclude
would send "Hi!" to everyone in room #0
except for players (or objects) #1, #7, and
#23. _listener's will not be triggered by a
notify_exclude if the program they would run is the same as
the current program running. [top]
NUMBER? ( s -- i )
Returns 1 if string on top of the stack contains a
number. Otherwise returns 0. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
ODROP ( d -- s )
Takes object d and returns its odrop
(@odrop ) string field. [top]
OFAIL ( d -- s )
Takes object d and returns its ofail
(@ofail ) string field. [top]
OK? ( x -- i )
Takes x and returns 1 if x is
a type dbref, as well as 0 or above, below the top of the
database, and is not an object of type garbage. See also EXIT?, PLAYER?, PROGRAM?, and THING?. [top]
ONLINE ( -- d ... i )
Returns a dbref for every connection to the game, and lastly the
number of connections. [top]
OR ( x y -- i )
Performs the boolean `or' operation on x and
y. Returns i as 1 if either
x or y is TRUE, returns
i as 0 otherwise. [top]
OSUCC ( d -- s )
Takes object d and returns its osuccess
(@osucc ) string field. [top]
OVER ( x y -- x y x )
Duplicates the second-to-top thing on the stack. This is the same as
2 pick. [top]
OWNER ( d -- d' )
d is any database object. Returns d', the
player object that owns d. If d is a player,
d' will be the same as d. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
PARSELOCK ( s -- l )
Parses a lock string into a lock. If the parsing failed, then the
lock returned will be a true_boolexp, Which is logically false to an
`if' test. See also UNPARSELOCK, LOCK?, PRETTYLOCK, TESTLOCK, GETLOCKSTR, SETLOCKSTR, and LOCKED?. [top]
PARSEPROP ( d s s i -- s )
Returns the string output of the MPI parser, given an object, a property
name to parse, an input string for the {&cmd} variable, and
an integer that should either be 1, for when you want
{delay} messages to be sent to the player only, and
0, when you want the rest of the players in the room to get
the omessages. Note: for security reasons, you cannot use parseprop on
an object you don't control, if the property is not a _prop
or a ~prop. The exception to this is if the
MUF program is at least Mucker Level 3. Then parsing of
normal props is allowed. If the MUF program is wizbit, it
can also parse @props and .props. [top]
PART_PMATCH ( s -- d )
Takes a player name, or the first part of the name, and matches it
against the names of the players who are currently online. If the given
string is a prefix of the name of a player who is online, then their
dbref is returned. If two players could be matched by the given string,
it returns a #-2. If none of the players online match,
then it returns a #-1. [top]
PENNIES ( d -- i )
Gets the amount of pennies player object d has, or the
penny value of thing d. [top]
pi ( -- f )
Returns pi. [top]
PICK ( ni ... n1 i -- ni ... n1 ni )
Takes the i 'th thing from the top of the stack and
pushes it on the top. 1 pick is equivalent to
dup, and 2 pick is equivalent to
over. [top]
PLAYER? ( d -- i )
Returns 1 if object d is a player object,
otherwise returns 0. If the dbref is that of an invalid
object, it will return 0. see also PROGRAM?,
ROOM?,
THING?,
EXIT?,
OK?. [top]
POLAR_TO_XYZ ( fr ft fp -- fx fy fz )
This converts the spherical polar coordinate (fr, ft,
fp) to the XYZ coord (fx, fy, fz).
(fb6.0+) [top]
PMATCH ( s -- d )
Returns the dbref of the player with name s.
(fb6.0+) [top]
POP ( x -- )
Pops the top of the stack into oblivion. [top]
POPN ( ?n...?1 i -- )
Pops the top n stack items. [top]
POW ( f f' - f'' )
Returns f raised to the f 'th power. If
f is zero, f' must be greater than zero. If
f is less than zero, f' must be an integer
value. [top]
PR_MODE ( -- i )
fg_mode
bg_mode
These are all standard built in defines. They are used with mode and
setmode to show what mode the program is running in, or to set what mode
it will run in. For example, mode returns an integer on the stack, that
you can compare against PR_MODE, FG_MODE, or
BG_MODE, to determine what mode the program is in.
PR_MODE is defined as 0, FG_MODE
is defined as 1, and BG_MODE is defined as
2. [top]
PREEMPT ( -- )
Prevents a program from being swapped out to do multitasking. Needed
in some cases to protect crutial data from being changed while it is
being worked on. A program will remain in preempt mode until its
execution is completed. Basically what this command does is to turn off
multitasking, but then you have a limit on how many instructions you can
run without needing either to pause with a sleep, or have a wizbit on
the program. [top]
PRETTYLOCK ( l -- s )
Unparses a lock into a string fit for players to see. Also see LOCK?, PARSELOCK, UNPARSELOCK, TESTLOCK, GETLOCKSTR, SETLOCKSTR, and LOCKED?. [top]
PROG ( -- d )
Returns the dbref of the currently running program. [top]
PROGRAM? ( d -- i )
Returns 1 if object d is a program,
otherwise returns 0. If the dbref is that of an invalid
object, it will return 0. See also PLAYER?, ROOM?,
THING?, EXIT?,
OK?. [top]
PRONOUN_SUB ( d s -- s' )
Takes database object d and substitutes string s according to o-message rules. For example:
me @ "%n has lost %p marbles." pronoun_sub
would return:
"igor has lost his marbles."
If the player's name was Igor and his sex were male. d
does not have to be a player for the substitutions to work. The
substitutions are:
%a/%a for absolute possessive (his/hers/its, his/hers/its)
%s/%s for subjective pronouns (he/she/it, he/she/it)
%o/%o for objective pronouns (him/her/it,
him/her/it)
%p/%p for possessive pronouns (his/her/its,
his/her/its)
%r/%r for reflexive pronouns
(himself/herself/itself,
%n/%n for the player's name. (himself/herself/itself)
[top]
PROPDIR? ( d s -- i )
Takes a dbref and a property name, and returns whether that property
is a propdir that contains other props. (Requires mucker level 3)
[top]
PUBLIC <functionname>
Declares a previously defined function to be public for execution by other programs. This is a compile-time directive, not a run-time primitive. To call a public function, put the dbref of the program on the stack, then put a string, containing the function name, on the stack, then use CALL.
For example:
#888 "functionname" call
[top]
PUT ( nx...n1 ni i -- nx...ni...n1 )
Replaces the i 'th thing from the top of the stack with
the value of ni. 1 put is equivalent to
swap pop
Example:
"a" "b" "c" "d" "e" 3 put
would return on the stack:
"a", "e", "c", "d"
[top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
QUEUE ( i d s -- i )
Takes a time in seconds, a program's dbref, and a parameter string.
It will execute the given program with the given string as the only
string on the stack, after a delay of the given number of second.
Returns the pid of the queued process, or 0 if the
timequeue was full. (Requires Mucker Level 3) [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
RANDOM ( -- i )
Returns a random integer from 0 to the
MAXINT of the system running the MUCK. In general this
number is (2^31)-1 or 2,147,483,647 (2.1
billion). [top]
READ ( -- s )
Reads a string s from the user. This command should not
be used in a program that is locked (as opposed to linked) to an object,
as the lock will always fail and print the fail messages at read time.
It cannot be used in a program associated with a room object. [top]
RECYCLE ( d -- )
Recycles the given object d. Will not recycle players,
the global environment, the player starting room, or any currently
running program. (Can recycle objets owned by uid if running with
Mucker Level 3 permissions. Can recycle other people's items with
wizbit) [top]
REMOVE_PROP ( d s -- )
Removes property s from object d. If the
property begins with an underscore, `_' or a dot
`.', and the effective user does not have permission on
that object, the call fails.
(Note: There is a slight bug with REMOVE_PROP in
versions fb5.46 and earlier. If you use the primitive to
remove a prop, and then later in the same process try to remove a prop
whose name contains that of the earlier prop, the second property will
not be removed. For example:
loc @ "banned_lock" remove_prop
loc @ "banned_lock/program" remove_prop
If these two lines were executed in this order, no error would be
issued, but property banned_lock/program would not be
removed. If the order of the two lines is reversed, both properties will
be removed.) [top]
REPEAT ( -- )
Jumps execution to the instruction after the BEGIN in a
BEGIN-REPEAT loop. Marks the end of the current loop.
[top]
REVERSE ( ?n...?1 i -- ?1...?n i )
Reverses the order of the top i items on the stack,
returning the number of items reversed. See also LREVERSE. [top]
RINSTR ( s s1 -- i )
Returns the last occurrence of string s1 in string
s, or 0 if s1 is not found.
"abcbcba" "bc" rinstr returns 4. See also INSTR. [top]
RINSTRING ( s s1 -- i )
Returns the last occurrence of string s1 in string
s, or -1 if s1 is not found.
Non-case sensitive. See also INSTRING, INSTR, and RINSTR. This is an inserver define to
tolower swap tolower swap rinstr . [top]
RMATCH ( d s -- d' )
Takes string s, checks all objects and actions
associated with object d, and returns object
d' which matches that string. For example, matches actions
and inventory objects for a player object, actions on a thing object,
etc. If nothing is found, d'= #-1. If ambiguous, d' =
#-2. If HOME, d' = #-3. [top]
ROOM? ( d -- i )
Returns 1 if object d is a room, otherwise
returns 0. If the dbref is that of an invalid object, it
will return 0 . [top]
ROT ( x y z -- y z x )
Rotates the top three things on the stack. This is equivalent to
3 rotate . [top]
ROTATE ( ni ... n1 i -- n(i-1) ... n1 ni )
Rotates the top i things on the stack. [top]
ROUND ( f -- f' )
Returns f, rounded to the nearest whole number, as a
floating point. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
SET ( d s -- )
Sets flag s to object d. Currently settable
things are: Abode, Chown, Dark,
Haven, Jump, Link, and
Sticky. Boolean operations (e.g. `!abode') work as
expected. See also SETNAME, SETDESC, and FLAG? . [top]
SET_ERROR ( i -- )
Sets a specific error flag to ON. (fb6.0+) [top]
SETDESC SETSUCC SETFAIL SETDROP SETOSUCC SETOFAIL SETODROP (d s -- )
Takes object d, and sets the string field specified to
s. A program may only set string fields of objects that are
owned by the effective user of the program, or any object if the program
is Wizard. These are all actually $defines to
addprop with the apprpriate property name. They are
effectively defined as:
|
$define setdesc |
"_/de" |
swap 0 addprop $enddef |
$define setsucc |
"_/sc" |
swap 0 addprop $enddef |
$define setfail |
"_/fl" |
swap 0 addprop $enddef |
$define setdrop |
"_/dr" |
swap 0 addprop $enddef |
$define setosucc |
"_/osc" |
swap 0 addprop $enddef |
$define setofail |
"_/ofl" |
swap 0 addprop $enddef |
$define setodrop |
"_/odr" |
swap 0 addprop $enddef |
See also SET, SETNAME, ADDPROP, GETPROPSTR, REMOVE_PROP, DESC, SUCC,
FAIL, DROP, OSUCC,
OFAIL, and ODROP. [top]
SETLINK ( d1 d2 -- )
Takes an exit dbref d1, and sets its destination to
d2. You must have control of the exit, and if the exit is
already linked, it must be unlinked first by doing setlink with
#-1 as the destination. Wizbitted programs can
SETLINK regardless of whether the exit is already linked or
who controls it. [top]
SETLOCKSTR (d s -- i)
Tries to set the lock on the given object to the lock expression
given in the string. If it was a success, then it will return a
1, otherwise, if the lock expression was bad, it returns a
0. To unlock an object, set its lock to a null
string. [top]
SETMODE ( i -- )
Sets the current multitasking mode to the given mode. The integer
this uses will be the same as one of those defined by the standard
$defines bg_mode, fg_mode, and
pr_mode, being background,
foreground, and preempt mode, respectively.
Programs set BLOCK will run PREEMPT, ignoring
this mode. [top]
SETNAME ( d s -- )
Takes object d, and sets the name to s. A
program may only set the names of objects that are owned by the
effective user of the program, or any object if the program is
Wizard. The name of a player can never be set, since that
would normally require a password. See also SET, NAME,
and SETDESC. [top]
SETOWN ( d d -- )
Sets the ownership of the first object to the player given in the
second dbref. (wizbit only) [top]
SETSEED ( s -- )
Sets the seed for SRAND. Only the first thirty-two
characters are significant. If SRAND is called before
SETSEED is called, then SRAND is seeded with a
semi-random value. See also GETSEED
and SRAND . (fb6.0+) [top]
SINE ( f -- f' )
Returns the sine of f. Operates in the range of
-pi/4 and pi/4. [top]
SLEEP ( i -- )
Makes the program pause here for i seconds. The value of
i cannot be negative. If the sleep is for more than
0 seconds, then the program may not thereafter use the
READ primitive. [top]
SMATCH ( s s -- i )
Takes a string s, and a string pattern, s2,
to check against. Returns TRUE if the string fits the pattern.
This is case insensitive. In the pattern string, the following special
characters will do as follows:
- A
? matches any single character.
- A
* matches any number of any characters.
-
{word1|word2|etc} will match a single word, if it
is one of those given, separated by | characters,
between the {} 's. A word ends with a space or at the
end of the string. The given example would match either the words
"word1", "word2", or "etc".
{} word patterns will only match complete words:
"{foo}*" and "{foo}p" do not match
"foop" and "*{foo}" and
"p{foo}" do not match "pfoo".
{} word patterns can be easily meaningless; they will
match nothing if they:
(a) contain spaces,
(b) do not follow a wildcard, space or beginning
of string,
(c) are not followed by a wildcard, space or end
of string.
- If the first char of a
{} word set is a
`^', then it will match a single word if it is
NOT one of those contained within the {} s.
Example: `{^Foxen|Fiera}' will match any single word
except for Foxen or Fiera.
-
`[aeiou]' will match a single character as long as
it is one of those contained between the [] s. In this
case, it matches any vowel.
- If the first char of a
[] char set is a
`^', then it will match a single character if it is
not one of those contained within the [] s.
Example: `[^aeiou]' will match any single character
except for a vowel.
- If a
[] char set contains two characters separated
by a `-', then it will match any single character that
is between those two given characters. Example:
`[a-z0-9_]' would match any single character between
`a' and `z', inclusive, any character
between `0' and `9', inclusive, or a
`_'.
- The
`\' character will disable the special meaning
of the character that follows it, matching it literally.
Example patterns:
"d*g" matches "dg", "dog", "doog", "dorfg", etc.
"d?g" matches "dog", "dig" and "dug" but not "dg" or
"drug".
"M[rs]." matches "Mr." and "Ms."
"M[a-z]" matches "Ma", "Mb", etc.
"[^a-z]" matches anything but an alphabetical
character.
"{Moira|Chupchup}*" matches "Moira snores" and "Chupchup
arghs."
"{Moira|Chupchup}*" does NOT match "Moira' snores".
"{Foxen|Lynx|Fier[ao]} *t[iy]ckle*\?" Will match any string
starting with `Foxen', `Lynx', `Fiera', or `Fiero', that contains
either `tickle' or `tyckle' and ends with a `?'.
[top]
SRAND ( -- i )
Generates a seeded random number. See also GETSEED and SETSEED (fb6.0+). [top]
SQRT ( f -- f' )
Returns the square root of f. f must be greater than or equal to zero. [top]
STATS ( d -- total rooms exits things programs
players garbage )
Returns the number of objects owned by d, or the total
objects in the system if d == #-1. This is broken up into a
total, rooms, exits, things, programs, players, and garbage. This
functions much as the @STAT command. (Requires Mucker Level
3) [top]
STOD ( s -- d )
Takes a string and attempts to extract a dbref number from it.
Recognizes both plain numbers as well as numbers prepended with the
# sign. [top]
STRCAT ( s1 s2 -- s )
Concatenates two strings s1 and s2 and
pushes the result s = s1s2 onto the stack. [top]
STRCMP ( s1 s2 -- i )
Compares strings s1 and s2, and returns
i as 0 if they are equal. Otherwise,
STRCMP returns i as the difference between the
first non-matching character in the strings. For example,
"a" "z" strcmp returns 25. While
returning 0 (false ) for a match may seem
counter-intuitive, this arrangement allows the primitive to be used for
things such as string sorting functions. Unlike STRINGCMP, STRCMP is
case sensitive. See also STRNCMP. [top]
STRCUT ( s i -- s1 s2 )
Cuts string s after its i 'th character. For
example,
"Foobar" 3 strcut
returns
"Foo" "bar"
If i is zero or greater than the length of
s, returns a null string in the first or second position,
respectively. [top]
STRING? ( x -- i )
Returns true if x is a string. [top]
STRINGCMP ( s1 s2 -- i )
Compares strings s1 and s2. Returns
i as 0 if they are equal, otherwise returns
i as the difference between the first non-matching
character in the strings. For example, "a" "z" stringcmp
returns 25. This function is not case sensitive, unlike
STRCMP. See also STRNCMP. [top]
STRINGPFX ( s s2 -- i )
Returns 1 if s2 is a prefix of
s. Case insensitive. Returns 0 if
s2 is not a prefix of s. [top]
STRIP ( s -- s )
This is a built in $define. It is interpreted as
striplead striptail It strips the spaces from both ends of
a string. [top]
STRIPLEAD ( s -- s )
Strips leading spaces from the given string. [top]
STRIPTAIL ( s -- s )
Strips trailing spaces from the given string. [top]
STRLEN ( s -- i )
Returns the length of string s. [top]
STRNCMP ( s1 s2 i -- i' )
Compares the first i characters in strings
s1 and s2. Return value is like
STRCMP. See also STRINGCMP. [top]
STRTOF ( s -- f )
Converts string s to a floating point number.
s may be in the format xxx.yyy or
xxx.yyyEzz. See also FTOSTR. [top]
SUBST ( s1 s2 s3 -- s )
s1 is the string to operate on, s2 is the
string to change all occurences of s3 into, and
s is resultant string. For example:
"HEY_YOU_THIS_IS" " " "_" subst
results in
"HEY YOU THIS IS"
s2 and s3 may be of any length. [top]
SUCC ( d -- s )
Takes object d and returns its success
(@succ ) string field s. [top]
SWAP ( x y -- y x )
Takes objects x and y on the stack and
reverses their order. [top]
SYSPARM ( s -- s )
Takes a tuneable system parameter and returns its value as a string.
For an integer it returns it as a string, a time is returned as a string
containing the number of seconds, a dbref is returned in standard dbref
format, and boolean is returned as `yes' or
`no' Checking an invalid parameter or a parameter with
higher permissions then the program has will return an empty string.
Parameters available:
(str) dumpwarn_mesg |
- Message to warn of a coming DB dump |
(str) deltawarn_mesg |
- Message to warn of a coming delta dump |
(str) dumpdeltas_mesg |
- Message telling of a delta dump |
(str) dumping_mesg |
- Message telling of a DB dump |
(str) dumpdone_mesg |
- Message notifying a dump is done |
(str) penny |
- A single currency |
(str) pennies |
- Plural currency |
(str) cpenny |
- Capitolized currency |
(str) cpennies |
- Capitolized plural currency |
(str) muckname |
- The name of the MUCK |
(str) rwho_passwd |
- Password for RWHO servers (Wizbit only) |
(str) rwho_server |
- RWHO server to connect to (Wizbit only) |
(str) huh_mesg |
- Message for invalid commands |
(str) leave_mesg |
- Message given when QUIT is used |
(str) register_mesg |
- Message for a failed `create' at login |
(time) rwho_interval |
- Interval between RWHO updates |
(time) dump_interval |
- Interval between dumps |
(time) dump_warntime |
- Warning prior to a dump |
(time) monolithic_interval |
- Max time between full DB dumps |
(time) clean_interval |
- Interval between unused object purges |
(time) aging_time |
- When an object is considered old and unused |
(int) max_object_endowment |
- Max value of an object |
(int) object_cost |
- Cost to create an object |
(int) exit_cost |
- Cost to create an exit |
(int) link_cost |
- Cost to link an exit |
(int) room_cost |
- Cost to dig a room |
(int) lookup_cost |
- Cost to lookup a player name |
(int) max_pennies |
- Max number of pennies a player can own |
(int) penny_rate |
- Rate for finding pennies |
(int) start_pennies |
- Starting wealth for new players |
(int) kill_base_cost |
- Number of pennies for a 100 percent chance |
(int) kill_min_cost |
- Minimum cost for doing a kill |
(int) kill_bonus |
- Bonus for a successful kill |
(int) command_burst_size |
- Maximum number of commands per burst |
(int) commands_per_time |
- Commands per time slice after burst |
(int) command_time_msec |
- Time slice length in milliseconds |
(int) max_delta_objs |
- Max percent of changed objects for a delta |
(int) max_loaded_objs |
- Max percent of the DB in memory at once |
(int) max_process_limit |
- Total processes allowed |
(int) max_plyr_processes |
- Processes allowed for each player |
(int) max_instr_count |
- Max preempt mode instructions |
(int) instr_slice |
- Max uninterrupted instructions per time
slice |
(int) mpi_max_commands |
- Max number of uninterruptable MPI commands |
(int) pause_min |
- Pause between input and output servicing |
(int) free_frames_pool |
- Number of program frames pre-allocated |
(int) listen_mlev |
- Minimum Mucker level for _listen programs |
(ref) player_start |
- The home for players without a home |
(bool) use_hostnames |
- Do reverse domain name lookup |
(bool) log_commands |
- The server logs commands (Wizbit only) |
(bool) log_failed_commands |
- The server logs failed commands (Wizbit
only) |
(bool) log_programs |
- The server logs programs (Wizbit only) |
(bool) dbdump_warning |
- Warn about coming DB dumps |
(bool) deltadump_warning |
- Warn about coming delta dumps |
(bool) periodic_program_purge |
- Purge unused programs from memory |
(bool) support_rwho |
- Use RWHO server |
(bool) secure_who |
- WHO works only in command mode |
(bool) who_doing |
- Server support for @doing |
(bool) realms_control |
- Support for realm wizzes |
(bool) allow_listeners |
- Allow listeners |
(bool) allow_listeners_obj |
- Objects can be listeners |
(bool) allow_listeners_env |
- Listeners can be up the environment |
(bool) allow_zombies |
- Zombie objects allowed |
(bool) wiz_vehicles |
- Only wizzes can make vehicles |
(bool) force_mlev1_name_notify |
- M1 programs forced to show name on notify |
(bool) restrict_kill |
- Can only kill KILL_OK players |
(bool) registration |
- Only wizzes can create players |
(bool) teleport_to_player |
- Allow use of exits linked to players |
(bool) secure_teleport |
- Check teleport permissions for personal
exits |
(bool) exit_darking |
- Players can set exits dark |
(bool) thing_darking |
- Players can set objects dark |
(bool) dark_sleepers |
- Sleepers are effectively dark |
(bool) who_hides_dark |
- Dark players are hidden (Wizbit only) |
(bool) compatible_priorities |
- Backwards compatibility for exit priorities |
(bool) do_mpi_parsing |
- Parse MPI strings in messages |
(bool) look_propqueues |
- Look triggers _lookq propqueue |
(bool) lock_envcheck |
- Locks will check the environment |
(bool) diskbase_propvals |
- Allow diskbasing of property values |
SYSTIME ( -- i )
Returns the number of second from Jan 1, 1970. This is compatible
with the system timestamps and may be broken down into useful values
through `timesplit'. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
TAN ( f -- f' )
Returns the tangent of f. Operates in the range of
-pi/4 and pi/4. (fb6.0+) [top]
TESTLOCK ( d l -- i )
Tests the player dbref against the given lock. If the test was
successful, then this returns a 1. If the test failed,
then this returns a 0. See also LOCK?, PARSELOCK, UNPARSELOCK, PRETTYLOCK, GETLOCKSTR, SETLOCKSTR, and LOCKED? [top]
TEXTATTR ( s1 s2 -- s3 )
Takes plain text string s1 and adds color and
formmatting codes specified in string s2, returning the
enhanced string as s3. The attributes specified in
s2 should be a comma-separated list of attribute names. For
example:
"WARNING!" "bold,red" textattr me @ swap notify
(fb6.0+) [top]
THEN See IF
[top]
THING? ( d -- i )
Returns i as 1 if object d is
a thing, otherwise returns i as 0. See also PLAYER?, PROGRAM?, ROOM?, EXIT?, OK?. [top]
TIME ( -- s m h )
Returns the time of day as integers on the stack, seconds, then
minutes, then hours. [top]
TIMEFMT ( s i -- s )
Takes a format string and a SYSTIME integer and returns
a string formatted with the time. The format string is
ASCII text with formatting commands:
%% -- "%"
%a -- abbreviated weekday name.
%A -- full weekday name.
%b -- abbreviated month name.
%B -- full month name.
%C -- "%A %B %e, %Y"
%c -- "%x %X"
%D -- "%m/%d/%y"
%d -- month day, "01" - "31"
%e -- month day, " 1" - "31"
%h -- "%b"
%H -- hour, "00" - "23"
%I -- hour, "01" - "12"
%j -- year day, "001" - "366"
%k -- hour, " 0" - "23"
%l -- hour, " 1" - "12"
%M -- minute, "00" - "59"
%m -- month, "01" - "12"
%p -- "AM" or "PM"
%R -- "%H:%M"
%r -- "%I:%M:%S %p"
%S -- seconds, "00" - "59"
%T -- "%H:%M:%S"
%U -- week number of the year. "00" - "52"
%w -- week day number, "0" - "6"
%W -- week# of year, starting on a monday, "00" -
"52"
%X -- "%H:%M:%S"
%x -- "%m/%d/%y"
%y -- year, "00" - "99"
%Y -- year, "1900" - "2155"
%Z -- Time zone. "GMT", "EDT", "PST", etc.
TIMESPLIT ( i -- is im ih id im iy iw iyd )
Splits a systime value into 8 values in the following
order: seconds, minutes, hours, monthday, month, year, weekday, yearday.
Weekday starts with sunday as 1, and yearday is the day of
the year (1-366). [top]
TIMESTAMPS ( d -- i i2 i3 i4 )
Returns the following for a program, the time created
(i ), the time last modified (i2 ), the time
last used (i3 ), and the number of uses(i4 ) for
any object. [top]
TOLOWER ( s -- s )
Takes a string and returns it with all the letters in
lowercase. [top]
TOUPPER ( s -- s )
Takes a string and returns it with all the letters in
uppercase. [top]
TREAD ( i -- i | s i )
Acts like a timed READ call. If the user does not
provide input within the given number of seconds, the READ
call will time-out and return a failure to the program, otherwise it
returns a success and the string value entered. [top]
TRIG ( -- d )
Returns the dbref of the original trigger. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
UNPARSELOCK ( l -- s )
Unparses a lock into a string fit for program editing. Also see
LOCK?,
PARSELOCK,
PRETTYLOCK,
TESTLOCK,
GETLOCKSTR,
SETLOCKSTR, and
LOCKED?. [top]
UNPARSEOBJ ( d -- s )
Returns the name-and-flag string for an object. It always has the
dbref and flag string after the name, even if the player doesn't control
the object. For example: "One(#1PW)" [top]
UNTIL ( i -- )
If the value on top of the stack is false, then it jumps execution
back to the instruction afer the matching BEGIN statement.
(BEGIN-UNTIL, BEGIN-REPEAT, and
IF-ELSE-THEN 's can all be nested as much as you want.) If
the value is true, it exits the loop, and executes the next instruction,
following the UNTIL. Marks the end of the current loop.
[top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
VAR <name>
VAR is not a `true' primitive in that it must always be used outside words and does not alter the stack in any way. When the compiler sees a VAR statement, it allows the use of <name> as a variable in all words sequentially defined after the var declaration. See also
@,
VARIABLE, and
LOCALVAR.
[top]
VARIABLE ( i -- v )
Converts integer i to variable reference v.
Of the pre-defined variables, me corresponds to integer
0, loc to 1, and
trigger to 2. Thus:
me @
and
0 variable @
will do the same thing (return the user's dbref). User-defined
variables are numbered sequentially starting at 3 by the
compiler. Note that these variable numbers can be used even if variables
have not been formally declared, making implementation of such things as
arrays conveniently easy. See
@,
!, and
VAR
[top]
VERSION ( -- s )
Returns the version of this code in a string. "Muck2.2fb6.0",
currently. [top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
XYZ_TO_POLAR ( fx fy fz -- fr ft fp )
This converts the XYZ coordinate (fx, fy, fz)
to the spherical polar coord (fr, ft, fp). (fb6.0+)
[top]
[A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
]
WHILE ( i -- )
If the value on top of the stack is false, then this causes execution
to jump to the instruction after the UNTIL or
REPEAT for the current loop. If the value is true,
however, execution falls through to the instruction after the
WHILE. [top]
prev |
toc |
top |
next
|