Need help with some basic inform7 mechanics for project

Hello IF community,

I’m working on an IF story for a class. It’s a group project (uggh), but I am now the sole author of this IF game, and I’m on a deadline.

I have flipped through the manual, the recipe book, and have done many Google powered searches to little avail. Any assistance you can render to me in my hour of need would be greatly appreciated.

The story is simple, max of 6 rooms. I’m going with the cliche of small town sheriff teleported onto a crashed alien vessel. The vessel’s drive is damaged and about to blow up, taking the earth with it. There’s a wounded alien in the cockpit of the craft that will help if he’s healed.

I have figured out how to teleport the player onto the craft and from room to room. I was not able to figure out how to make touching a panel unlock and open doors. I have not figured out how to:

create a device that will heal the alien
create a device that will kill the alien
how to allow the player to shoot the alien with the gun they carry as initial inventory
how to have a timed event where the sheriff is contacted by a shadowy “agent” over his radio to suggest killing the alien with the killing device
how to allow the player to use the flashlight they also carry as initial inventory.

This probably sounds like a lot to ask for, but I’ve been at this for about 16 of the last 48 hours. I don’t need my work done for me, just a little help.

Many thanks for your attention to my plea. Thanks for listening.

Cheers,

Hardkase

The flashlight is fairly simple.

The player carries a device called a flashlight.
Carry out switching on the flashlight: now the noun is lit.
Carry out switching off the flashlight: now the noun is unlit.

This creates it as a “device”, which enables the “switching on” and “switching off” actions, and then adds rules for those actions to make it turn on and off.

The doors are also fairly simple. Declare the door as “locked”, then use a rule to change its state.

Instead of pushing the panel:
    say "Bzzt!";
    now the metal door is unlocked.

For the others it will really depend how you implement the alien.

I’ve made a couple of games with guns in them, as well as this tiny example I put together for a different question on this forum: http://playfic.com/games/Afterward/working-with-firearms Make sure you click on “View game source” so you can see how it works. You probably don’t need to implement your gun exactly like this, but a classification like “precious” and “fragile” objects might be useful—when people playing your game find out that there’s a gun in it, they’ll want to try shooting a lot of different things!

For the timed event with the guy on the radio, I’d use as my model the “Day One” example from the Inform Recipe Book, which I’ve included below (in spoiler tags because it’s so dang long):

[spoiler][code]Example 160 (***): Day One
A scene which plays through a series of events in order, then ends when the list of events is exhausted.

"Day One"

Lecture is a scene. Lecture begins when play begins.

Every turn during Lecture:
	repeat through Table of Lecture Events:
		say "[event entry][paragraph break]";
		blank out the whole row;
		rule succeeds.

Here we use a table (see subsequent chapters) to keep track of all the events we wish to have occur during the course of the scene.

Table of Lecture Events
event
"'Welcome to Precolumbian Archaeology 101,' thunders Dr Freitag from the front of the class. 'Miss-- yes, you in the back. If you can't find a free seat, how are you going to find Atlantis? Sit down or leave. Now. Thank you.'"
"Freitag stands behinds his desk and lines up the pile of books there more neatly. 'It has come to my attention over previous years that there are two sorts of person who enroll in my class,' he says.

'Some of you will be members of the swim team or women's lacrosse players who have a distribution requirement to fulfill and are under the mistaken impression that archaeology must be easier than psychology. If that description applies to you, I advise you to drop the class now rather than at the midterm break. Under absolutely no circumstances will I ever sign a withdrawal form for someone who is crying at the time. Make a note of that, please.'"
"'The second sort of person,' Dr Freitag says, getting another wind. 'Yes, the second sort of person takes this class because she imagines that it is going to lead to adventure or possibly to new age encounters with dolphins.'

His eye moves over the class, lingering an especially long time on a girl in a patchwork skirt.

'You should also leave now, but since you are probably lying to yourself about the reasons you're here, you will probably not heed my warning and we will be doomed to a semester of one another's company nonetheless.'"
"'Whatever you may tell yourself, you are not here to gain a deeper understanding of the world or get in touch with yourself or experience another culture.'

He paces before the first row of desks, hammering on them one at a time. 'I know you probably wrote an admissions statement saying that that is what you hoped to do. Well, too bad. It is not inconceivable that some of you, somehow, will muddle towards a deeper understanding of something thanks to this class, but I am not holding my breath, and neither should you.'"
"Freitag takes a breath. 'No, my dear freshwomen, what you are here to do is learn facts. FACTS. Facts are unpopular in this university and, I am unhappily aware, at most of the institutions of inferior preparation from which you have come. Nonetheless, facts it will be. I will expect you to learn names. I will expect you to learn dates. I will expect you to study maps and I will expect you to produce evidence of exacting geographical knowledge on the exams. I will expect you to learn shapes of pottery and memorize masonry designs. There are no principles you can learn which are more important or more useful than a truly colossal bank of facts right there in your own head.'"
"'I do not ever want to hear that you do not need to learn things because you will be able to look them up. This is the greatest fallacy of your computer-semi-literate generation, that you can get anything out of Google if you need it. Not only is this demonstrably false, but it overlooks something phenomenally important: you only know to look for something if you already know it EXISTS. In short there is no way to fake knowledge, and I am not going to pretend there is.' He smiles in lupine fashion.

'This class is likely to be the most miserable experience of your four years in university. Clear?'"
"Everyone is silent."
"The lecture is interrupted by the shrill of a bell."

And then we define the scene so that it ends when the table runs out.

Lecture ends when the number of filled rows in the Table of Lecture Events is 0.

One advantage of this is that we can then edit the events in the scene by changing just the table; the scene will always run the right length and end on the turn when the last event occurs.

And to add a few additional details:

Instead of doing something other than waiting, looking, listening or examining during Lecture:
	say "Dr Freitag glares at you so fiercely that you are frozen into inaction."

Notice the careful phrasing of “doing something other than…” so that we do not mention the objects; if we had written “something other than listening to something…”, the instead rule would match only action patterns which involved a noun. We state the rule more generally so that it will also match nounless commands such as JUMP and SING, since Freitag will probably take a dim view of those as well.

When Lecture ends:
	now Freitag is nowhere;
	say "There is a flurry of movement as your fellow students begin to put away their books. Dr Freitag makes his way to the door and is gone before anyone can ask him anything."

The Classroom is a room. Dr Freitag is a man in the Classroom. "Dr Freitag paces before the blackboard."

Test me with "listen / x dr / x me / jump / z / z / z / z / z / x dr".[/code][/spoiler]

Again, not everything in this is stuff you’ll want!

Brilliant help, Draconis and Afterward. Your suggestions were insightful and really gave me the final oomph I needed to get the game done. Inform is definitely a harsh master. I might return to it and to here if I ever have free time again. It’s an interesting way to explore narrative, if one can ever get a hang of the syntactical finesse Inform requires. Thanks again for taking the time to help a n00b out! Cheers!