Please help me with my very basic question ;)

Hey everybody,

I am trying to wrap my head around inform right now but I am running into some unexpected problems.

For example:

The livingroom is a room.

On the wall there is a button.

Instead of pressing the button in the livingroom:
say “a hatch appears”;
now the hatch is in the livingroom.

This creates an error where inform does not recognise the verb the participle ending of “pressing”. Ok, so I defined pressing as an action applying to one thing which seemed to do the trick.

However, now I get the problem “I was expecting to read a condition, but instead found some text that I couldn’t understand - ‘the hatch is in the livingroom’.”

why would it expect a condition? I get this error in other similar conditions, when I try to change something using “now” when the player does something. How can I do this better?

Hi! For your action, try pushing instead of pressing. Pushing is a built in action for Inform, and I think “press button” is already understood as the pushing action. You can check all the actions in the index tab.

If you want to move something to another location, use “move hatch to livingroom”.

Please note that objects can have names consisting of multiple words, so you can just call your room “living room”.

1 Like

Thank you very much

After some other changes (like making the button a part of the wall instead of something supported by the wall) I got the example to work. Its a good hint to look for the predefined actions and to use move.

However, I originally got this problem in another case, using now:

a pair of handcuffs are a kind of thing. a pair of handcuffs are wearable. a pair of handcuffs can be locked or unlocked.

in the livingroom is a pair of handcuffs.

After wearing the pair of handcuffs:
Now the pair of handcuffs is locked.

again I get the expect condition error :-/

I think the problem here is that pair of handcuffs is a kind, and the game cannot know which particular pair of handcuffs you want locked. So you think you are writing a rule for a particular object, but you are in fact writing a rule for the entire kind, but in a way that doesn’t work.

Several possible solutions.

  1. If there’s just one pair of handcuffs in the game, don’t create a kind.
  2. Otherwise, give this pair a particular name: the rusty handcuffs are a pair of handcuffs.
  3. Write the rule in such a way that it works for a kind: now the noun is locked.
1 Like

In this case, the issue comes from the fact that you’ve defined “pair of handcuffs” as a kind of thing rather than an individual thing. This shouldn’t create a problem with “After wearing the pair of handcuffs”; Inform treats “the” just like “a” in this context, so this rule will apply after the player wears any pair of handcuffs.

But when you write “now the pair of handcuffs is locked,” Inform doesn’t know which pair of handcuffs you mean! It’s obvious to any English-speaking reader that you mean the pair of handcuffs you just wore, but Inform can’t figure that out. If you use the rule of thumb I mentioned last paragraph–Inform will always treat “the [kind]” as “a [kind]”–you can see that “now a pair of handcuffs in locked” is too vague for Inform to figure out which handcuffs are meant.

There are two solutions here. One is to give the pair of handcuffs a temporary name in the rule:

After wearing a pair of handcuffs (called the restraints):
	Now the restraints is locked.

Another way to do it is that the thing that is involved in the action (or first thing involved in the action, if there are two) is called “the noun.” So you can refer to it that way:

After wearing a pair of handcuffs:
	Now the noun is locked.

Now if you test this out, you’ll find that you need to write a message to go with this rule (because “after” rules cut off action processing and stop the report rules from running) and that you need to write a rule to make sure the player can’t take off handcuffs when they’re locked, and probably can’t do other stuff too! But first things first.

By the way, if you want to put in code with indentation and stuff, instead of using the quote tool you can use the code tool, which is the button that looks like </>. You can also type three backticks ``` on separate lines before and after your code.

2 Likes

Thank you very much! I think I get the problem. I will experiment further and report.
cheers!

I have advanced significantly in my pursuit, thanks to the help of you two! However I have another noob question:

I have an object and unless a condition is met I want all actions directed towards it to fail.

 Before doing something other to the window than examining the window:
 	if player is not on the workbench:
 		say "the window is too high, you can't reach it.";
 		stop the action.

Unfortunately, the example does not compile. I can do “before doing something other than examining the window”, but this is obviously to broad, not letting me do anything, except examining the window, while “before doing something to the window” is better, but cancels even the actions that could sensibly be done from afar. How would I express this in Inform syntax?

I have run into this problem of exeptions not working some times now…

You’ve almost got it.

instead of doing something other than examining TO the window:

:smiley:

1 Like

Oh wow. Thank you! So close and yet so far.

This combination of programming language and natural language is killing me! So often its intuitive but when it’s not I have no idea why.

Anyway, its really a lot of fun too.

Like any language, it gets easier the more you work with it. And Inform is so awesome, there’s a crap-ton of things it can do and some of us haven’t even scratched its surface yet.

1 Like

Its versatility certainly surprises me! I am curious, where this is going
:slight_smile:

another tiny question: Is there a way to influence the order reports are printed? I know I kind of can do this by using before, instead or after, but since they are dependant on success criteria they don’t provide the same results.

Yes, you can order rules. But in this case it is perhaps easiest if you show us the code that produces the order that you don’t want?

1 Like
before doing something other than looking, waiting, going, thinking, tasting, listening, examining, dropping:
	if the player is wearing the bond:
		if the bond is known:
			say "Your hands are still bound together, hindering your movements.";
		otherwise:
			say "You realize you can't move your hands independently. They are painfully bound together, apparently by some sort of rope.";
			now the bond is known;

This is a bit annoying, because it is printed before the report of the actual action performed, so we get something like

take box
Your hands are bound together, hindering your movements.

It is fixed in place

This seems diselegant because it becomes unclear, what “it” refers to, if there is a entirely different phrase in between.

using after instead of before does not work

You probably want “instead of doing something…” instead of “before…”.

Any rule can choose to stop the whole action-processing system or let it continue, but by default, “before…” lets it keep going and “instead…” stops it.

1 Like

For this application the resulting order seems to be the same, no matter if I use before or instead with “continue the action”.

“Continue the action” tells it to continue processing, yes. You want the player to be able to do the actions despite being handcuffed?

yes - in this case the purpose of the bond, that is (in the description, not syntax) attached to something heavy, is there mainly to restrict the players movement and his carrying capacity.

The message is there to remind the player and to create a sense of urgency.

Ah! If you want something to happen at the end of a turn, the best way to do that is an every turn rule. You can make these conditional on the action taken that turn, but in this case, I think a random chance might actually work better? Something like:

Every turn when wearing a pair of handcuffs:
   if a random chance of 1 in 6 succeeds:
      say "This is mighty inconvenient."