Re: Adventure Parser ?
- Posted by Hawke' <mdeland at GEOCITIES.COM> Dec 09, 1998
- 360 views
"Jerome T. Nichols" wrote: > Consider this verb definition in Hugo code (taken from verblib.g) > verblib.g is the main gammer definition file for Hugo. > -------------------------------------------------------------------------- > verb "look", "l" > * DoLookAround > * "in"/"inside" container DoLookIn > * "on" platform DoLookIn > * "at" object DoLook > * "out"/"through" object DoLookThrough > * "under"/"underneath"/"beneath" object DoLookUnder > * "beside"/"behind"/"around" object DoLookUnder > * object DoLook > ----------------------------------------------------------------------------- hrmmmm.... i can see this being placed into a multiuser adventure, quite easily, with a parser already built... ;) let's see... global function do_look(sequence user, sequence param) integer len object showthis, action len = length(param) param = Lower(param) if len = 0 then --looka da pweettyyyy wallssss return ShowIt(user,ROOM,"") elsif len = 1 then showthis = param[1] --pick off an object/thing return ShowIt(user,THING,showthis) elsif len = 2 then action = param[1][1..2] --pick off the action command showthis = param[2] --pick off the target if IsSame(action,"at") then return ShowIt(user,THING,showthis) elsif IsSame(action,"in") --in, inside, into then return do_lookin (user,showthis) elsif IsSame(action,"un") --under, underneath... then return do_lookunder (user,showthis) elsif IsSame(action,"be") --behind,beneath,beside... then return do_lookunder (user,showthis) elsif IsSame(action,"ar") --around then return do_lookunder (user,showthis) elsif IsSame(action,"ou") --out, outside... then return do_lookthru (user,showthis) elsif IsSame(action,"th") --thru, through then return do_lookthru (user,showthis) end if end if SendToUser(user,NEWLINE & "Syntax...blah") return user end function i'm reasonably sure that the quasi-pseudo/real code above is rather clear/neat... whatta ya think? :) it's actually not very far from what i'm coding :) ShowThis is gonna look similar to the following... glob func ShowThis(seq user, int thingtype, seq thing) object what if thingtype = ROOM then what = GetRoomNum(user) what = GetRoomDesc(what) elsif thingtype = THING then what = LookupObjectByName(thing) what = GetObjectDesc(what) end if SendToUser(user, NEWLINE) SendPageToUser(user, what) return user end func 'course, there'll be a wee bit of extra code added for error checking, like if LookupObjByName returns a not found error, before i go running off and attempt to snarf a description from a NULL :) but, so far, i keep thinking that we have a half dozen people writing *parsers* for IF, but one is already built for y'all... and it doesn't have to be multiuser, u can just strip my parser and have at it... on the other hand, since we have a half dozen people working on IF, in one form or another, shouldn't we put a halt to all this duplication of code? and instead concentrate on the meat and potatoes? (the game itself, the... well all the rooms, and objects and stuff need descriptions and definitions and such... areas built persay) i'm not gonna say that my parser is better or worse than another's parser... I will say that my parser *can* handle multiple users inside the adventure game... and to date, i know of NO actual *adventure* game that allowed multiple users... there are MUD's, and chatters/talkers, but none of them are really *adventures*... they may have mini-quests, sure, but... none of them are like Zork or CutThroat or KingsQuest... i've always wanted to know what it would be like if we coulda had 20, 30, 100... people, grouped together, exploring Zork... sure, we all had our buddies over, and one person typed while everyone else hunched over, trying to read, and throw out suggestions of what to do next... my neck still hurts from all that craneing :) but try this: Johan lifts the rug. Under the persian rug you find a trap door, which is unlocked, but appears frozen shut from years of not being used. Altain uses his prybar on the trap door. The trap door begins to creak open, as Altain bears his might against the prybar. The trap door is open. A set of stairs leads down into the stench rising up from the hole where the trap door used to be. Perynth says, "You go first." Altain says, "Oh no, I opened it, I'm not going down there." Merisol says, "Oh you are all wimps." Altain says, "Who you callin wimp? I opened the damn door." {here is a neat thing i would have always liked to see: {private messages from the GAME, to a SINGLE player :) {this next line is sent ONLY to Johan, choosen at random: {You hear a faint ... moan?} Johan says,"Did you hear that?" Perynth says, "Hear what?" Johan says, "I'm telling you, I heard something down there." Merisol says, "and... what did you hear? Your heart thumping because you are too scared to climb down those stairs?" Altain says, "oh all right, I'll go first." Altain lights his lantern. Altain descends the stairs, and the halo from his lantern slowly diminishes until you see only the barest glow from the hole. now, to me, that woulda been kewl :) and those four 'people' coulda been at the 4 corners of the world... and graphics wouldn't spoil it either... text or text/graphics would be pretty much ok by me... > More info and examples on Hugo can be found on my web site > shown in the footer of this message. It was just a idea I did on > the subject, though I'd pass it on. good idea, i like the idea of choosing one parser and having people interested in contributing/writing/coding making 'areas' for the game, and perhaps have a repository for "need this command" <i will write that command> type of delegation on the project... take care--Hawke'