Function

From TinyMUX
Revision as of 04:52, 17 January 2006 by Ian (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function

There's three varieties of functions:

  • Hardcoded functions
  • Functions called via u()
  • Globally-defined functions

Anyplace text is evaluated functions can be used:

> say time()
> think name(me)
> page me=lwho()

As you may have noticed all functions have a very predictable syntax which directl contrasts with the free form nature of commands:

function name(argument 1,argument 2,argment 3,etc...)

Hardcoded functions

These are the set of functions packaged with the server. Some of them (such as iter() and lit()) have special properties which are difficult to mimic.

Functions called via u()

u() is the functional equivalent of @trigger. As you would store action lists to be entered into the queue, you can store a string of code to be evaluated (not queued, so no commands). This might look like:

> &somecode blobject=The time is: [time()]
> say u(blobject/somecode)

These aren't really functions, but they're sometimes treated or referenced that way.

Globally-defined functions

These functions are softcoded instead of hardcoded, but they look and act (and often feel) like hardcoded functions. These can be created by using the @function command. Any function called via u() can typically be transformed to a globally-defined function with little work. Under MUX (and occasionally Penn) there's some security concerns. Read @function for more information.