Okay, this seems silly, BUT--

I am trying to script a scene where the player tries to pay for something with a credit card, but the card is ‘rejected’, and this triggers a scene where they are not allowed to exit until they figure out another way to leave the room without paying.

Here’s what I’ve been trying to do:


A credit card is a kind of thing. A credit card can be either accepted or not accepted. A credit card is usually accepted.

Player is carrying a credit card.

PubHostile is a scene. PubHostile begins when the credit card is not accepted. PubHostile ends when the player is in the Lonely Moors.

After giving the credit card to the proprietor:
	say "'We only take cash.'";
	now the credit card is not accepted.

And this is where the game gets hung up, and returns:

Problem. You wrote ‘now the credit card is not accepted’ : but this is not explicit enough, and should set out definite relationships between specific things, like ‘now the cat is in the bag’, not something more elusive like ‘now the cat is carried by a woman.’ (Which woman? That’s the trouble.)

See the manual: 8.11 > Now…

Seems like no matter how I rephrase or write it, I can’t get it to work??? Thanks in advance for any help–

You’ve defined a credit card as a kind of thing, which means that Inform doesn’t know which credit card to set as “not accepted”. Try this.

[code]“Test”

A credit card is a thing. A credit card is either accepted or not accepted. The credit card is accepted.

Player is carrying a credit card.

PubHostile is a scene. PubHostile begins when the credit card is not accepted. PubHostile ends when the player is in the Lonely Moors.

Check giving the credit card to the proprietor:
say “‘We only take cash.’”;
now the credit card is not accepted instead.

The Village is A Room. The proprietor is a person in the village. The Lonely Moors are north of The Village.

Test me with “give card to proprietor”.[/code]

Also, using a after rule will still cause the card to be handed over to the proprietor. What you want here is a check rule.

Hope this helps.

Thanks again, that worked! :smiley: But here’s another snag, equally trivial but it’s confusing me:


Before going west from the Pantry:
	if the player is on the stool:
		say "You climb through the small window.";
		move the player to the Back Alley;
	otherwise:
		say "The small window is too high up off the ground for you to reach." instead.

This seems to work okay, but when I get to the Back Alley I get a weird message:

get on stool
You get onto the stool.

w
You climb through the small window.

Back Alley
You can see a small window here.

You’ll have to get out of the Back Alley first. <-----Ahhrr! Why does it print that???

I think it’s because the Going action stores the player’s immediate enclosure—the stool—at the start of the action. Then, because the first case of your if/otherwise block allows the action to continue, it does so—still attempting to move west!—until it hits the “can’t travel in what’s not a vehicle rule”, as you can see if you first run the Rules debugging command.

Changing the one line to " move the player to the Back Alley instead;" stops the action after moving the player. It’s generally a good idea to do this (or, equivalently, add an explicit “stop the action;” line after) when you replace the player’s attempted action with another, to prevent weird behavior like this. Even if it seems to behave properly at one point, later changes in your code can break such open-ended actions in the future; very tricky to identify.

Alternatively, if you have made the small window a ‘door’ or have mapped the Back Alley west of the Pantry, you could presumably just skip the ‘move’ phrase and let the going action itself take care of the transition.

Thanks for the explanation Chris & Felix, that helped out, and I’m getting a better grasp of the Inform 7 language. I can’t believe how far into the game I am after only a week or so, having previously tried to start it with another text-adventure language that felt too script and code heavy to deal with for a novice. What a great program, and supporting community!