Two seperate events resulting in death?

I’m very new Inform 7 and am currently stumped.
I want it so that if the player is to do two actions (drink alcohol and take pills) then the game will end in death.
I have tried several methods that in theory should have worked fine but am always responded with an error message of some kind.

Can someone please enlighten me as to how I would go about doing this? Thanks! :smiley:

Could you post some of your code? That might make it easier to point out what you ought to change / see what you don’t understand. :slight_smile:

This is one of the many methods I have tried. Is there a particular problem with this or am I completely off?
If this is completely unfixable, I’ll post one of the tried methods.

[code]Instead of drinking can of beer:
remove can of beer from play;
Say “You guzzle down the beer. That hit the spot.”.

Instead of eating the pill:
Say “You pop the pill in your mouth and swallow it.”.

To determine whether poisoned is met:
if player has eaten pill; decide no;
if player has drunk can of beer; decide no;
decide yes.

If poisioned is met:
end the game in death.
[/code]

Hi Sleaze,

That’s something we can work with.

First things first. We need your game to consider whether the player is poisoned. Right, your code is never going to do that. The part starting “If poisoned is met:” is never going to be executed by your program, since it is not contained in a rule. (In fact, it probably won’t compile.)

So what we need to do is incorporate it in a rule, and the easiest thing would be to incorporate it in an Every turn rule. That way, the game will check whether the character is poisoned every turn. So we get something like this:

Every turn: if poisoned is met: end the game in death.

(Of course, you’ll probably want to add a line where the game actually tells you what is happening! But let’s get the basic functionality first.)

The second problem is that your if’s don’t really seem to work. I wonder if they even compile? Anyway, as you have written it, it appears as if you want to decide no if the player has eaten the pill, decide no if he has drunk the beer, and decide yes if he hasn’t done either. But I thought you wanted to have the player be poisoned when he did both, not when he did neither of those actions? You would need something like this:

To determine whether poisoned is met: if player has eaten pill and the player has drunk the can of beer: decide yes; decide no.

Now I’m not 100% sure that this will work, because I don’t have Inform 7 installed here and cannot try it. I wonder whether drinking is a standard action? If not, you’d have to create it first.

Be sure to try this stuff out and post again; I’ll try to take another look when I have my Inform 7 and Inform 7 documentation at hand. :slight_smile:

Thanks for your help, Victor
Its still not quite working. First off yes, you are right that I had my yes and nos turned around there xD It was late and I guess I got confused and yeah I already made drinking an action.

Upon first entering it I got:

Problem. In the sentence 'if player has eaten pill and the player has drunk the can of beer begin'  , I was expecting that 'player has eaten pill and the player has drunk the can of beer' would be a condition. It didn't make sense as one long phrase, but because it was divided up by 'and'/'or', I tried breaking it down into smaller conditions, but that didn't work either. 'player has eaten pill' did not make sense; 'the player has drunk the can of beer' did not make sense; so I ran out of ideas.

Problem. The line 'decide yes'   seems to be a way that the phrase you're defining can come to an end, with a phrase to make a decision, but it should always end up with no value resulting.

Problem. The line 'decide no'   seems to be a way that the phrase you're defining can come to an end, with a phrase to make a decision, but it should always end up with no value resulting.

Problem. In the sentence 'if poisoned is met begin'  , I was expecting to read a condition, but instead found some text that I couldn't understand - 'poisoned is met'.

I tried messing around with it after that but everything I tried would just create yet another error.
I am willing to take another route in doing this all together if there is a simpler way to go about this.

Here is some code that works (I made the bear edible rather than drinkable, for simplicity, I’m sure you can fit it into your own game):

[code]“Death by overdose” by Victor Gijsbers

Hades is a room.

The beer is in Hades. The beer is edible.

The pill is in Hades. The pill is edible.

The overdose counter is a number that varies. The overdose counter is 0.

Instead of eating beer:
remove beer from play;
increase overdose counter by 1;
Say “You guzzle down the beer. That hit the spot.”.

Instead of eating the pill:
remove pill from play;
increase overdose counter by 1;
Say “You pop the pill in your mouth and swallow it.”.

To decide whether poisoned is met:
if the overdose counter is 2:
decide yes;
decide no.

Every turn:
if poisoned is met:
end the game in death.[/code]

One problem with your original code was that it said “to determine whether” where it should have said “to decide whether”. The other problem was with the conditions… apparently, “player has eaten the pill” is not something Inform 7 can understand. You can see how I made my own conditional in the code above.

By the way, this code could of course be simplified by turning the last two paragraphs into:

Every turn: if the overdose counter is 2: end the game in death.

Hope this helps. :slight_smile:

Worked like charm. Thanks a ton.
I owe you one, man. :wink: