And a confusing thing I want to do with Inform


Tue, 20 Jun 1995 12:06:11 -0400

This is not like my previous post. This is about something I want
to do which the libraries were never designed for, so it's no
surprise that I can't figure out how. :)

I want to implement the "multi-turn wait" that you find in the
Infocom mystery series. In other words, the player types "wait 10",
and the game acts like he typed "wait" ten times (handling timers
and daemons and each_turns.) Special events should cause a "Keep
waiting?" prompt, and super-special events (like dying) should abort
the wait.

Here is (more or less) my first try:

[ WaitTurns num;
meta = 1;
interrupt = 0;
while (num > 0) {
Time();
if (deadflag ~= 0)
interrupt = 2;
if (interrupt == 1) {
print "Keep waiting? ";
if (YesOrNo()) interrupt = 0;
else interrupt = 2;
};
num--;
}
]

interrupt is a global variable; special events set it to 1, and
super-special ones set it to 2. Setting deadflag is equivalent to a
super-special, as you can see. Time() is a library internal that
*looks* like the right thing to call.

I set "meta" because otherwise, the library calls Time() an extra
time (the usual thing after completing a player command.) We don't
want that, particularly if the player just typed "no" to a "keep
waiting" prompt.

Anyway, that seemed to mostly work, but when I tried waiting through
a daemon-caused death event, it went wonky. I don't have the
offending message, but it did something goofy *after* I died, like
a daemon message or something.
(Sorry, that's not very clear -- I'll check again tonight.)

It's possible that I should just declare the verb meta instead of
setting the meta flag, but this experiment convinced me that I don't
understand the subtleties enough to get it right (or even tell if
I've gotten it right.)

Has anyone done this before?

--Z

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."