On Tue, 17 Feb 1998, Edward Glamkowski wrote: ->An easier way to do this, which I believe has been discussed quite ->extensively on this list in the past, is to have extra descriptions ->that only appear under certain conditions. Personally, I would permit a certain amount of "scripting" inside the room description. @={dark:It is dark.}{light:It is light.}; ~ Parsing this would be fairly simple and done during the "look" command. Basically, if we encounter "@", then check if the next-character is "=" or "!" or ">" or "<" or "l" or "g" (standing for: equals, !equals, greater-than, lesser-than, lesser-than-or-equal, greater-than-or-equal). If it isn't, then skip forward to a ';' or to the end of the description without printing anything. Next, we expect an opening brace. This is the beginning of the condition. We read up to a colon after that, and this a keyword denoting the condition that we are checking for. Beyond the colon, but before the closing brace, is the text that is printed if the condition is true. If it is false, then we check for the next condition, continuing to do so until we hit the semi-colon, that ends the "scripting". The description above is probably a lot more complex than the code itself would be. With enough keywords, you could probably do some nifty stuff: You are @={standing:standing}{sitting:sitting}{lying:lying} {dead:lying dead}; in the @={light:middle of a scarred and bloody landscape. Light shines upon the contorted faces of impossibly twisted corpses, looking as if they fell from a great height to get into such positions.}{dark:middle of a pitch black field. Motionless forms lie about you, though they are too distant and vague to be called men or rocks.}; ~ I don't know, I'm too lazy to actually write something worth reading, but I think you catch my drift... -dak +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST