powwow with mudlle scripting
(started: 10th of June, 2001)


Since I was not too happy with the standard powwow scripting, I started looking for several scripting-addons. Mudlle as a functional coding language certainly was not my number one choice, but concerning my current interests such approach was promising to get a deeper insight into Mudlle.

I added another powwow command #mud. Without arguments it just invokes the Mudlle interpreter. With "filename" as argument it initially loaded the given mudlle script and executed it. But that would mean that everytime #mud is used, the given mudlle code would be reloaded, also it would always start executing at the beginning of the file.

So I recoded it, so that the #mud interprets its arguments as mudlle code. That way you can just specify a loaded function to be executed. e.g. #mud group_add() You have to make sure that the mudlle libraries, which you want to use have been loaded.
e.g. #mud load ("dlist.mud"); etc...

In any case all current powwow variables are imported into the mudlle environment. Eventually I will add some powwow_import(varname) function, but for now it has to work as it is. (@0..@9 are not imported, all other variables are. The $ as prefix is cut away. Variables starting with a number will be prefixed by "p".

Variables are NOT exported back to powwow. I hardcoded a mudlle function powwow_exec(), which will execute any powwow command. So you can do stuff like powwow_exec ("#var $axel=1")


powmudlle 20030130 linux tarball (30th Jan, 2003)


Example:

    powwow script:
#al init={#mud load ("dlist.mud");#mud load ("sequences.mud"); #mud load ("misc.mud");#mud ("mume.mud");} #ac >+agroup0 ^$1 raises $2 hand.={#print;#mud group_add()} #ac >+agroup1 ^$1 (&3) raises $2 hand.={#print;#mud group_add()} #ac >+room1 \033[32m&1\033[0m=#mud room() #ac >+exit1 ^Exits: &1.=#mud exits() #ac >+tell \033[32m$1 tells you &2\033[0m={#print;#mud tells_add()} #al tl=#mud tells_list() #ac >+pray \033[36m$1 prays &2\033[0m={#print;#mud prays_add()} #al pl=#mud prays_list() #ac >+nar \033[33m$1 narrates &2\033[0m={#print;#mud narrate_add()} #al nl=#mud narrate_list() mudlle file (e.g. mume.mud)
// // group variable handling // group_add = fn () [ if ( !table? (group) ) [ group = make_table(); display ( format ("\n# group-table created.\n") ); ]; group[p1] = 1; ]; // // list current group(-variable) // group_list = fn () [ display ("group: "); lmap ( fn(p) display ( format ("%s ",symbol_name(p))), table_list (group)); newline(); ]; // // tell save // tells_add = fn () tells = lappend (tells, list (p0)); tells_list = fn () lshow (tells, 10); // // pray save // prays_add = fn () prays = lappend (prays, list (p0)); prays_list = fn () lshow (prays, 10); // // narrate save // narrate_add = fn () narrates = lappend (narrates, list (p0)); narrate_list = fn () lshow (narrates, 10); // // output list // lshow = fn "l n -> . shows the last n elements of list l" (l, n) [ lmap( fn(x) [ display (x); newline(); ], lreverse (llast (l, n))); ]; // // fn (l,n) -> return the last n elements of a lit // llast = fn "l n -> l. returns the last n elements of a list" (l, n) [ | lrev, nrev, i | lrev = lreverse (l); while ( n > 0 && lrev != null ) [ nrev = lappend (nrev, list (car (lrev))); lrev = cdr (lrev); n = n - 1; ]; nrev; ]; // // room variable and coloring // room = fn () [ | str_out | str_out = "#print (attr \"bold green\"+\""; str_out = sappend (str_out ,p1); str_out = sappend (str_out , "\"+noattr)"); powwow_exec ( str_out ); ]; // // Exits // exits = fn () [ | sout | sout = "#print (attr \"bold white\"+\"Exits: "; sout = sappend (sout , string_upcase(p1) ); sout = sappend (sout, "\"+noattr)"); powwow_exec ( sout ); ]




webmaster: axel trocha, axel@trocha.com
last change: 30th of Jan 2003