GlowMUCK Logo

Home Documentation MUF Docs GlowMUF Downloads Bug Tracking Support Requests Feature Requests

Main MUF Notation MUF Editor Primitive Definitions GlowMUF Docs

MUF Primitive Definitions

Primitive(s) Level Description
' M1 ( --name a )
Returns the address of a function, e.g., 'funcname returns the address of funcname.
! M1 ( x v -- )
Sets variable v's value to x. See also variable, var, lvar, localvar, and miscellaneous.
@ M1 ( v -- x )
Retrieves variable v's value x.
+ - * / % M1 ( i1 i2 -- i )
These words perform arithmetic operations on numbers. `+' = addition (i1 + i2); `-' = subtraction (i1 - i2); `*' = multiplication (i1 times i2, or i1 * i2); `/' = division (i1 divided by i2, or i1 / i2) withinteger division truncation of fractions; `%' = modulo (remainder of i1 / i2, or i1 1345786722) Please note: all these operations may also be performed where i1 is a variable type. This is mainly useful in calculating an offset for a variable array.
< > = <= >= M1 ( i1 i2 -- b )
Performs relational operations on integers i1 and i2. These return b as 1 if the expression is true, and b as 0 otherwise.
abort M1 ( s -- )
Aborts the MUF program with an error, i.e., "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.
addpennies M2 ( 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 @tuned max_pennies.
addprop M1 ( 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.
address? M1 (? -- b)
Returns true if the top stack item is a function address.
and M1 ( x y -- b )
Performs the boolean `and' operation on x and y, returning b as 1 if both i1 and i2 are TRUE, and returning b as 0 otherwise.
ansi_notify M1 ( d s -- )
d must be a player object. s must be a string. Tells player d messages. 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. ANSI color codes in the form of ^COLORNAME^ will be turned into ANSI escape sequences and sent to the player. See also: ANSI Colors.
ansi_notify_except M1 ( 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 . It is translated to '1 swap ansi_notify_exclude'. See also: ansi_notify_exclude, ansi_notify, and ANSI Colors.
ansi_notify_exclude M1 (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!" ansi_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.
ansi_offset M1 ( s io im -- i )
Translates between 'cooked' (stripped) and 'raw' (with ansi sequences) ansi strings. If im is 1, cooked string s at position io is translated into the longer position of the raw string. If im is 0, raw string s at position io is translated to the shorter position of the cooked string.
ansi_strcut M1 ( s i -- s1 s2 )
Cuts string s with ansi sequences after its i'th character. For example, "Foo^RED^bar" 4 strcut returns "Foo^RED^b" "ar". If i is zero or greater than the length of s, returns a null string in the first or second position, respectively.
ansi_strip M1 ( s -- s )
Returns the 'cooked' (stripped) version of string s with ansi sequences.
ansi_strlen M1 ( s -- i )
Returns the 'cooked' (stripped) length of string s with ansi sequences.
atoi M1 ( s -- i )
Turns string s into integer i. If s is not a string, then 0 is pushed onto the stack.
awake? M1 ( d -- i )
Passed a players dbref, returns the number of connections they have to the game. This will be 0 if they are not connected.
background M1 ( -- )
Another way to turn on multitasking is to use the background command. 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.
begin M1 ( -- )
Marks the beginning of begin-until or begin-repeat loops.
bg_mode
fg_mode
pr_mode
M1 ( -- i)
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.
bitor M1 (i i -- i)
Does a mathematical bitwise or.
bitxor M1 (i i -- i)
Does a mathematical bitwise exclusive or.
bitand M1 (i i -- i)
Does a mathematical bitwise and.
bitshift M1 (i i -- i)
Shifts the first integer by the second integer's number of bit positions. Same as the C << operator. If the second integer is negative, its like >>.
break M1 ( -- )
Breaks out of the innermost loop. Jumps execution to the instruction after the UNTIL or REPEAT for the current loop.
call M1 ( d -- ?? )
Calls another program d. d must have been compiled already. d will inherit the values of ME, LOC, TRIGGER, and all other variables.
caller M1 ( -- 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.
checkargs M1 (??? 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. Tests can be repeated multiple times by following the test with a number. ie: "i12" checkargs would test the stack for 12 integers. 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.

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.
l - lock boolean expression.
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.

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, i.e., "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.
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 receive a range of that type, i.e., "{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, i.e., 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, i.e., 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, i.e., 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, i.e., "{{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.
checkpassword W3 ( d s -- i )
Checks if password string s is valid for player dbref d. 1 is returned on success, otherwise 0 is returned.
chlocked? M1 (d d -- b)
Takes, in order, the dbref of the player to test the lock against, and the dbref of object the lock is on. It tests the @chown lock, running programs as necessary, and returns a integer of 0 if it is not locked against them, or 1 if it is. If the object is not set CHOWN_OK the lock always fails.
conboot W4 (i -- )
Takes a connection number and disconnects that connection from the server. Basically @boot for a specific connection.
concount M1 ( -- i)
Returns how many connections to the server there are.
condbref M2 (i -- d)
Returns the dbref of the player connected to this connection.
condescr W ( i -- i )
Takes a connection number and returns the descriptor number associated with it. See also descriptors and descron.
conhost W (i -- s)
Returns the hostname of the connection.
conidle M2 (i -- i)
Returns how many seconds the connection has been idle.
conidler M2 (i -- i)
Returns 1 if the connection is considered idle.
conlocked? M1 (d d -- b)
Takes, in order, the dbref of the player to test the lock against, and the dbref of object the lock is on. It tests the lock, running programs as necessary, and returns a integer of 0 if it is not locked against them, or 1 if it is.
connotify M2 (i s -- )
Sends a string to a specific connection to the server.
conipnum W2 (i -- s)
Returns the TCP/IP host number of the connection.
conport W (i -- s)
Returns the TCP/IP port of the connection.
contents M1 ( 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. M1 programs will not see dark objects they don't control.
contime M2 (i -- i)
Returns how many seconds the given connection has been connected to the server.
continue M1 ( -- )
Jumps execution to the beginning of the current loop.
controls M1 ( d1 d2 -- b )
Takes a player dbref d1 and an object dbref d2, and returns true if the player has control over the given object.
conuser W2 (i -- s)
Returns the username of the connection.
convtime M1 (s -- i)
Converts a time string in the format of "HH:MM:SS Mo/Dy/Yr" to a system time value integer. Parsing rules are strictly enforced and will cause a programmer error if not observed. The time values must be valid.
copyobj M3 ( 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. Only wizard programs can create multiple objects.
date M1 ( -- i i i )
Returns the monthday, month, and year, i.e., if it were February 6, 1992, date would return 6 2 1992 as three integers on the stack.
dbcmp M1 ( d1 d2 -- b )
Performs comparison of database objects d1 and d2. If they are the same object, then b is 1, otherwise b is 0.
dbref M1 ( i -- d )
Converts integer i to object reference d.
dbref? M1 ( x -- b )
Returns true if x is a dbref.
dbtop M1 ( -- d)
Returns the dbref of the first object beyond the top object of the database. 'dbtop ok?' would return a false value.
depth M1 ( -- i )
Returns the number of items on the stack.
desc M1 ( d -- s )
Takes object d and returns its description (@desc) string field.
descrcon W (i -- i)
Takes a descriptor and returns the associated connection number, or 0 if no match was found. See also descriptors and condescr.
descr_setecho W3 ( i i -- i )
Turns telnet echo on or off for descriptor i. The first value is the descriptor, the second value is 0 for off or 1 for on. Unless unix_login is @tuned on, the special telnet echo sequence isn't sent. If the descriptor echo is turned on or off, 1 is returned, otherwise 0 is returned.
descr_setuser W3 ( i d s -- b )
Reconnects descriptor i to the player with dbref d and password s. It first disconnects from the old dbref, then connects the new one, as if QUIT was typed then the new character was logged in. If the password doesn't match the player's password, then it gives a permission denied error. This returns a 1 if successful or a 0 if the given descriptor wasn't found.
descriptors W (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# is the relative position in the WHO list of a connection. See also descron and condescr.
drop M1 ( d -- s )
Takes object d and returns its drop (@drop) string field.
dup M1 ( x -- x x )
Duplicates the item at the top of the stack.
envprop M1 ( 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 value it contained.
envpropstr M1 (d s -- d s )
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.
execute M1 ( a -- ?? )
Executes the function pointed to by the address a on the stack.
exit M1 ( -- )
Exits from the word currently being executed, returning control to the calling word, at the statement immediately after the location of the call (exiting the program if applicable).
exit? M1 ( d -- b )
Returns 1 if object d is an exit object, 0 if otherwise. See also player?, program?, room?, thing?, ok?.
exits M2
M3
( d -- d' )
Returns the first exit in the linked exit list of room/player/object d. This list can be transversed with `next'. Only M3 programs can get the exits of items they don't control.
explode M1 ( 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".) s2 may be any length except "" (null string) which is not an acceptable string for parameter s2.
fail M1 ( d -- s )
Takes object d and returns its fail (@fail) string field.
flag? M1 ( d s -- b )
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? aborts the program if the flag is unknown. 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. The "Truewizard" flag will check for a W flag with or without the QUELL set. The "Mucker" flag returns the most significant bit of the mucker level and the "Nucker" flag returns the least significant bit. See set for what flags can be used.
flocked? M1 (d d -- b)
Takes, in order, the dbref of the player to test the lock against, and the dbref of object the lock is on. It tests the lock, running programs as necessary, and returns a integer of 0 if it is not locked against them, or 1 if it is. If the object is not set XFORCIBLE the lock always fails.
foreground M1 ( -- )
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.
force W (d s -- )
Forces player d to do action s as if they were @forced.
fork M3 ( -- 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.
getlink M1 ( 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.
getlockstr M1 ( 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.
getprop M1 (d s -- ?)
Gets the value of a given property, and puts it on the stack. This can return a lock, a string, a dbref, or an integer, depending on the type of the property. Permissions are the same as those for getpropstr. This primitive returns 0 if no such property exists, or if it is a valueless propdir. See also setprop, addprop, remove_prop, getpropstr, getpropval, int?, dbref?, string?, and lock?.
getpropstr M1 ( d s -- s )
s must be a string. Retrieves string associated with property s in object d. If the property is cleared, "" (null string) is returned.
getpropval M1 ( 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.
glowver M1 ( -- s)
glowver returns the modded version of the server, "GlowMuck 3.x.x" currently.
gmtoffset M1 ( -- i)
Returns the machine's offset from Greenwich Mean Time in seconds.
if ...
[ else ... ]
then
M1 ( b -- )
Examines boolean value b. If b 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 FALSE, 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 it before the if. For every IF in a word, there MUST be a THEN, and vice-versa. ELSE is optional.
ignoring? M1 ( d1 d1 -- i )
Returns 1 if player d1 is ignoring player d2. If the ignored player is a wizard higher than quell_ignore_mlevel, a 2 is returned if the wizard is being ignored. If the dbrefs are that of an invalid object or if ignore/gag support is not enabled, it will return 0. See also player?, program?, room?, thing?, exit?, ok?.
instr M1 ( s s1 -- i )
Returns the first occurrence of string s1 in string s, or 0 if s1 is not found. See also rinstr.
instring M1 ( s s1 -- i )
Returns the first occurrence of string s1 in string s, or 0 if s1 is not found. Non-case sensitive. This is an inserver define to tolower swap tolower swap instr.
int M1 ( x -- i )
Converts variable or object x to integer i.
int? M1 ( x -- b )
Returns true if x is a int.
interp M1 ( d1 d2 s -- ? )
Takes a program dbref to run d1, the trigger to use d2, and the top stack item string and calls the program with the given string on the stack. Return value is the top item off the stack.
intostr M1 ( x -- s )
x must be an integer or a dbref. Converts x into string s.
ispid? M1 (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. ispid? will also return 1 if the given process id is that of the currently running program. This primitive requires at least mucker level 3.
jmp M1 (a -- )
The JMP primitive takes an address like those supplied by 'funcname and moves execution to that point. It's one early way that was used to do tail-recursion loops without as much overhead, and without failing due to system stack overflows. It's 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 ;
kill W (i -- i)
Attempts to kill the process referred to by the given process ID. Returns 1 if the process existed, and 0 if it didn't. Must be a wizard program to kill other processes.
localvar M1 (i -- v)
Takes an integer and returns the respective local variable. Similar to the 'variable' primitive.
location M1 ( d -- d' )
Returns location of object d as object d'.
lock? M1 (? -- b)
Returns true if the top stack item is a lock.
locked? M1 (d d -- b)
Takes, in order, the dbref of the player to test the lock against, and the dbref of object the lock is on. It tests the lock, running programs as necessary, and returns a integer of 0 if it is not locked against them, or 1 if it is.
lvar M1 ( -- v )
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.
match M1 ( 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. Wizard programs can also match player names with * and dbrefs with #.
mlevel M1 (d -- i)
Returns the mucker (or priority) level of the given object. See also mucker levels.
moveto M1
M3
W2
( d1 d2 -- )
Moves object d1 to object d2. Moveto is affected by the following rules: a) 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. b) 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. c) 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. Wizard programs have lesser restrictions than lower level programs.
mode M1 ( -- 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 bg_mode, fg_mode, and pr_mode, being background, foreground, and preempt mode, respectively.
name M1 ( d -- s )
Takes object d and returns its name (@name) string field.
nextdescr W (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.
nextprop M3 (d s -- s)
This takes a dbref and a string that is the full propdir pathname of a property and returns the full pathname of the next property in the given object's given propdir, or returns a null string if that was the last property in the propdir. To *start* the search, give it a propdir name ending in a '/', or a blank string. For example, #10 "/" NEXTPROP returns the name of the first property in the root propdir of object #10, and #28 "/letters/" NEXTPROP would return the name of the first property in the letters propdir on object #28. A blank string is the same as "/". If you try to do a Nextprop on a non-existant property, you will have a null string returned to you. Nextprop will skip properties if they would not be readable by the program with the given permissions and effective user id.
newroom M3 (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. Only one can be created per run for non-wizard programs.
newexit M3 (d s -- d)
Takes location and name and returns new exit's dbref. Owner is the person running the program.
newobject M3 (d s -- d)
Takes location and name and returns new thing's dbref. Owner is the person running the program. Only one can be created per run for non-wizard programs.
next M1 ( d -- d' )
Takes object d and returns the next thing in the linked contents/exits list of d's location. M1 programs cannot 'see' dark objects they don't control.
not M1 ( x -- b )
Performs the boolean `not' operation on x, returning b as 1 if x is FALSE, and returning b as 0 otherwise.
notify M1 ( d s -- )
d must be a player object. s must be a string. Tells player d messages. 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.
notify_descriptor W1 ( i s -- )
i must be a valid descriptor number. s must be a string. Tells descriptor i message s.
notify_except M1 ( 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 . It is translated to '1 swap notify_exclude'. See also: notify, notify_exclude.
notify_exclude M1 (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.
number? M1 ( s -- b )
Returns 1 if string on top of the stack contains a number. Otherwise returns 0.
odrop M1 ( d -- s )
Takes object d and returns its odrop (@odrop) string field.
ofail M1 ( d -- s )
Takes object d and returns its ofail (@ofail) string field.
ok? M1 ( x -- b )
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?, thing?.
online M2/M3 ( -- d ... i )
Returns a dbref for every connection to the game, and lastly the number of connections.
or M1 ( x y -- b )
Performs the boolean `or' operation on x and y. Returns b as 1 if either x or y is TRUE, returns b as 0 otherwise.
osucc M1 ( d -- s )
Takes object d and returns its osuccess (@osucc) string field.
over M1 ( x y -- x y x )
Duplicates the second-to-top thing on the stack. This is the same as 2 pick.
owner M1 ( 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.
parselock M1 (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.
parsempi M3 (d s s i -- s)
Returns the string output of the MPI Parser, given an object, a text string parse, an input string for the {&how} variable, and an integer that should either be 1, for when you want {delay} messages to be sent to the player only, or 0, when you want the rest of the players in the room to get the omessages.
parseprop M3 (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 {&how} variable, and an integer that should either be 1, for when you want {delay} messages to be sent to the player only, or 0, when you want the rest of the players in the room to get the omessages.
part_pmatch M2 (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.
pennies M1 ( d -- i )
Gets the amount of pennies player object d has, or the penny value of thing d.
perms M1 ( d1 d2 -- b )
Takes a player dbref d1 and an object dbref d2, and returns true if the player has muf permissions for the running program to modify the given object.
pick M1 ( 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.
pid M1 ( -- i)
Returns the process ID of the program that is currently running.
player? M1 ( d -- b )
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?.
pop M1 ( x -- )
Pops the top of the stack into oblivion. See also popn.
popn M1 ( xn ... x1 i -- )
Pops the top i items of the stack into oblivion. This is useful for popping a {s} string list off of the stack. See also pop.
preempt M1 ( -- )
Prevents a program from being swapped out to do multitasking. Needed in some cases to protect crucial data from being changed while it is being worked on. A program will remain in preempt mode until it's 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.
prettylock M1 (l -- s)
Unparses a lock into a string fit for players to see.
prog M1 ( -- d)
Returns the dbref of the currently running program.
program? M1 ( d -- b )
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?.
pronoun_sub M1 ( d s -- s' )
Takes database object d and substitutes string s according to o-message rules. 'd' does not have to be a player for the substitutions to work. See also: Pronoun Substitutions.
propdir? M2 (d s -- b)
Takes a dbref and a property name, and returns a boolean integer that tells if that property is a propdir that contains other props.
public M1 ( -- <name> )
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. See also Libraries.
put M1 ( 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. For example: "a" "b" "c" "d" "e" 3 put would return on the stack: "a", "e", "c", "d".
queue M3 (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.
random M1 ( -- i )
Returns a random integer from 0 to the MAXINT of the system running the MUCK. Usually, MAXINT is (2^31)-1 or 2,147,483,647 (2.1 billion).
read M1 ( -- 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. If a player has the "readblankline" flag set pefore performing the read, if the user presses return, it will return a " " as opposed to eating the line. This flag must be set before each read where this is desired.
recycle M1 (d -- )
Recycles the given object d. Will not recycle players, the global environment, the player starting room, or any currently running program. Can recycle objects owned by uid if running with Mucker Level 3 permissions. Can recycle other people's items with Wizbit.
remove_prop M1 ( 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.
repeat M1 ( -- )
Jumps execution to the instruction after the BEGIN in a BEGIN-REPEAT loop. Marks the end of the current loop.
rinstr M1 ( 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.
rinstring M1 ( s s1 -- i )
Returns the last occurrence of string s1 in string s, or -1 if s1 is not found. Non-case sensitive. This is an inserver define to tolower swap tolower swap rinstr.
rmatch M1 ( 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.
room? M1 ( 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. A dbref of #-3 (HOME) returns 1. See also player?, program?, thing?, exit?, and ok?.
rot M1 ( x y z -- y z x )
Rotates the top three things on the stack. This is equivalent to 3 rotate.
rotate M1 ( ni ... n1 i -- n(i-1) ... n1 ni )
Rotates the top i things on the stack. "a" "b" "c" "d" 4 rotate would leave "b" "c" "d" "a" on the stack. Using a negative rotational value rotates backwards. ie: "a" "b" "c" "d" -4 rotate would leave "d" "a" "b" "c" on the stack.
set W4/W ( d s -- )
Sets flag s to object d. Currently settable things are: abode/abate/autostart, builder, chown/color_ansi/count_insts, dark/debug, guest, haven/harduid, interactive, ic/in_character, idle, jump_ok, link_ok, logwall, kill_ok, meeper, offer_task/task_pending, quell, sticky/silent, tinkerproof, vehicle, xforcible, and zombie. Boolean operations (e.g. `!abode') work as expected. Some flags such as quell, xforcible, and mucker/wizbit levels cannot be set via muf but can be set via @force. See also setname, setdesc, and flag?.
setdesc
setsucc
setfail
setdrop
setosucc
setofail
setodrop
M1 (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 to addprop with the apporpriate property name. They are effectively defined as:
setdesc "_/de" swap 0 addprop
setsucc "_/sc" swap 0 addprop
setfail "_/fl" swap 0 addprop
setdrop "_/dr" swap 0 addprop
setosucc "_/osc" swap 0 addprop
setofail "_/ofl" swap 0 addprop
setodrop "_/odr" swap 0 addprop
See also set, setname, addprop, getpropstr, remove_prop, desc, succ, fail, drop, osucc, ofail, and odrop.
setlink M1 ( 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.
setlockstr M1 (d s -- b)
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.
setmode M1 (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 bg_mode, fg_mode, and pr_mode, being background, foreground, and preempt mode, respectively. Programs set BOUND will run PREEMPT, ignoring this mode. Also see PR_MODE.
setname M1 ( 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 Wizbit and compatible_muf is enabled. Players can be renamed by Wizbit programs using either the player's password or 'yes' after the player's name, separated by a space. See also set, name, and setdesc.
setown W2 (d d -- )
Sets the ownership of the first object to the player given in the second dbref. Only wizard programs can set things to other owners.
setprop M1 (d s ? -- )
Stores a lock, dbref, integer, or string into the named property on the given object. Permissions are the same as for ADDPROP.
sleep M1 (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.
smatch M1 ( s s2 -- 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 contain spaces; do not follow a wildcard, space or beginning of string; or 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 '?'.
sort M1 ( xi ... x1 i im -- xi ... x1 i )
Sorts a string list on the top of the stack using a given sort criteria specified by value im, possible sort modes are:
0 - string list, case sensitive, A-Z, where A is on the top of the stack
1 - string list, case sensitive, Z-A, where Z is on the top of the stack
2 - string list, case insensitive, A-Z, A on top
3 - string list, case insensitive, Z-A, Z on top
4 - dbref list, by object name, A-Z, A on top (as dbref)
5 - dbref list, by object name, Z-A, Z on top (as dbref)
See also rotate, popn.
stats M2 ( 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 the same as the @STAT command.
strcat M1 ( s1 s2 -- s )
Concatenates two strings s1 and s2 and pushes the result s = s1s2 onto the stack.
strcmp M1 ( 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" strcmp returns 25. The reason it returns a 0 for a match, and the difference on a non-match, is to allow for nice things like string sorting functions. This primitive is case sensitive, unlike stringcmp. See also strncmp.
strcut M1 ( 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. See also ansi_strcut.
strdecrypt M1 ( s1 s2 -- s )
Using key s2 decrypts string s1. See also strencrypt.
strencrypt M1 ( s1 s2 -- s )
Using key s2 encrypts string s1. See also strdecrypt.
string? M1 ( x -- b )
Returns true if x is a string.
stringcmp M1 ( 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.
stringpfx M1 (s s2 -- b)
Returns 1 if string s2 is a prefix of string s. If s2 is NOT a prefix of s, then it returns 0. Case insensitive.
strip M1 (s -- s)
This is a built in . It is interpreted as "striplead striptail". It strips the spaces from both ends of a string.
striplead M1 (s -- s)
Strips leading spaces from the given string.
striptail M1 (s -- s)
Strips trailing spaces from the given string.
strlen M1 ( s -- i )
Returns the length of string s.
strncmp M1 ( s1 s2 i -- i' )
Compares the first i characters in strings s1 and s2. Return value is like strcmp. See also stringcmp.
subst M1 ( 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.
succ M1 ( d -- s )
Takes object d and returns its success (@succ) string field s.
swap M1 ( x y -- y x )
Takes objects x and y on the stack and reverses their order.
sysparm Varies ( 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.
systime M1 ( -- i )
Returns the number of seconds from Jan 1, 1970. This is compatible with the system timestamps and may be broken down into useful values through 'timesplit'.
testlock M1 (d l -- b)
Tests the player against the given lock. If the test was successful, then this returns a 1. If the test failed, then this returns a 0.
thing? M1 ( d -- b )
Returns b as 1 if object d is a thing, otherwise returns b as 0. See also player?, program?, room?, exit?, ok?.
time M1 ( -- s m h )
Returns the time of day as integers on the stack, seconds, then minutes, then hours.
timefmt M1 (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:
%% -- "%" %I -- hour, "01" - "12"
%a -- abbreviated weekday name.%j -- year day, "001" - "366"
%A -- full weekday name.%k -- hour, " 0" - "23"
%b -- abbreviated month name.% -- hour, " 1" - "12"
%B -- full month name.%M -- minute, "00" - "59"
%C -- "%A %B %e, %Y"%m -- month, "01" - "12"
%c -- "%x %X"%p -- "AM" or "PM"
%D -- "%m/%d/%y"%R -- "%H:%M"
%d -- month day, "01" - "31"%r -- "%I:%M:%S 0x1"
%e -- month day, " 1" - "31" %S -- seconds, "00" - "59"
%h -- "%b"%T -- "%H:%M:%S"
%H -- hour, "00" - "23"
%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 -- "80581F0 -- "%H:%M:%S"
%x -- "%m/%d/%y"
%y -- year, "00" - "99"
%Y -- year, "1900" - "2155"
%Z -- Time zone. "GMT", "EDT", "PST", etc.
timesplit M1 ( 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).
timestamps M1/M2 ( 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.
tolower M1 (s -- s)
Takes a string and returns it with all the letters in lowercase.
toupper M1 (s -- s)
Takes a string and returns it with all the letters in uppercase.
trig M1 ( -- d)
Returns the dbref of the original trigger.
truename M1 ( d -- s )
Takes object d and returns its true name string field. This is the same as name if the MUCK doesn't use anoniminity.
unparselock M1 (l -- s)
Unparses a lock into a string fit for program editing.
unparseobj M1 ( 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)"
until M1 (i -- )
If the value on top of the stack is false, then it jumps execution back to the instruction after 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.
var M1 ( -- v
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.
variable M1 ( 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 (returning 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.
version M1 ( -- s)
version returns the version of this code in a string, "Muck2.2fb5.xx" currently.
while M1 (b -- )
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.

MUF Primitive Definitions / Revised 2004 September 23 14:39 (Thursday)
© 2004 Glowmuck Development Group

Valid XHTML 1.1! Valid CSS!