function Thumbnail

function

  • noun The specification of how to interpret a command in MUDDLE. MUDDLE's functions are the equivalent of MUDDL's actions, but are only directly usable by players if they can be referenced via the vocabulary. Like MUDDL's, MUDDLE's commands are processed using a matching mechanism, but rather than being tabular in nature with arbitrary actions acting as guards, the class hierarchy is used. Incoming commands are compared against defined functions, taking the most specific match first (ie. lowest in the hierarchy), left-to-right along the parameters. Thus, 'hit(jack, axe0)' would match '{ hit player weapon }' before '{ hit object axe }'. MUDDLE is synchronous, which means its operators can be much lower level than in MUDDL without tripping over the signal/wait mechanism.

    For comparison with MUDDL, here is the relatively straightforward definition of the function that implements the 'fix brand in sundial' command:

    	{ drop gnomon sundial }:
    	holdinga(second, object) 'o' ->>
    		!? ("There's no room for " +
    			the%(first) + ", " + the%(second) +
    			" is holding " + a%(o) +
    			", birdbrain.*N"),
    	aflame(first) ->>
    		!? (theu%(first) +
    			" is aflame! Put it out, you jerk,*
    			* you'll burn yourself!*N"),
    		$(	checknkeeping(first)
    			drop%(first, second)
    			!! (theu%(first) +
    				" seems to be just the*
    				* right length for you to*
    				* be able to tell the time*
    				* from " +
    				the%(second) + ".*N")
    		$)
    

    This isn't too hard to follow if you know programming in general, but points to note are: 'first' means whatever is bound to 'gnomon'; 'second' means whatever is bound to 'sundial'; the 'o' construct is an assignment to a local variable (o, in this case); '!?' means "print this as an error message"; 'the%' and 'a%' are functions defined elsewhere to return the definite/indefinite object strings of their parameters; 'checknkeeping' is a function which will abort if its parameter is being kept by the persona issuing the command; 'drop%' is the general transfer function from persona to container.

    Note that unlike the MUDDL version of this example, in the MUDDLE one the brand can be retrieved from the sundial later. See action.


Copyright © Multi-User Entertainment Ltd. (muse@mud.co.uk)
23rd September 1999: function.htm