TEST website instance!Generalised error handlingHere is that BAIL.OUT procedure for handling general errors. I'll use it to show two distinct ways of embedding player command words in the game's responses. proc bail.out
local qualifier # Local variable initialised to zero
ifeq status, 1 # If a single word command given
ifflag arg1, object # If that word is an object name
ifnear arg1
else
quip "There is no # here!", arg1
fin
else
set qualifier, 1 # The word is not an object name, assume verb
fin
quip "You need to say what you want to [do with the /]{arg1}.", qualifier
fin
quip "You can't do that!" # Generic no can do
Used as other than a major directive for declaring objects, OBJECT is an automatically maintained entity flag, which is true for objects (or variables pointing at objects) and false otherwise. If the supplied word refers to an object and the object is not nearby (not carried and not at the current location), the QUIP directive will say so. The # sign in that message is a word holder, which gets replaced by the word pointed at by the ARG1 variable.
If the object referred to is present or the supplied word is not an object,
we want to say that not enough information has been given. That response is
very similar in either case, so I used the same meassge with an embedded
switch, which is qualified by the QUALIFIER variable. The command word is,
in this case, echoed via the { If code execution continues past that second FIN, it means that the command being processed had more than one word (otherwise it would have been handled by one of the preceding QUIPs). That being so, a very generic "don't understand" will do the job.
| ||||