Large interactive objects that act like a backdrop (sort of) – Inform 7

I ran across an interesting problem in my WIP that to solve I went through a couple different solutions before getting something simple to work.

Note:  This may not be the best way to handle the problem and I’m always open to suggestions for improvements.

In my current WIP (one of them anyway), I have a situation where I had a large object that was visible from many rooms.  Let’s say a large tree in my front yard and the rooms are areas around the yard.  There is also one room inside my house that I can see the tree out a window.  My first inclination was to make it a backdrop so it could be seen from those rooms.  Let’s assume that the entire map of the game is those outside locations and that one room in the house.

The shade tree is a backdrop. The shade tree is everywhere.
The description of shade tree is "A great big tree."

Worked great, until i wanted to the tree to be a supporter.  I tried adding the supporter tag to the tree “The shade tree is a backdrop and a supporter.”  This gave me the error: “… as a backdrop and a supporter are incompatible…”  I really needed the tree to be a supporter as it was critical to be able to put something on the tree.  So out came the backdrop and making the tree a supporter worked great.

However, it wasn’t very realistic.  It made no sense that I could go to a different part of the yard and if I tried to look at the tree I would get the message: “You can’t see any such thing.”  Well what’s the best way to be able to interact with an object that is not in the current location?  Put it in scope.

after deciding the scope of the player:
    place the tree in scope;

This worked fine, now I could examine the tree from anywhere.  And if I tried to do anything to the tree away from the actual location where the tree is, I get a message saying “I can’t reach into Under-the-tree” (which is where the tree is located).  Well that’s not a very good message so I need to change the rule for reaching inside a room (which is what you’re doing if you are trying to interact with an object, in scope, that is located in another room.)

Rule for reaching inside a room:
    if the location is up-the-tree:
        if the noun is the shade tree:
            allow access;
            say "You can only look at [the noun] from a distance.";
            deny access;
        say "You can only look at [the noun] from a distance.";
        deny access.

Let’s look at a few things with this last section of code.

  1. We are replacing the rule for reaching inside a room from the standard library so we can run some of our own checks.
  2. We first check to be in the location up-the-tree.  I hadn’t mentioned this before, but I let the player climb the tree and it puts you in a location up-the-tree.  Since the tree is not in that room, but is in-scope (because of our scope rule) without this rule we would have gotten the “Can’t reach into” message.  Which is silly since of course I can “touch the tree” since I’m in it.
  3. So if we are in the tree and the noun is the tree (meaning we are trying to do something to the tree while up the tree) then we allow access, which lets the appropriate rules and actions trigger.
  4. The otherwise’s tell us we are either not up the tree (say in the house) or we are trying to interact with something other than the tree.  In those cases, just display a generic (but more friendly) message.

So now if we try touching the tree for example and we are either under the tree or in the tree, both locations we should be able to touch the tree from we can do this.

instead of touching the tree:
    say "You affectionately touch the tree."

Like I mentioned, I went a couple different directions with this, trying to do more with overriding some standard library rules and going down the path of trying to find a way to create some sort of backdrop / supporter.  (Something I didn’t try that seems kind of obvious now that I’ve typed all this up is making a separate supporter part of a backdrop and then working with it that way, I suspect that may work, but haven’t tried it)

I haven’t tested this code completely, so there may be some flaws or unintended consequences that I’ve not run across yet.  But perhaps this will be useful to someone.

Please feel free to tell me why this is wrong or show me a better way

Edited (9/29/13) to format code a little better

Spring Thing 2014 – Beginning to Prep

Most of you have already heard I’m sure.  Spring Thing 2014 has been announced and thanks to Aaron Reed for taking it over this year.   Now time to wrap up one of my WIP or dusting off one of my ideas that are bouncing around inside my head.  Here’s a short list of things I need to do to get started.

  1. Obviously, pick my idea that most interests me and I can reasonably finish between now and April.
  2. Something I’ve not done before, as I tend to write by the seat of my pants, is flow out the story, figure out where I’m beginning, where I’m going and try to get at least one path to get there. Through this process, I’m sure I’ll come up with some (probably not all) of the important text, descriptions, dialog. and puzzles that belong in the story.  I usually write free form and as it comes to me during coding, but I tend to either stall part way through or end up repeatedly revising so my progress seems very slow.
  3. If there are any tricky parts, code up some of those just to get the hard stuff out of the way.  Use it as a proof of concept perhaps of the more intricate sections.  I’d rather find out now that something just doesn’t work rather than farther down the road when it may be too late.
  4. Keep working on my writing chops.  I try to write each day, whether it’s a  blog post, or some small piece of fiction or some dialog in something project I’m working on.  By writing each day, I keep building my writing muscles.

