Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rwth-aachen.de!uni-paderborn.de!fu-berlin.de!main.Germany.EU.net!Frankfurt.Germany.EU.net!howland.erols.net!newsfeed.internetmci.com!in3.uu.net!world!olorin
From: olorin@world.std.com (Mark J Musante)
Subject: Re: [TADS] Unnotify
Message-ID: <Dx5z3v.LxA@world.std.com>
Organization: The World @ Software Tool & Die
X-Newsreader: TIN [version 1.2 PL2]
References: <cagerlac.841753616@merle>
Date: Tue, 3 Sep 1996 15:59:54 GMT
Lines: 45

Charles Gerlach (cagerlac@merle.acns.nwu.edu) wrote:
> Help! I'm within sight of finishing my game, but I'm stuck.

> This isn't what's in my game, but the code is identical. Let's say I
> have a bomb, and the player has one turn in which to defuse it. Currently
> the code looks like this:

> ..."Oh no! The bomb is going to explode! ";
>    notify( bomb, &explode, 1); 
> ...

> bomb: item
> ...
>     verDoDefuse( actor ) = {}
>     doDefuse( actor ) = 
>     {
> 	unnotify( self, &explode );
>         "Whew, that was close! ";
>     }
>     explode =
>     {
>  	"\b Boom! You're dead. ";
> 	die();
>     }
> ;

Try putting a counter into your bomb:

bomb: item
	// ...
	ticks = 5
	explode = {
		if ( ticks = 0 ) {
			"\bBoom! You're dead. ";
			die();
		} else {
			"The bomb ticks away... ";
			--ticks;
		}
	}
;

This way, the player gets a few turns to figure things out.

 - Mark
