Hey I need help with some code. What i want is when a player enters a room called “Drain Pipe” I want them to be killed but I don’t know how to kill a player when they enter a room or do a specific action. Also does anyone have any kind of puzzle that they can give me an example of as well as an example of a door with a lock?
Section 11.6 of the Recipe Book has extensive treatment on endings and death. What you want looks something like this:
After entering Drain Pipe:
say "The current here is calm enough that you're able to tread water. Unfortunately, it is immediately downstream from the peanut-butter factory, and you are deathly allergic.";
end the story saying "You have died";
But you might not want an ‘after’ rule, since that will do all the normal behaviour first: you might prefer an Instead rule, like this specific-action example:
Instead of jumping when the current scene is Dance Contest and the dramatic intensity is 11:
say "You attempt a dynamic split-pike-to-somersault. But when you are meant to be crunking, this level of gymnastic precision looks aloof and pedantic. Also you flub the landing and do your knee a mischief. The chorus of disapproval mounts, and cannot be quelled.";
end the story saying "You will never live this down";
You wrote ‘After entering Drain Pipe’ , which seems to introduce a rule taking effect only if the action is ‘entering Drain Pipe’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.
Problem. In ‘After going to Drain Pipe’ , I tried to read a description of an action - a complicated one involving optional clauses; but ‘Drain Pipe’ wasn’t something I recognised.
See the manual: 12.10 > Action variables
Problem. In the sentence ‘After going to Drain Pipe’ , ‘Drain Pipe’ seems to be intended as something the player might be going to, but it doesn’t make sense in that context.
See the manual: 7.14 > Going by, going through, going with
Problem. You wrote ‘After going to Drain Pipe’ , which seems to introduce a rule taking effect only if the action is ‘going to Drain Pipe’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.
That should work. Can you post the relevant section of your code so that we can see what the problem is?
(In general, posting the code is much more helpful than posting the error messages. My best guess is that you haven’t defined Drain Pipe yet, and you need to move the after-going code to after you’ve defined Drain Pipe.)