TinyMUCK 2.2fb5.30 MUF Contents

To get manual information on a topic while online, type MAN topic, the following topics are avalible:

MUF PRIMITIVES

Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.


Variable Handling:
  var          lvar         variable     localvar     ! @
Multi-Tasking:
  preempt      background   foreground   ispid?       fork         sleep
  kill         pid          queue        pr_mode      bg_mode      fg_mode
  setmode      mode
Math 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         public
Stack Manipulation:
  dup          pop          swap         over         rot          rotate
  pick         put          depth
Message Management:
  name         desc         succ         fail         drop         osucc
  ofail        odrop        setname      setdesc      setsucc      setfail
  setdrop      setosucc     setofail     setodrop
Time:
  date         gmtoffset    systime      time         timesplit    timefmt
Data Conversion:
  atoi         intostr      dbref        int
Property Management:
  getpropval   getpropstr   addprop      remove_prop  getprop    
  envpropstr
  nextprop     propdir?     parseprop    setprop
I/O:
  read         notify       notify_except             notify_exclude
Connection Managment:
  awake?       online       descriptors  descrcon     concount     condbref
  nextdescr    conidle      contime      conhost      conboot      connotify
  condescr
String Handling:
  toupper      tolower      instring     rinstring    instr        rinstr
  striplead    striptail    strip        unparseobj   strlen       strcat
  strcut       subst        explode      pronoun_sub
Lock Handling:
  locked?      getlockstr   setlockstr   lock?        parselock    unparselock
  testlock     prettylock
Bitwise Operators:
  bitor        bitand       bitxor       bitnot       bitshift
Misc:
  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    moveto
In the ducumentation some primitives are grouped together as:
  MATH OPERATORS            LOGICAL OPERATORS         VARIABLE OPERATORS
Additional 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.


LOOPS

The BEGIN statement marks the beginning of a loop. Either the UNTIL or the REPEAT statement marks the end of the loop. REPEAT will do an unconditional jump to the statement after the BEGIN statement. UNTIL checks to see if the value on the stack is false. If it is, it jumps execution to the statement after the BEGIN statement, otherwise, it falls through on execution to the statement after the UNTIL.

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.


CREDITS

Credits:

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.


FLAGS

Flags that have importance to MUF: The Mucker Level of the program also has a great deal of influence on what a program can and cannot do. See also MUCKER LEVELS for more information.

Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.


MISCELLANEOUS

When a message is notify_except'ed or notify_exclud'ed to a room, and LISTENERS and LISTENERS_ENV are defined, then it will run ALL the programs referred to in all the _listen properties down the environment tree, And in all of the objects in the room with LISTENERS_OBJ defined. Also, the muf NOTIFY primitive was changed to run the _listen program on an object or player if a message is sent to them that way.

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.


DIRECTIVES

Compiler directives for MUF:

$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 then
then 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.


LIBRARIES

How to use a library:
  1. Use "@register lib" to list what libraries exist.
  2. Use "@view $lib/libraryname" to list the docs on that library.
  3. When you've found the library and the function you want, then all you have to do in your program is, at the beginning of it, $include $lib/libraryname
then just use the function name to invoke it later in your program and it will run as if it were a function in your program.

How to make a library:

  1. create a program with several useful generic subroutines.
  2. DOCUMENT those subroutines in a commented out header in the prog.
  3. @set program=_docs:command to list those DOCS you made
  4. make sure that all the functions are declared PUBLIC.
  5. Make sure the program is set LINK_OK.
  6. Globally register the program with the @register command with a prefix of "lib/". ie: @reg lib-strings=lib/strings
  7. Set up the interface for each function on the program. To do this, you will need to set properties on the program in the form _defs/callname:"$libname" match "funcname" call where callname is the name that you want to have people use to invoke it in their programs, libname is the registered name you gave it (ie: lib/strings), and funcname is the actual name of the function in the program. Example: @set lib-strings=_defs/.split:"$lib/strings" match "split" call
  8. You're done!
Currently standard libraries:

Return to the TinyMUCK Page, the MUF Manual Index, the Primitives Index, or the Alphabetic Index.


MUCKER LEVELS

There are now four levels of MUCKERs in fb4.0. Level zero is a non-mucker. They cannot use the editor, and MUF programs owned by them cannot be run.

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=2
A 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.


MULTITASKING

There are now 3 modes that a program can be in when running: foreground, background, and preempt. A program running in the foreground lets other users and programs have timeslices (ie multitasking), but blocks input from the program user. Background mode allows the user to also go on and do other things and issue other commands, but will not allow the program to do READs. Preempt mode means that the program runs to completion without multitasking, taking full control of the interpreter and not letting other users or progs have timeslices, but imposes an instruction count limit unless the program is a wizard program.

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.


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

Return to the TinyMUCK Page

Page created by Telzey, and maintained by Tugrik d'Itichi.
Comments/Questions/Flames to: FMPages@furry.com