How can I kill the player?

I’m new to IF games as well as programming them and I’m wondering how I would go about killing the player. I’ve read the manual and can’t find it anywhere in there.

Thanks in advance,

Carry.

Used to be you would say something like this:

Crippen's Bakery is a room. A poisonous cake is an edible thing in Crippen's bakery. Instead of eating the poisonous cake: say "That was dumb."; end the game in death.

Now the preferred way to do it is to say “end the story,” thus:

Crippen's Bakery is a room. A poisonous cake is an edible thing in Crippen's bakery. Instead of eating the poisonous cake: say "That was dumb."; end the story saying "You have died".

And of course you can change what’s in the quotes to a more, um, flavorful death message if you like.

When I need to kill the player, I generally use a pointed stick.

OK, I intend on killing the player with a pack of wolfs, how could I do that?

Crippen's Bakery is a room. A poisonous cake is an edible thing in Crippen's bakery. Instead of eating the poisonous cake: say "As soon as you touch the cake a pack of ravenous wolves crashes into the bakery and devours you!"; end the story saying "You have died".
But seriously, you need to be a bit more specific. What have you tried and what kind of situation are you thinking of exactly?

Ahem, you should make this “Instead of taking the cake,” or “get cake/eat cake” will yield an incongruous message.

…but yeah, it depends on what you specifically want to do.

I have a forest, ‘Northern Forest’ it’s call, and I just want the player to die if and when he/she enters it. But I think it would be better if it only happened say…10% of the time? I don’t know if you can do that…

Sure, that’s no problem:

[code]Safe Meadow is a room. “This meadow is entirely safe. The forest to the north is reportedly infested by dangerous wolves.” Northern Forest is north of Safe Meadow. “This forest looks very dangerous and probably wolf-infested!”

After going to Northern Forest:
if a random chance of 1 in 10 succeeds:
say “A ravenous pack of wolves eats you!”;
end the story saying “You have died”;
otherwise:
continue the action.[/code]

“Continue the action” is necessary because, without it, the “after” rule will interrupt the stuff that usually goes on after the player goes. In particular, without it the game won’t print the name and room description of the Northern Forest. (An “after” rule might not be the best way to do this; more experienced folk might be able to say.)

And, as in this example, it’s only fair to the player to warn them about the wolves before they go to the forest.

Did you read the Inform manual? It has sections on doing things at random. Trying to write a game without working through at least the first half of the manual first is not a good idea.

I know, I briefly read it, and have referred to it as necessary. But really, what are the forums for? For helping noobs like myself learn.

Next time I’ll try not to be so quick on coming to the forums for help.

Also thank you to everyone who helped me here.

Actually, I’ve found that on this forum, someone will usually answer ANY question, no matter how basic. So don’t be afraid to ask. The documentation is notoriously unhelpful, which is a shame for something created by and for writers. But unfortunately the language is still under development and the creators don’t want to waste time updating documentation for something that might change again a few more times. Personally, I think asking questions here is a good way to show the people involved what areas of the documentation need more work.

I think the bigger issue in this case was that your original question was not specific enough.

The forums are a great resource, and I think you should feel free to ask questions - but before you do, think about what you want to have happen.

Your initial question was sort of equivalent of asking “how can I cook?” There’s eighteen bazillion ways that can go, so even professional chefs can’t help you much unless you clarify.

The most helpful thing would be a blow-by-blow of what you want to happen internally, ie “when Bob gives John the bomb, I want him to die, ending the game” or “I want the game to tell the player he’s dead, and move him to the Graveyard, where he wakes as a zombie and has a new set of actions”. If you’re not sure what’s happening internally, write a transcript. Or write a scenario, and ask for advice.

Otherwise, you’re going to be frustrated, because we can tell you how to cook an omelette, or a stew, or a delicious raspberry gelatto, but those aren’t necessarily good responses to vague inquiries.