I’ve recently rediscovered the joys of IF (used to use the Graphic Adventure Creator on the C64 when I was a kid!) and have started on my first forays into writing using Inform 7. However, there are a few things I’m trying to achieve that seem to be fairly standard IF practice IMHO, but I’m having a hard time working out how to implement in Inform.
Apologies if this has already been covered - I did some searching around but couldn’t find anything specific…
Issue 1: Nested If Statements
So, I’m currently working on the usual ‘dungeon’ style scenario and I’ve given the player a beastie to fight. I want the player to trigger an event with several possible outcomes using ‘Attack [monster]’. The outcomes are determined by checking the equipment the player is carrying.
Currently I’ve written the following:
Before attacking the [monster]:
if the player is carrying the [item]:
say "You brutally hack at the [monster] until it is an unrecognisable pulp. By some magickal means the slimy puddle left behind morphs into a brass key.";
move [monster] to the void;
move brass key to location;
say "The [monster] waves it's antennae menacingly. You decide you'd be better not messing with this one.";
(I’ve replaced monster and item names so as not to give away to much in case this becomes the next IF sensation, haha.)
Of course, this is generating the following error:
Issue 2 - Multiple Objects
In another scenario I’ve set up a storehouse where a number of items are kept. Some of the items in the storehouse come in multiples, but the player only needs to take one at any given time.
I’ve read the documentation which describes making an ‘infinite’ item dispenser which only gives the item if the player doesn’t have one, but I don’t want to use this method - I want to put, for example, five batteries into the storehouse and give the option of taking one or more batteries if they choose to.
I’ve managed to put the five batteries in place but I can’t find out how to make the player take a single battery. Any clues?
Thanks a lot for any help you guys can give!