Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
var lvar variable localvar ! @Multi-Tasking:
preempt background foreground ispid? fork sleep kill pid queue pr_mode bg_mode fg_mode setmode modeMath and Comparison:
+ - * / % < > = <= >= and or not strcmp stringcmp strncmp smatch stringpfx dbcmp number?Stack Types and Object Types:
string? dbref? address? lock? int? player? thing? program? exit? room? ok?Control Structures:
if else then begin while break continue until repeat jmp exit execute call publicStack Manipulation:
dup pop swap over rot rotate pick put depthMessage Management:
name desc succ fail drop osucc ofail odrop setname setdesc setsucc setfail setdrop setosucc setofail setodropTime:
date gmtoffset systime time timesplit timefmtData Conversion:
atoi intostr dbref intProperty Management:
getpropval getpropstr addprop remove_prop getprop envpropstr nextprop propdir? parseprop setpropI/O:
read notify notify_except notify_excludeConnection Managment:
awake? online descriptors descrcon concount condbref nextdescr conidle contime conhost conboot connotify condescrString Handling:
toupper tolower instring rinstring instr rinstr striplead striptail strip unparseobj strlen strcat strcut subst explode pronoun_subLock Handling:
locked? getlockstr setlockstr lock? parselock unparselock testlock prettylockBitwise Operators:
bitor bitand bitxor bitnot bitshiftMisc:
pennies addpennies random location owner mlevel set flag? part_pmatch match rmatch copyobj contents setlink setown newobject newroom newexit recycle stats version dbtop prog trig caller force timestamps checkargs movetoIn the ducumentation some primitives are grouped together as:
MATH OPERATORS LOGICAL OPERATORS VARIABLE OPERATORSAdditional Primitives not in the FB5.31 index:
abort exits getlink next
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
Within a loop, even within IF-ELSE-THEN structures within the loop structure, you can place WHILE, CONTINUE, or BREAK statements. There is no limit as to how many, or in what combinations these instructions are used. A WHILE statement checks to see if the value on the stack is false. If it is, execution jumps to the first statement after the end of the loop. If the value was true, execution falls through to the statement after the WHILE. The CONTINUE statement forces execution to jump to the beginning of the loop, after the BEGIN. The BREAK statement forces execution to jump to the end of the loop, at the statement after the REPEAT or UNTIL, effectively exiting the loop.
Note: You can nest loops complexly, but WHILE, BREAK, and CONTINUE statements only refer to the innermost loop structure.
Example of a complex loop structure:
101 begin (BEGIN the outer loop) dup while 1 - (This WHILE, ...) dup not if break then (this BREAK, and..) dup 2 % not if continue then (this CONTINUE refer to the outer loop) dup 10 % not if 15 begin (BEGIN inner loop) dup while 1 - (This WHILE, and.. ) dup 5 % not if break then (... this BREAK, refer to inner loop) repeat (This REPEAT statement ends inner loop.) then dup 7 % not if continue then (This CONTINUE, and...) dup 3 % not if dup 9 % while then (this WHILE refer to the outer loop) dup intostr me @ swap notify dup 1 = until pop (This UNTIL ends the outer loop)
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
The people responsible (at fault?) for this manual are: Foxen (foxen@netcom.netcom.com), who wrote the original terrible docs, and WhiteFire (kinomon@glia.biostr.washington.edu), who cleaned them up a lot.
Thanks WF!
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
There is a COMMAND variable, similar to ME, LOC, and TRIGGER, except that it contains a string. The string contains the command the user typed that triggered the the program, without the command line arguments. ie: if there was an exit named "abracadabra;foo bar;frozzboz" that was linked to the program, and the user typed in "foo bar baz", then the program would run with "baz" on the stack, and "foo bar" in the global COMMAND variable.
Programs are now compiled when they are run or called instead of when the databate is loaded. They are compiled with the uid of the owner of the program.
A room or player may have a "_connect" property set that contains the dbref of a program to run when a player connects. The program must be either link_ok or must be owned by the player connecting. When the program is run, the string on the stack will be "Connect", the "loc @" will be the location of the connecting player, the "me @" will be the connecting player, and the "trigger @" (and "trig") will be the object that had the _connect property on it. All programs referred to by _connect properties on the player, and on rooms down the environment tree from the player, will be QUEUEd up to run. When a player desconnects, programs referred to by _disconnect properties will be run in a similar manner. (connect and disconnect _actions_ are also implemented.)
Programs refered to by props in _depart/_arrive/_connect/_disconnect propdirs will all be queued up, eliminating the need for a dispatcher program. An example would be _connect/announce:1234 That would queue up program #1234 when a player connects. The name ("announce") is not important, and can be anything you want, but they are queued up in alphabetic order.
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
$define defname definition $enddef
Basically the same as C's #define defname definition
$def defname definition
This is the same as $define, except that the definition stops at the end of the program line, without using an ending $enddef.
$undef defname
About the same as C's #undef defname
$echo string
Echos the given string to the screen of the person compiling the program. Runs at compile-time.
__version
A pre$defined macro that contains the current server version. Contains the same string that the VERSION primitive returns.
$ifdef condition compile this if true $else compile if false $endif or
$ifndef condition compile this if true $else compile if false $endif
where condition is either a $defined name, or a test that consists of a $defined name, a comparator (=, <, or >) and a test value, all in one word without space. The $else clause is optional. Compiler directives are nestable also.
Some examples:
$ifndef __version>Muck2.2fb3.5 $define envprop .envprop $enddef $endif $define ploc $ifdef proplocs .proploc $else $endif $enddef
$include dbref|progreg
Sets a bunch of $defines from the properties in the /_defs/ propdir.
For example, if object #345 had the following properties:
/_defs/desc: "_/de" getpropstr /_defs/setpropstr: dup if 0 addprop else pop remove_prop then /_defs/setpropval: dup if "" swap addprop else pop remove_prop then /_defs/setprop: dup int? if setpropval else setpropstr thenthen if a program contained '$include #345' in it, then all subsequent references to 'desc', 'setpropstr', 'setpropval', and 'setprop' would be expanded to the string values of their respective programs. ie: 'desc' would be replaced throughout the program with '"_/de" getpropstr'
You can now escape a token in MUF so that it will be interpreted literally. ie: \.pmatch will try to compile '.pmatch' without expanding it as a macro. This lets you make special things with $defines such as: $define addprop over over or if \addprop else pop pop remove_prop $enddef so that all the 'addprop's in the program will be expanded to the definition, but the 'addprop' in the definition will not try to expand recursively. It will call the actual addprop.
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
How to make a library:
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
Level one MUCKER's are apprentices. Their powers are restricted as they cannot get information about any object that is not in the same room they are. ie: OWNER, NAME, LOCATION, etc all fail if the object isn't in the same room as the player. Level one MUCKER programs always run as if they are set SETUID. NOTIFY, NOTIFY_EXCEPT, and NOTIFY_EXCLUDE will refuse to send messages to rooms the user is not in. Level one programs cannot use ADDPENNIES. Level one programs don't list DARK objects or rooms in the contents of a room, unless they are controlled by the program owner. Additionally, level one programs have an absolute instruction limit that is the same size as the PREEMPT instruction limit. This is usually around 20,000 instructions.
Level two MUCKERs are also called Journeymen. Their permissions are equivalent to the permissions for a normal MUCKER under older versions of the server. Level two programs can run as many as four times the number of instructions that a preempt program could. This is usually around 80,000 instructions.
Level three MUCKERs are referred to as Masters. They can use the con- nection info primitives (ie: CONDBREF, ONLINE, etc.), read the EXITS list of any room, use NEXTPROP on objects, can use NEWROOM, NEWOBJECT, NEWEXIT, and COPYOBJ without limitations, can use QUEUE and KILL, and can override the permissions restrictions of MOVETO. You only give a player MUCKER level 3 if they are very trusted. There is no absolute instruction count limit for level three or above, except for programs running in PREEMPT mode.
A player who is wizbitted is effectively Mucker Level 4. MUCKER level four is required for the RECYCLE primitive, the CONHOST primitive, the FORCE primitive, and the SETOWN primitive. ML4 also allows overriding of permissions of the SET* primitives, and property permissions. Props not listed by NEXTPROP with ML3 are listed with ML4. Programs running ML4 do not even have instruction limits on PREEMPT mode programs.
The MUCKER level permissions that a program runs at is the lesser of it's own MUCKER level and the MUCKER level of it's owner. If it is owned by a player who is MUCKER level 2, and it is MUCKER level 3, then it runs at Muckr level 2. The one exception to this is programs owned by a Wizard player. They run at Mucker level 2 if the program itself is not wizbit, and at Mucker level 4 if the program IS set wizbit.
Mucker level is referred to in flags lists by M# where the # is the Mucker level. Level zero objects don't show a flag for it. Example: Revar(#37PM3) In verbose flags lists, Mucker levels greater than zero are shown by MUCKER# where # is the mucker level.
To set a level on a player or program, use the level number as the flag name. MUCKER is the same as 2, and !MUCKER is the same as 0.
Example: @set Revar=2A player may set the MUCKER level on a program they own to any level lower than or equal to their own level, and a wizard may set a program or player to any MUCKER level. When a program is created, it is automatically set to the same MUCKER level as the creating player. When a program is loaded from an old db, if it is Mucker Level 0, it is upgraded to Mucker Level 2.
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
Programs run by @locks, @descs, @succs, @fails, and @drops default to the preempt mode when they run. Programs run by actions linked to them default to running in foreground mode. QUEUEd program events, such as those set up by _listen, _connect, _disconnect, etc, and those QUEUEd by other programs default to running in background mode. (NOTE: these programs cannot be changed out of background mode)
See also FOREGROUND, BACKGROUND, PREEMPT, FORK, QUEUE, KILL, and SLEEP.
Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.
< > = <= >= + - * / % ! @ abort addpennies addprop address? and atoi awake? background begin bg_mode bitand bitnot bitor bitshift bitxor break bunny call caller checkargs conboot concount condbref condescr conhost conidle connotify contents contime continue copyobj CREDITS date dbcmp dbref dbref? dbtop depth desc descrcon descriptors DIRECTIVES drop dup else envpropstr execute exit exit? exits explode fail fg_mode flag? FLAGS force foreground fork getlink getlockstr getprop getpropstr getpropval gmtoffset if instr instring int int? intostr ispid? jmp kill MUCKER LEVEL LIBRARIES localvar location lock? locked? logic opers LOOPS lvar Index match math opers MISC mlevel mode moveto MULTITASKING name newexit newobject newroom next nextdescr nextprop not notify notify_except notify_exclude number? odrop ofail ok? online or osucc over owner parselock parseprop part_pmatch pennies pick pid player? pop preempt prettylock PRIMITIVES prog program? pronoun_sub propdir? pr_mode public put queue random read recycle remove_prop repeat rinstr rinstring rmatch room? rot rotate set setdesc setdrop setfail setlink setlockstr setmode setname setodrop setofail setosucc setown setprop setsucc sleep smatch stats strcat strcmp strcut string? stringcmp stringpfx strip striplead striptail strlen strncmp subst succ swap systime testlock then thing? time timefmt timesplit timestamps tolower toupper trig unparselock unparseobj until var var opers variable version while