formatName `(obj) if typeof(obj, "adjectives") ~= T_NONE then obj.adjectives + " " + obj.name else obj.name fi` showObjects `(desc, list) firstOne := true; while list ~= nil do if typeof(list, "invisible") = T_NONE then if firstOne then firstOne := false; cprint(me(), desc); fi; cprint(me(), " " + P.formatName(list) + "\n"); fi; list := list.next; od; firstOne` playerIsHere `(who) realWho := global().GlobalMe; if who ~= realWho then if location(who) = location(realWho) then cprint(realWho, name(who) + " is here.\n"); fi; fi` showPlayersAndStuff `() global().GlobalMe := me(); junk1 := forEachPlayer(P.playerIsHere); junk2 := P.showObjects("Nearby:\n", location(me()).contents); global().GlobalMe := nil` showHere `() who := me(); here := location(who); cprint(who, "You are " + here.name + ".\n"); if typeof(here, "desc") = T_STRING then cprint(who, here.desc + "\n"); elif typeof(here, "desc") = T_PROC then cprint(who, here.desc() + "\n"); else cprint(who, "You see nothing special here.\n"); fi; P.showPlayersAndStuff()` lookAround `(who) if who.verbose then P.showHere(); else cprint(who, "You are " + location(who).name + ".\n"); P.showPlayersAndStuff(); fi` showOneObject `(object) if typeof(object, "desc") = T_STRING then cprint(me(), object.desc + "\n"); elif typeof(object, "desc") = T_PROC then cprint(me(), object.desc(object) + "\n"); else cprint(me(), "You see nothing special about the " + P.formatName(object) + ".\n"); fi` showPlayer `(player) if typeof(player, "desc") = T_STRING then cprint(me(), player.desc + "\n"); elif typeof(player, "desc") = T_PROC then cprint(me(), player.desc() + "\n"); else cprint(me(), "You see nothing special about " + name(player) + ".\n"); fi; junk := P.showObjects(name(player) + " is carrying:\n", player.carrying)` [Much later in the database file] # # The action called for each normal input line from a player. # PARSE_ACTION `(str) who := me(); if substr(str, 0, 1) = "\"" then str := substr(str, 1, length(str) - 1); cprint(who, "You say " + str + "\n"); aprint(who, name(who) + " says " + str + "\n"); elif substr(str, 0, 1) = ":" then str := substr(str, 1, length(str) - 1); cprint(who, "You => " + str + "\n"); aprint(who, name(who) + " => " + str + "\n"); else cmd := word(); here := location(who); if typeof(who, "aliases") = T_THING then alias := who.aliases; while if alias = nil then false else alias.word ~= cmd fi do alias := alias.next; od; else alias := nil; fi; if alias ~= nil then str := gettail() + alias.contents; settail(str); PARSE_ACTION(str); elif typeof(who, cmd) = T_PROC then who.{cmd}(); elif typeof(who, cmd) = T_STRING then cprint(who, who.{cmd} + "\n"); elif typeof(here, cmd) = T_PROC then here.{cmd}(); elif typeof(here, cmd) = T_STRING then cprint(who, here.{cmd} + "\n"); else objname := P.getNounPhrase(); if objname = " " then object := nil; else object := P.findObject(who.carrying, objname); if object = nil then object := P.findObject(here.contents, objname); fi; fi; if object = nil then if typeof(C, cmd) = T_PROC then settail(str); cmd := word(); C.{cmd}(); else cprint(who, "You can't " + cmd + " anything here.\n"); fi; else if typeof(object, cmd) = T_PROC then cprint(who, object.{cmd}(object) + "\n"); elif typeof(object, cmd) = T_STRING then cprint(who, object.{cmd} + "\n"); elif typeof(C, cmd) = T_PROC then settail(str); cmd := word(); C.{cmd}(); else cprint(who, "You can't " + cmd + " the " + P.showName(objname) + ".\n"); fi; fi; fi; fi`