Just a few of the things I need to do now so that I can begin in earnest sooner rather than later.  Of course there are plenty of other design articles out there that I have read repeatedly and I’m sure I’ll be referring back to;

  • Idea to Implementation – Great article on some different methods.  While i’m gonna try to do a lot of design work up front, the coder in me will probably force me to code quicker than I should.  This article has been great inspiration to try and have a method of some sort to my madness.
  • WIP Rescue – Another good one my Emily.  I’m gonna give this another read as I’m kind of stuck on two works that are in progress.
  • IF Theory Reader – Review a lot of these articles in here, so much good reading in here it’s worth looking at one or two (or fifty) times.

Anyway, wish me luck.  While I’m setting my sites on entering the Spring Thing, but really just want to make good progress and put something out there that others may enjoy.  Any other words of wisdom (or links) are always greatly appreciated.

Fun vs Realism in IF

One thing I struggle with at times when coding on my WIP, is the idea of realism in modeling objects or actions.  I think often we (or maybe it’s just me) can get caught up in perfectly implementing something and duplicating it’s exact functions that we forget or don’t realize that often our mundane tasks aren’t really that fun.

Let me share an example of something I was working on a while ago (still in the works, just on a bit of hiatus at the moment).  Early in the game, the PC comes across an elevator.  My original implementation had the complete function of the elevator.  When standing outside, you pushed the call button. Then you waited for the elevator arrive.  If the elevator was on the 3rd floor and you were on the 1st, it would take 2 turns for the elevator to arrive.  I had implemented a floor indicator above the elevator that told you exactly where the elevator was each turn and then when it arrived, the door opened.  Then after two turns, if you didn’t trigger something else, the door would shut automatically.  You got in the elevator and the process repeated itself as you moved to your destination.

A typical transcript might look like this (abbreviated of course):

You are standing in front of the elevator on the 1st floor.  Beside the elevator is a call button and above the elevator door an indicator showing that the elevator is currently on the 3rd floor.

>push call button

When you push the button you hear a distant ding and then the whir of the elevator as it begins to descend.


You are still in front of the elevator but the floor indicator now says 2 as it descends to you.


You wait and the elevator has arrived and the doors part.


You enter the elevator.  Before you is a panel of floor buttons and again above the door is an indicator showing that the elevator is currently on the 1st floor.

> push floor 3 button

The doors close and you feel the elevator begin to lift.


The indicator above the door indicates you’ve now reached the 2nd floor.


Well you get the idea.  In the real code, I had much more interaction you could do while waiting, but the essentials were there.  I finished it up and I was quite proud of myself.  I had learned a lot during the development of this and actually had thoughts on expanding it even further.

But it wasn’t fun!!!

After playing through the elevator section multiple times during testing of it as well as coding up the areas on the upper floors that I was moving to, I was sick of it.  I didn’t want to wait around for the damn elevator to show up.  Ugghhhh,…..what to do.

Well I scrapped it all.  Well not really, there is an elevator there still and you still need to use it to go to the upper floors (and of course I saved all the code off in my archives to reference later), but the transcript goes a bit like this now.

You stand before the elevator on the first floor.  Beside the door is a call button and above the elevator is a floor indicator showing the elevator is currently on the 3rd floor.

>push call button

You push the button and you were the elevator begin to your floor.  After a few moments the doors part and the elevator has arrived.


You enter the elevator.  Before you is a panel of floor buttons and again above the door is an indicator showing that the elevator is currently on the 1st floor.

>push floor 3 button

You push the button for the 3rd floor and the doors close.  You feel the elevator being to rise and a few moments later the elevator doors open and you arrive at your destination.

Much better….I still kept much of the scenery and things to play with there, but I made the travel much easier.    Still perhaps not the epitome of fun, however it keeps enough of the realism of the elevator without forcing the player to step through all the mundane steps that we take each day without thinking about it.

My takeaway on this is to make sure that no matter how cool the code is, no matter how realistic it may be, unless I’m writing a historical simulation or a particular puzzle or story element truly requires that level of detail….I need to make sure it’s fun and truly necessary before putting the player through something truly mundane.

What could we use IF for other than just games?

Of course the most obvious use for IF tools and languages is for games.  It’s been used that way for years and years.  I got to thinking about other uses of the technology.  What other kind of system could I create with my language of choice? Any specific examples will be with Inform 7, but I suspect that it wouldn’t matter if you were using TADS3, Adrift, Quest or any of the other languages, though I suspect that some things may be more difficult, if possible at all in some of the more CYOA type systems.

