Rooms, directions and ....?

Hi everyone,

So, my wife has been my first game tester and things were going great. Minor bugs were popping up here and there, a couple of game-breaking ones that were easy to fix. Nothing too surprising.

And then last night my magic system completely crashed. Oh, no!

So I went back through her transcript this morning to figure out what happened. And then I saw it. And I know how to fix it. It will actually be really easy. What I want to do is make sure I’ve covered all of my bases so it doesn’t happen again.

Here’s what happened.

Here is my spell-casting action:


A spell is a kind of value. Some spells are defined by the Table of Spells.

Casting it at is an action applying to one spell and one visible thing. Understand "cast [spell] at/on [something]" or "cast [spell]" or "[spell]" or "[spell] [something]" or "use [spell] on [something]" or "use [spell]" as casting it at. Rule for supplying a missing second noun when casting: now the second noun is the location.

I even have a teleporting spell that can be cast on directions. This may or may not have needed a new action specific to casting spells on directions. I did this months ago, so I don’t remember, but that’s what I did. It looks like this:

Understand "cast [spell] at/on [direction]"  or "[spell] [direction]" or "use [spell] on [direction]" as spelling it at. 

Spelling it at is an action applying to one spell and one visible thing. 

What I had not anticipated (and, in retrospect, I should have) was the player trying to cast the other spells on a location.

My wife tried to cast the unlocking spell to the east (rezrov east). This blew everything up.

I know how to fix it, I’ll just add the code for “spelling” the other spells.

Now my game will cover what happens when spells are cast on rooms, directions and regular items. My concern is that I’m forgetting something else weird.

Is there anything else the player could conceivably cast a spell on that wouldn’t be covered by the above pieces of code?

Spells are notoriously difficult to make work and everything will work now, so I am loathe to actually change any of the above. If possible, I would much rather add code than change what is already working.

The other basic kind (non-thing object) is region. However, rooms and regions are always out of scope, so the parser will never recognize them. (Unless you write code to explicitly add them to scope.)

2 Likes

Ok, thank you. Every time I start working on a new Inform project I have to refresh myself on the different kinds of things/objects and what they all mean and what the differences are between “visible thing” and “thing” and “something” etc. It just doesn’t stick in my brain.

So I sometimes grab for the wrong one with my actions. I use the documentation (which is very good), but if there’s a significant gap in time from when I first coded an action and when I go back later to alter it, I don’t always remember why I chose the kind of element that I did (or if I even had a good reason).

With my code above, I separated casting a spell on a “visible thing” and a “direction” as two separate actions. I assume I did that because directions aren’t a “visible thing,” but I’m honestly not sure how the action would have worked differently if I had just said “thing” instead of “visible thing” and if that would have included directions or not.

But I didn’t want to mess with changing it, I just wanted to avoid any other surprises. It sounds like I should be good.

Thanks again!

1 Like