Problem with "say"

I know I’ve been posting a lot but I’m just really getting into IF authoring lol.

In my code, a lot of the time I’ve run into a problem where say "text" doesn’t work Here is the error I get:

In the sentence 'say "hi"', I can't find a verb that I know how to deal with.

Does anyone know why this is happening?

Is say ‘hi’ attached to a rule so Inform know when to say ‘hi’?

When play begins:
     say "Hello!";

Should work.

I’ve tried it both in a After going to: and on it’s own but it doesn’t seem to work.

“going to” isn’t the name of a default rule unless you’ve defined it. “Going” or “going [something]” is. (as in After going north: …)

Oh so that’s why it won’t work in stuff like After going to Bedroom:


Test Room is a room.

Annex is north of Test Room.

After going:
	say "You have gone...";

After jumping:
	say "Oh, hi there!";
Welcome
An Interactive Fiction
Release 1 / Serial number 200411 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

Test Room

>jump
Oh, hi there!

>n
You have gone...

To be clear, “going to ROOM” is a usable action description. Just not “going to” on its own.

So this works:

After going to the Kitchen:
	say "Foo.";
	continue the action.
1 Like

You can use “to” as in

Annex is north of Test Room.

After going to Annex:
	say "Welcome to the Annex...";

But “going to” by itself isn’t a defined action, the action is just called “going”.

I’ve tried it but it still doesn’t seem to be working.

Again, we can’t really tell what’s wrong unless you show the code that isn’t working.

After going to Hospital Room:
say "How did you get here?"

That works for me, as long as the Hospital Room is defined.

Lobby is a room. Hospital Room is a room. Hospital Room is north of Lobby.

After going to Hospital Room:
	say "How did you get here?"

Lobby

> north
How did you get here?

1 Like

Hospital room is defined but it isn’t working

Exactly what error are you getting? Would you consider uploading your full code somewhere or share it with us some other way?

Here is my full code:

Click here to reveal
"NESTALE" by Tastylemon

When play begins:
	now the time of day is 6:00 AM; now the left hand status line is "Time: [time of day]".
	Toast is a thing;

use no scoring.

include Music by Daniel Stelzer.
include Basic Screen Effects by Emily Short.
include Real-Time Delays by Erik Temple.

release along with "Quixe" interpreter.

The display banner rule is listed before the when play begins stage rule in the startup rules.

inF is a truth state that varies. inF is false.

Understand "Forest" as F.

Bedroom is a room. "A cluttered room that is boiling hot. Not the best place to sleep in.".
player is in Bedroom.

Bed is in Bedroom. The description of Bed is "Your bed.".

Instead of taking Bed:
	say "Why? J-Just Why?".

Wardrobe is in Bedroom. The description of Wardrobe is "You put your clothes in here.".

Instead of taking Wardrobe:
	say "nope.".
	
Bedside Table is in Bedroom. Bedside Table is a container. Bedside table is openable. Bedside table is closed.

Instead of taking Bedside Table:
	say "Stop."

Mystery Key is in Bedside Table.

After taking Mystery Key:
	say "Huh? I don't remeber that being there!"

Bedroom Door is south of Bedroom.
Bedroom Door is north of Hallway.
Bedroom Door is a door.
Bedroom Door is closed.

Hallway is a room.

Bathroom is a room. "Where you go when you need a bath".

Bathroom Door is west of Hallway.
Bathroom Door is east of Bathroom.
Bathroom Door is a door.
Bathroom Door is closed.


Shower is in Bathroom. The description of Shower is "It's your shower.".

Instead of taking Shower:
	say "Dude, what is in your drink. What are you trying to do?".
	
Toilet is in Bathroom. The description of Toilet is "Just a toilet ¯\_(ツ)_/¯".

Instead of taking Toilet:
	say "S-T-O-P".

Sink is in Bathroom. The description of Sink is "Water comes out of here.";

Instead of taking Sink:
	say "...".
	
Bath is in Bathroom. The description of Bath is "You dont need a bath".

Instead of taking Bath:
	say "...".

Kitchen is a room. "You can make food in here".

Stairs is south of Hallway.
Stairs is north of Kitchen.
Stairs is a door.

Fridge is in Kitchen. Fridge is a container. Fridge is closed. Fridge is openable. The description of Fridge is "It keeps food cold.".

Instead of taking Fridge:
	say " ".
	
Kitchen Shelves is in Kitchen. Kitchen Shelves is a container. Kitchen Shelves is closed. Kitchen Shelves is openable. The description of Kitchen Shelves is "Not much in here."

A food is a kind of thing that is edible. Food has some text called flavour. The flavour of food is usually "Tolerable ¯\_(ツ)_/¯"

After eating something:
	if the noun provides the property flavour, say "[the flavour of the noun][paragraph break]";
	otherwise say "It's [noun]-flavoured.".
	
Toast is food.
	
After going to the Kitchen for the first time:
	now the player carries Toast;

Oven is in Kitchen. The description of Oven is "Don't put your hand in!"

Instead of taking Oven:
	say "pls stop".
	
Outside House is a room.
Outside House is south of Kitchen.

After going to Outside House:
	say "Why don't you go for a walk?".

Forest Path is south of Outside House.
	
Forest Path is a room. "Quite a nice path".
tree is in Forest Path.

After going to Forest Path:
	Wait 1500 ms before continuing;
	now the player is in F.


F is a room. "Dark but relaxing woods.[paragraph break]It's quite a nice wa;k. Your suprised you haven't walked here before". The printed name of F is "Forest".

After going to Forest:
	Wait 3000 ms before continuing;
	now the player is in Hospital Room.
	
Hospital Room is a room. "BEEP... BEEP... BEEP... BEEP... Huh? What's that sound?".	

After going to Hospital Room:
	say "hi";`

(I didn’t put it in code because multi-line doesn’t work for me)

[EDIT BY MOD (Hanon) - wrapped as code and detail-tagged for space]

That seems to be OK, except for the extra ` at the end of the last line.

Whoops. That isn’t actually in my code. I forgot to take it out when getting rid of the backticks

Yeah, it works here as well.

I haven’t look deeply into this, but the problem seems to be with the Real-Time Delays extension and the lines

After going to Forest:
	Wait 3000 ms before continuing;
	now the player is in Hospital Room.

The obvious error is that you don’t have a room named Forest, it is named F. But even if we change the first line to After going to F: it still won’t work as expected. Theres is a pause, but the player is never moved to Hospital Room.

I don’t know why this is, but if I change it to a different kind of rule it seems to work:

Every turn when the location is F:
	Wait 3000 ms before continuing;
	now the player is in Hospital Room.

EDIT: It seems to happen because the After rules are not continued. If you disregard the above and just add continue the action to the After going to Forest: and the After going to Forest Path: rules, it probably gets closer to how you want it to work.

2 Likes

The reason why it doesn’t work is because “now the player is in …” doesn’t count as an action, the player’s location just changes, so any “after going” rules won’t trigger.

You can move the “say” to the place where you move the player:

After going to Forest:
	Wait 3000 ms before continuing;
	now the player is in Hospital Room;
	say "hi";

Although it’s unclear why you even need to move the player around manually right after they’ve entered some other room. Wouldn’t it be easier to just put the Hospital Room where the Forest is in the first place? You can put the forest’s description and pauses in the After going to Hospital Room rule.

I’m not doing it very practically as it is of course my first game. If and when I make a other one I might try to use better solutions for problems like this.