top expert

a biting cat website

Let’s Make IF #8: troubleshooting.

Last time, on Let’s Make IF…

Just a short update yesterday! I made a generic scenery object for the stage that I’ll need to get rid of when the prologue ends. It’s just a placeholder for a bunch of random items that will become visible once the lights come on. I also began to think about how smell might work in the game, since smell is a big part of a cat’s sensory experience.

uh-oh.

I started off with a small problem. I decided to write an alternate description of the stage that would only print when marbles was not in that location. This was straightforward; I just added [if the player is in at center stage… otherwise] conditions to the room’s description. Said description is an entry in a table–we set that up last week.

However, when I looked south from the audience area (at the stage), a description of the audience area printed. OK, so there are a few steps that this process goes through:

  1. Confirm that there is a room in that direction
  2. Redirect from “looking [direction]” to examining the room (we’ve placed it in scope already)
  3. So far as examining goes, either look for the current room or else print the room description.
  4. To print either, we’ll go through the routine of checking the relevant room against the current in-series scene.

Sigh. The first thing I do in a case like this is turn on rules tracing. All that requires is entering “rules” into the story tab of the IDE. We get a lot of output there! Even if you don’t know what everything means, it’s still helpful to find the rule processing immediately before the undesired output. In this case, that’s the “carry out examining a room rule.”

[Rule "carry out examining a room" applies.]

OK! I’ll take a look at that.

This code should be familiar; I cooked it up last week.

carry out examining a room:
if the noun is the location:
try looking instead;
otherwise:
say "[description of the noun]";
say line break;
carry out the printing the locale description activity with the noun;
rule succeeds.

It’s printing a description; it’s just the wrong one. There is a condition there, but it looks ok. How about “[description of the noun]?” The description of noun (at center stage) is…

to say the stage's description:
determine the present scene;
choose row with a present action [a table value] of the present scene in the table of among the seats descriptions;
say the description entry;

Well, rats. It looks like I accidently pasted the name of another room into my “say” phrase yesterday when I was copying rules yesterday. Whoops! I’ll have to be more careful moving forward.

moving on.

It seems that I’m off to a rocky start, but the problem was quickly solved. If I keep having trouble, I might consider adding some debug text. Remember my truth state, PROD, that I created way back on day one? We can aways use the condition “if PROD is false” to generate text that only prints in test builds. We’re not there yet though. It’s just an option if we keep missing things.

With that done, Marbles can look back at the stage as planned. I even have flavor text describing D’s current “fascination.”

>look south

The cluttered stage looked even more confusing from a distance. The only thing that was clearly visible was a long box the size of a human vehicle, and there was something a little off-putting about it.

D continued looking at the door, pushing on it experimentally.

As discussed yesterday, I also need to add a description of the box. I also have a decision to make. This box is going to change a lot over the course of the game. Do I want to handle this version of the box the way I’m handling the clutter onstage? That is, move it to “nowhere” and replace it with an entirely different “box” after the scene ends? That’s a tough call, really. I think we’ll be dealing with something at least as complicated as room descriptions, so we may as well handle that with a table, too. We have a framework for this already, so it shouldn’t take long. With some recycled code and a new table, we’re in business.

present action	description
prologue "[if the box is in the location]The area around the box seemed darker than the rest of the stage, as if it were somehow giving off darkness. I didn't like the way it made me feel.[otherwise]From a distance, it was clear that either the box was giving off darkness, or else it was swallowing up light. I couldn't see it clearly from where I stood, even though we cats see very well in the dark."

What else for the seating area? We’ll have to implement the seats, of course, even though Marbles needs to hightail it for the exit.

A popular question from new authors is: how do I implement all of these seats? My answer is not messing with individual seats at all. This is not an opera, and there are no assigned seats. So let’s make a scenery glob of seats. I’ll also make a single seat, but I won’t tell the player it’s worthless until act i begins.

(side note: I changed the name of ‘Among the Seats’ to auditorium)

the chairs are in Auditorium.
the chairs are plural named.
the chairs are scenery.

the chair is scenery in Auditorium.
the plural of chair is alksjhfdsalkjlkdsajf.

How do you like that plural of chair? Since we have “chair” and “chairs” as separate things, we don’t want Inform to confuse the plural of chairs with the plural-named thing “chairs.” I don’t think that even the most curious player will get Inform to Inform to trip across that plural. Meanwhile, Inform should understand that “chairs” is plural named because we use “are” to declare it, but I like spelling things out. I don’t mind redundancy if it helps me read my code.

I just need a nothing response. Player’s aren’t going to have a rich interactive experience here during the prologue.

instead of doing anything when the current action involves the chairs during the prologue: 
say "There was nothing immediately eye-catching about the chairs[first time], and I thought I really ought to check on D. He got into all sorts of trouble without me[only]."

instead of doing anything when the current action involves the chair during the prologue:
try touching the chairs instead;

Down the line, singular chair will get its own message, a clue suggesting that the player look under the chairs, but for now, we’re done here. After we describe the room to the north, that is.

I think I’ll hold off on that for now; I haven’t added my code for tracking D’s movements. That shouldn’t be a lot of work [knocking on wood].

tracking D: old code, new trick.

That didn’t take a whole lot of effort. There were a couple of things to consider. First, my rule reporting D’s progress was redundant to some of Inform’s default messaging. If Marbles follows D immediately, for instance, Inform will print a, “You see D here” message in addition to my own message about his movement. As with smelling, I can see that I need to commit to handling everything about D’s movement (and locale stuff) myself, without any built-in messaging. I’ll start by turning off the relevant rule.

The describe room gone into rule does nothing when the actor is D.

If D is in transit, I don’t want him in the locale description because I’m already saying something about him:

rule for writing a paragraph about d when the destination of d is not the location of d:
now d is mentioned.

As one other thing, relying on “an every” turn rule to get D to the back of the theater creates a one turn delay. Since he should be moving on turn one, I need to get something going when play begins. Instead of duplicating the code, I’ll name my rule governing D’s movement:

every turn when the destination of d is not the location of d (this is the D's movement rule):

Now that I have a name for it, I can fire it anytime–not just every turn (which falls after a turn of play is complete). I’ll add it to the end of my “when play begins” rule:

follow D's movement rule.

Everything’s working now. As I mentioned last week, the movement stuff needs more work, as it makes assumptions about where the player is relative to D. I’m not going to touch that now, though. Since I don’t know how much D will be moving around, I don’t want to overengineer things. Things are fine relative to my project progress.

Here is a link to an online folder containing source code named by save order and date.

Here is today’s updated source.

next.

A quick to-do list:

  • Room descriptions for main exit (local and remote).
  • Remote description for auditorium area.
  • Turning on the lights, revealing the contents of the stage and ending the prologue.

There should be no tech development at this point, just content. From a design pov, I can hopefully write some interesting text that makes the player want to keep going. We’ll see!