Toadstool Time Bomb

Thanks for the additional explanation. It works as is, I’m just not sure how to vomit at the last possible moment without it proceeding to killing the player.

I added an incubation period to further stretch the example, is that causing the problem perhaps?

"Scenes with toadstools" by "Testa"


The sunny meadow is a room. "Bright, emerald sward shimmers in the sunlight, sloping downhill towards a cavelike entrance to the east."


The throne room is east of the sunny meadow. "A vaulted and lofty dome, it's not easy to tell if this place is natural or has been fashioned by deliberate intent."


A toadstool is an edible thing in the sunny meadow. "Glistening blue and green amidst the grass, a fine specimen of Royal Deathcap is growing here."

Understand "mushroom", "fungus/fungi", "shroom", "deathcap" or "royal deathcap" as the toadstool.

After eating the toadstool:
	now the printed name of the toadstool is "partially chewed toadstool";
	now the toadstool is in your stomach; [I didn't want to mess around with the default eating action]
	now the toadstool is handled;
	say "You gulp the slimy thing down, too nauseated to chew it thoroughly.";

Your stomach is a container.
Vomiting is an action applying to nothing.

Understand "vomit", "puke", "purge", "throw up" as vomiting.

Report vomiting when nothing is in your stomach:
	say "You retch, fruitlessly.";
	[default message]
	
After vomiting:
	say "You heave up [the list of things in your stomach].";
	now everything in your stomach is in the location.

	
Incubation is a scene. Incubation begins when the toadstool is in your stomach.

Incubation ends happily when the time since incubation began is five minutes and the toadstool is on-stage.

When incubation ends happily, say "Hey, there's that toadstool!" 

Incubation ends miserably when the time since incubation began is five minutes and the toadstool is in your stomach.

Feeling Bad is a scene. Feeling bad begins when incubation ends miserably.
When feeling bad begins:
	say "You begin to feel ill. Perhaps eating that toadstool was a bad idea.";
	
[It's really easy to have things happen only during a scene --]
Every turn when feeling bad is happening:
	say "[one of]Ooo, you do feel strange[or]Your stomach aches[or]Spots shimmer before your eyes[stopping].";
	
Feeling bad ends happily when the time since feeling bad began is three minutes and the toadstool is on-stage.

When feeling bad ends happily, say "You feel considerably better." 

Feeling bad ends miserably when the time since feeling bad began is three minutes and the toadstool is in your stomach.
	

Slow poisoning is a scene. Slow poisoning begins when feeling bad ends miserably.

When slow poisoning begins:
	say "Spots dance before your eyes, and your lips feel numb. There's no hope for you now.";
	
[or PROHIBIT certain actions during a scene]
Instead of going when slow poisoning is happening, say "You feel too weak to travel.";
	
Slow poisoning ends when the time since slow poisoning began is two minutes.

When slow poisoning ends:
	end the story saying "You have been poisoned.";


	
test me with "eat mushroom / z / z/z/z/z/z".

I think I figured it out! You coded it that way on purpose. The player gets one extra turn to “appreciate” that they are going to die! Nice work.

I’m trying to code for someone who eats the toadstool twice to learn about the changing things after something has happened. As a result I have:

After vomiting:
	say "You heave up [the list of things in your stomach].";
	now everything in your stomach is in the location.
	now the toadstool is nowhere.
        now the dark stain is in the location.

the dark stain is nowhere. The dark stain is fixed in place. The description of the dark stain is "This appears to be the remains of some partially digested piece of fungus."
  

yes, that was so I could demonstrate forbidding actions during a scene. If you eat the toadstool, at first you can travel as usual, but after “there’s no hope for you now” prints (telling you that the scene “slow poisoning” has started,) you’ll find that you can’t travel to a different room any more.

Useful if you want to trap the PC somewhere with a chatty NPC to make sure the player gets the info needed to solve a puzzle, for instance.

Glad you’re figuring it out – I remember what it was like. I spent six months using an IDE and reading the line number of the error off the compiler results and manually scrolling down to the relevant line before someone told me to just double click on the error and it would automatically jump to the line.

This toadstool has taught me a lot. Is there anything I can do to get the dark stain to appear after vomiting? It looks to me to be the same as several other lines but for some reason it won’t make the association.

Does anyone have any thoughts?

I suspect that people whose liked this puzzle will like cerulean stowaway :wink:

Best regards from Italy,
dott. Piergiorgio.

To elaborate on this a little: “in [room]” is something that can be applied to any action. So you can also say “After jumping in the meadow,” etc. It checks whether you’re in that room.

“from [room]” can only be applied to the going action. It invokes an action variable for the going action called “the room gone from.” The room gone from (and another action variable for going, the room gone to) only gets set when there is a valid map connection.

So the reason something like “After going in the meadow” will fail, or will not fire when you want it to, is that the After rule fires after you’ve gone to the next room! So you’re not in the meadow anymore. If you wrote “Before going west in the meadow” that would work even if west was a valid direction from the meadow, because when the Before rule fires, the player is still in the meadow.

(I suspect it is not generally true that “going from [room]” only fires when travel has been successful. If you have an “After going from” rule and a guard prevents you from traveling in that direction, then what’s usually going to have happened is that the action got interrupted by a Check or Instead rule, and the After rules never run at all. However I haven’t had time to check any of the stuff I’m saying.)

Is this in the correct thread?

If you’re asking whether my post just above is in the correct thread, it’s a clarification of DizzyDonut’s remarks on “going in” and “going from” from earlier in the thread. (More on that can be found in Writing with Inform §7.13.)

If you’re asking whether your own post is in the correct thread, only you can say. :wink:

An illustration that will hopefully make things clear…

Dying to go

“That danged guard” by “Testa”

The antechamber is a room. “Handsome paneling, windows that overlook the Fountain Court to the south and elegant furniture should make this a pleasant place to wait. Other petitioners wander about the room subtly – or not so subtly – trying to impress one another. The less important - or less successful - wait in the outer antechambers to the east and the west.”

Check smelling in the antechamber:
say “On a typical day there are several thousand people in the palace, and only eight privies. The first and most important skill of a courtier is achieving a gracious unconsciouness of this situation.” instead.

[note the … going … IN … format]
Check going west in the antechamber:
say “Better not leave: that would be to surrender your chance to petition the monarch.” instead.

Check going east in the antechamber:
try going west instead;

After going nowhere in the antechamber:
say “Do stop blundering into the furniture.” instead; [This won’t fire, but if you substitute “Check” for “After”, it will. (You’ll need to try going in a non-cardinal direction, of course.)]

[note the … going … FROM … format]
After going north from the antechamber:
say “At last! Now your system for contra-flow carriage driving will be considered by some intelligent people!”;
continue the action;

Check going north from the antechamber when the player is not carrying the priority pass:
say “‘Oh no you don’t!’ says one of the guards. ‘Not your turn yet.’” instead;

The guards are a man in the antechamber. “Two burly guards flank the gilded double doors in the north wall.”

[useful for travel messages…]
After going south from the antechamber:
say “You step out into the fresh air for a moment.”;
continue the action;

The Throne Room is north of the antechamber. “All attention is centered on the northern wall, with its bold display of weapons and captured flags. One is supposed to back out of the presence through the large gilded doors to the south.”

The gilded throne is an enterable supporter in the throne room. “The gilded throne of the Persimmons sits empty beneath its fringed silk canopy.”

Check entering the gilded throne for the first time:
say “The next thing one sits on after this perilous seat is typically a spike in the sun.” instead;

After entering the gilded throne:
end the story saying “You have won enduring fame.”

The balcony is south of the antechamber. “Used on formal occasions, this balcony is marble flagged, and dotted with dwarf orange trees clipped into neat shapes.”

The priority pass is a thing in the balcony. The description of the priority pass is “It reads: ‘Admit the bearer immediately.’”

test me with “e / n / s / take pass / n / n.”

Back on the topic of vomiting, a quickie reply from work here. If what you pasted is literal, those lines can’t end in periods. Lines within code blocks (like, everything that’s the result of ‘After vomiting:’) need to end with semicolons.(e.g. ‘now everything in your stomach is in the location’ should have a semicolon after it, not a period. Same applies tothe other similar lines.) And they also need to be tabbed to the same depth, where they are at the same code depth (i.e. ‘now the dark stain is in the location’ appears to be one tab further right than the preceding lines.)

Actually, my distant memory is that working out the tabbing was the thing that took me longest to bring into my stride in Inform. But now I’m 100% tab-boy.

-Wade

I think you can use the construction “If we have eaten the toadstool…” but its a lot easier to make an adjective flag:

The toadstool can be eaten.
After eating the toadstool: now the toadstool is eaten.
If the toadstool is eaten...
Before going east when the toadstool is eaten...
Every turn when the toadstool is eaten...

Because then you can reverse it, if necessary:

Now the toadstool is not eaten.

Thanks. I’ll look this over.

Almost certainly my tabs are off. I’ll check what I have when I get home. It may be also be that I have the colon/semi-colon configuration wrong too. I feel like I have an okay grip on the use of colons (from other languages) but I’m still unsure about the time for a semi colon or a period.

@Dizzydonut wrote a piece that bypassed the eaten situation altogether by making the stomach a container which I have been using to great effect but I will examine this as eating is definitely something the player will have to do later.

"Scenes with toadstools" by "Testa"


The sunny meadow is a room. "Bright, emerald sward shimmers in the sunlight, sloping downhill towards a cavelike entrance to the east."


The throne room is east of the sunny meadow. "A vaulted and lofty dome, it's not easy to tell if this place is natural or has been fashioned by deliberate intent."


A toadstool is an edible thing in the sunny meadow. "Glistening blue and green amidst the grass, a fine specimen of Royal Deathcap is growing here."

Understand "mushroom", "fungus/fungi", "deathcap" or "royal deathcap" as the toadstool.

After eating the toadstool:
	now the printed name of the toadstool is "partially chewed toadstool";
	now the toadstool is in your stomach; [I didn't want to mess around with the default eating action]
	now the toadstool is handled;
	say "You gulp the slimy thing down, too nauseated to chew it thoroughly.";

Your stomach is a container.
Vomiting is an action applying to nothing.

Understand "vomit", "puke", "purge", "throw up" as vomiting.

Report vomiting when nothing is in your stomach:
	say "You retch, fruitlessly.";
	[default message]
	
After vomiting:
	say "You heave up [the list of things in your stomach].";
	now everything in your stomach is in the location.

	
Feeling bad is a scene. Feeling bad begins when the toadstool is in your stomach.

When feeling bad begins:
	say "You begin to feel ill. Perhaps eating that toadstool was a bad idea.";
	
[It's really easy to have things happen only during a scene --]
Every turn when feeling bad is happening:
	say "[one of]Ooo, you do feel strange[or]Your stomach aches[or]Spots shimmer before your eyes[stopping].";
	
Feeling bad ends happily when the time since feeling bad began is three minutes and the toadstool is on-stage.

When feeling bad ends happily, say "You feel considerably better." 

Feeling bad ends miserably when the time since feeling bad began is three minutes and the toadstool is in your stomach.
	

Slow poisoning is a scene. Slow poisoning begins when feeling bad ends miserably.

When slow poisoning begins:
	say "Spots dance before your eyes, and your lips feel numb. There's no hope for you now.";
	
[or PROHIBIT certain actions during a scene]
Instead of going when slow poisoning is happening, say "You feel too weak to travel.";
	
Slow poisoning ends when the time since slow poisoning began is two minutes.

When slow poisoning ends:
	end the story saying "You have been poisoned.";

Actually, because the toadstool is dealt with using an “After” rule, the “Carry Out” section of the Eating action (recall, Actions are divided into Check/Carry Out/Report stages) the action does get used, so it doesn’t bypass eating altogether. If you did want to not have any of the machinery of the Eating action involved in dealing with the toadstool, that would be a good candidate for an “Instead” rule.

Thanks for clarifying that. I’m happy with things the way they currently are, but there is something else that gets eaten in the story I’ll use the regular rule for.

Yes, I was thinking that the artificial “stomach” meant that only specific things would then respond to the vomit action. If the vomit action simply relocated everything in limbo to the location, the PC might end up throwing up some very odd things. (Could be quite funny, actually, I suppose: the old "I don’t remember eating that!" joke.) :laughing:

That’s great! There are other things that they could eat incidentally so I think I’ll do that with them as well, just for fun.

Going back to my original question, my thought was that, if the person ate the toadstool again, when they threw up the toadstool a second time it would would move to nowhere and the throwing up would introduce a piece of scenery called a dark stain, if that were possible.

Sure it’s possible. We just need to take advantage of Inform’s ability to remember past actions:

A very bad day in the meadow
"Scenes with toadstools" by "Testa"


The sunny meadow is a room. "Bright, emerald sward shimmers in the sunlight, sloping downhill towards a cavelike entrance to the east."


The throne room is east of the sunny meadow. "A vaulted and lofty dome, it's not easy to tell if this place is natural or has been fashioned by deliberate intent."

Your stomach is a container.


A toadstool is an edible thing in the sunny meadow. "Glistening blue and green amidst the grass, a fine specimen of Royal Deathcap is growing here."

The dark stain is nowhere. The initial appearance of the dark stain is "A patch of ground is stained, dark and unpleasant, as though someone in retching up something unwholesome has damaged themselves in doing so."

Check taking the dark stain:
	say "The stain is nothing more than a slimy residue." instead. 

Understand "mushroom", "fungus/fungi", "deathcap" or "royal deathcap" as the toadstool.



After eating the toadstool:
	now the printed name of the toadstool is "partially chewed toadstool";
	now the toadstool is in your stomach; [I didn't want to mess around with the default eating action]
	now the toadstool is handled;
	say "You gulp the slimy thing down, too nauseated to chew it.";


Vomiting is an action applying to nothing.

Understand "vomit", "puke", "purge", "throw up" as vomiting.

Report vomiting when nothing is in your stomach:
	say "You retch, fruitlessly.";
	[default message]
	
[Inform is smart enough that it automatically keeps track of actions the player has already done.]
After vomiting when the toadstool is in your stomach for the first time:
	say "You heave up [the list of things in your stomach].";
	now everything in your stomach is in the location.

After vomiting when the toadstool is in your stomach for the second time:
	say "You heave";
	now the toadstool is nowhere;
	now the dark stain is in the location;
	If your stomach contains something:
		say " up [the list of things in your stomach]";
	say ", your throat burns and dark, bloodied spittle hangs from your lips.";
	

[By default, scenes happen only once, and once they've concluded they will not fire again. If we want the toadstool to still have the same poisonous effect, then we need to make them "recurring" scenes. This means they are able to be triggered again. Unfortunately the starting condition "Feeling bad begins when the toadstool or the dark stain is in your stomach." is disallowed by Inform as being too complicated. So we have to tackle the problem differently, by adding rules to the vomit action, above.]
Feeling bad is a recurring scene. Feeling bad begins when feeling bad is not happening and slow poisoning is not happening and the toadstool is in your stomach. 

[note that now its a recurring scene we have to add extra conditions: "feeling bad is not happening" and "slow poisoning is not happening" otherwise it will restart every four turns!]

When feeling bad begins:
	say "You begin to feel ill. Perhaps eating that toadstool was a bad idea.";
	
[It's really easy to have things happen only during a scene --]
Every turn when feeling bad is happening:
	say "[one of][or]Ooo, you do feel strange.[or]Your stomach aches.[or]Spots shimmer before your eyes.[cycling]".;
	
[having [or] immediately follow [one of] means the first thing printed will be a blank. That way we don't print the first remark simultaneously with "You begin to feel ill..." We switch the comments from "stopping" to "cycling" otherwise the second time through the scene the player will only get spots before his eyes, which is boring. Extending the list with more entries would be better, of course.]
	
Feeling bad ends happily when the time since feeling bad began is four minutes and the toadstool is on-stage.
[I extended feeling bad by a turn to allow a little more leeway before dooming the player.]

When feeling bad ends happily, say "You feel considerably better." 

Feeling bad ends miserably when the time since feeling bad began is four minutes and the toadstool is in your stomach.
	

Slow poisoning is a recurring scene. Slow poisoning begins when feeling bad ends miserably.

Death is a man. The description of death is "A cowled and portentous shadow, growing ever more solid before your eyes." Understand "portentious" or "shadow" as death.

[The beginning and ending rules for scenes are fully-fledged and able to do anything that ordinary rules can also do. Here we use it to bring something onstage for the final scene.]
When slow poisoning begins:
	now death is in the location;
	say "Spots dance before your eyes, and your lips feel numb. There's no hope for you now.";
	
[or PROHIBIT certain actions during a scene]
Instead of going when slow poisoning is happening, say "You feel too weak to travel.";
	
Slow poisoning ends when the time since slow poisoning began is two minutes.

When slow poisoning ends:
	end the story saying "You have been poisoned.";

This, by the way, is another incentive to use the check/carry out/report system: when Report or After rules fire, Inform knows that the action has been successful, and so you’re able to distinguish between “the first time” and “the second time” a player successfully does some action. (Which might be very different from the number of times a player has attempted the aforesaid action.)

Instead rules, by contrast, always end with the result “failure” (because the player tried to do A, and B happened instead.)

It’s true that you can manually override an individual rule with the concluding statement “ends in success;” or “ends in failure” (caveat: I haven’t looked that up in the docs, that wording may not be right) but that’s one more thing to remember, and forgetting is likely to introduce a subtle and hard to find bug. Far better to work with the grain of the system than against it.

1 Like