Here are just a few things to brainstorm about.

Education – This I think is an obvious one and one that is already being explored and implemented and has been for years.  Look at about any IF blog or site and there will be links. 

              • Inform 7 site – – here’s a whole section on resources and examples of people using Inform in education.
              • Emily Short has a whole list of examples of classes teaching IF or using IF to teach some concept ( If you follow many of those links you’ll find a plethora of information not only about their coursework, but you can look at the material used in the classes for useful white papers and other resources.

Also, IF can be used to teach other subjects.  For example, here is a course where the student, using Inform 7 is tasked with recreating a historical event or situation ( .  There are resources out there for using IF to teach languages, literature, philosophy…just about any subject you can think of. 

Obviously, it can be used for teaching programming.  Being a developer myself, I think this is really important as we need to encourage children to become developers and get interested in programming at a younger age.  What better way to do so in a classroom setting, then to have them develop a game.

Simulation – I’ve thought about this a bit and while IF in general is a simulation of a fictional world or situation and as talked about above, can be used for historical simulation, what I’m really thinking about here is scientific simulation.  I think it would be an interesting exercise to put scientific formulas into IF form, and allow the “player” to experiment with different variables and have the simulation run and display text describing the results (or with some of the newer methods and extensions with Vorple and Gluxl support, perhaps we could do more than just print out text)

This could be useful for being a low-cost alternative to high priced simulation software.  This could also provide a way for students to interact with and experiment with dangerous or high-cost experiments, say a nuclear explosion.  For example (albeit a very simple example):

You weight 100lbs on earth.  Enter in a planet you would like to travel to or enter in a new weight to see what the effect of gravity would have on your weight.

>go to mars
You travel to mars and step up on the Martian scale that is provided to you at the docking station.  You now weigh 38.95 pounds.

>add 25 pounds to your weight
You pick up your luggage which on earth weighed an even 25 pounds.  Now here on Mars the combined weight of you and your luggage (in Martian weight) is 48.6875 pounds.

>convert that weight to metric
For the good of those outside the US, you translate that to metric pounds and your metric weight is now, 22.08427851 kilograms.

And as always, I’ve always felt that you learn best by actually doing and not just reading, so writing out the code to create these simulations will not only teach logic and programming, but also reinforce the scientific formula / laws that govern the simulation you’re are trying to create.

Business Analysis – I spend much of my professional career building business intelligent software for companies.  A large part of that is creating software to analyze sets of data and providing answers to questions asked about that data.  This might actually be a stretch and more of an interesting exercise instead of anything useful, but could we create a work of IF, that reads in sample data and answers questions about it. 

For example, we read in quarterly sales data for a company.  The user can then enter in commands like:

> examine sales for salesman John Doe
After examining the sales information for John Doe, you find that he has sold $1000.00 of widgets for the last quarter.  This is an increase of 1.2% from the previous quarter.

> show me the total sales for Mondays in the last quarter.
You sum all the sales for each Monday for the last quarter of sales to find that you have sold $23,093 worth of widgets. This is up 3.5% from last quarter and is the 2nd highest day for sales (behind Wednesdays).  You have earned $345.93 in commission on those sales.

Just some examples and perhaps a lot of parser magic would need to be done to allow for these queries and really there are probably better tools out there to do the same thing in an easier fashion, but it’s kind of an interesting thought process none-the-less.

These are just a few thoughts I had and I’m sure that I’ll come up with more.  As I said, most of these may be unrealistic or impractical for a number of reasons (other than some of the educational uses as it’s been shown and I do believe that there is usage there in languages, historical simulation, … that are important)

Please share any thoughts, additions or omissions you may have.

Easy transcription notes in Inform 7

This may not be very clever and I am sure I stole this from somewhere (don’t really even remember to be honest), but here’s a nice little line of Inform 7 code that will allow for easy and clean comments in a game transcription.

Understand "* [text]" as a mistake ("Noted.").

Simply put, this allows you to type in:

>* whatever notes you want to enter

and the parser simply says “Noted.” instead of the usual “That’s not a verb I recognize.” or some similar message.

This makes looking at transcriptions a little easier and also helps separate the notes from the true error messages that you may want to see so you can check what verbiage the user is having trouble with.

If this is your code that I don’t recall snagging it from, let me know and accept my apologies for not remembering.

Update:  I found where I got this from, straight from the manual….LOL (

Reporting the location of wandering NPCs

I was recently having a discussion with Marshal Tenner Winter on the forums about having your PC standing on a high point where they would be able to peruse the landscape around them and see other NPCs in other locations.  The goal was to print out the locations of each NPC in a friendly way.

Here is some code I came up with that seemed to the trick and only really needs some tweaks to look more grammatically correct or visual appealing.

every turn when player is in cliff:
   say "From here you can see that [run paragraph on]";
   repeat with someone running through persons who is not the player: 
      if someone is in the exterior:
         say "[The someone] is in [location of someone][run paragraph on], ";
   say "[paragraph break]".

I could seem some tweaks and enhancements to this that would need to be made:

    1. Need to check if the location is actual visible from the high vantage point, this code does do that to a certain degree (by region, in this case the region exterior, assuming ALL of exterior is visible from this vantage) and that may be enough. But let’s say your vantage was up a high tree and not only could you see those locations outside, but perhaps also inside just a few rooms in a house that you’re peeping into.
    2. Grammatically, the code above produces some awkward sentences, tweaks would need to be made to conjunctions, location printed names, things like that.

I can see quite a few uses for this and is a nice little piece of code that I’ll keep around.


Why I chose Inform 7

As I touched on briefly in my introductory post, I am, for now settling on Inform 7 as my platform of choice.  Disclaimer:  These choices and opinions are my own and is not an indication of any deficiencies in any other platform.  In fact, at some point I plan on exploring other platforms (TADS and others) to see what they have to offer, but for today it’s Inform.

NOTE: There may be some minor spoilers of Zork in this post.

Honestly one of the biggest factors for me is this. I am a programmer by trade, primarily with C#.  We do windows, web, and mobile development and I live that 40+ hours a week.  Inform gives me something different to work with.  I have constructs I’m familiar with, yet how you put them all together is completely different from what I do every day.  We still have objects, that have properties and you can take actions on those objects.

A container called a birds nest is here. “On the branch is a small birds nest. “. A closed unopenable container called a jewel-encrusted egg is in the nest. The initial appearance of the jewel-encrusted egg is “In the bird’s nest is a large egg encrusted with precious jewels, apparently scavenged somewhere by a childless songbird. The egg is covered with fine gold inlay and ornamented in lapis lazuli and mother-of-pearl. Unlike most eggs, this one is hinged and has a delicate looking clasp holding it closed. The egg appears extremely fragile.” The description of the egg is “The egg is covered with fine gold inlay and ornamented in lapis lazuli and mother-of-pearl. Unlike most eggs, this one is hinged and has a delicate looking clasp holding it closed. The egg appears extremely fragile.

This is code from the Inform 7 port of Zork.   Here we have a bird’s nest and it can contain things.  There is an egg in the next which is also a container and is unopenable (at least by normal means).  And of course we’ve got plenty of descriptive text.

And here we have some checks that are done when some action results in destroying the egg.

Check destroying the jewel-encrusted egg when the jewel-encrusted egg is not openable:
say “Your rather indelicate handling of the egg has caused it some damage.[line break]The egg is now open.“;
move the broken egg to the holder of the jewel-encrusted egg;
remove the jewel-encrusted egg from play;
say “There is a golden clockwork canary nestled in the egg.  It seems to have recently had a bad experience.  The mountings for its jewel-like eyes are empty, and its silver beak is crumpled.  Through a cracked crystal window below its left wing you can see the remains of intricate machinery.  It is not clear what result winding it would have, as the mainspring appears sprung.” instead.

Now reading those texts you have a good idea what is going on (though I’ve not posted all you can do with the egg and nest.

Of course writing this code is not as simple as reading it.  Inform is still a compiler at heart with a strict set or rules for syntax, however those with any semblance of programming skills should be able to pick up the nuances easily enough.

For me, I read through some samples (), some articles (Emily Short is a good place to start for some code and theory), got into the forum ( and I then bought a book that was quite useful, Creating Interactive Fiction with Inform 7 by Aaron ReedAaron Reed, who has created some very good and influential works himself (check out Blue Lacuna which is billed as the longest work of IF ever created) walks you through creating a game from scratch and discussions a lot (not everything) about not only the technical details and syntax, but also gives tips on the art of creating a work of IF.

Someday I will probably jump in and look at TADS as it’s syntax is more C-like (for that matter, perhaps even bouncing back to Inform 6 would provide much the same — that may be even more useful as I can have both I6 and I7 code in the same project), but for now I’m enjoying the light, yet powerful and still at times complex Inform 7.