Killing and Before Rule

I am brand new to IF and I need some help. I am a college student and my teacher assigned my group to make an IF project. It is about an undercover agent trying to catch a “bad guy” in an airport. For my part of the group, I am in a control tower and have to access the flight manifest on the computer. Basically, I need to kill three guys. Check each computer and find the document. But, I can’t check the computers until each are killed.

So far, I have:

The Control Tower is a room. “After walking up several flights of steps, you are now at the top of the control tower. The tower is surrounded by windows. There are three air traffic control men in the room: John, Alex, and Patrick. You know their names from nameplates on their desks. Each person has a computer in front of them. To the west back down the stairs is the Gate.”
The player carries a knife and a camera.

John is a man in the Control Tower. “John is working to the left of you at a desk.” The description of John is “John is wearing a headset.”
Alex is a man in the Control Tower. “Alex is in the middle working in front of you at a desk.” The description of Alex is “Alex is wearing a headset.”
Patrick is a man in the Control Tower. “Patrick is working to the right of you at a desk.” The description of Patrick is “Patrick is wearing a headset.”

Understand the command “kill” as something new.
Killing it with is an action applying to two things.
Understand “kill [someone] with [something]” as killing it with.
Understand “murder [someone] with [something]” as killing it with.
Understand “stab [someone] with [something]” as killing it with.
After killing John, say “You have murdered John! His computer is now accessible.”.
After killing Alex, say “You have eliminated Alex! Feel free to use his computer.”.
After killing Patrick, say “You have sliced Patrick to shreds! You can now access his computer”.

But I get problem that says: Problem. You wrote ‘After killing John’ , which seems to introduce a rule taking effect only if the action is ‘killing John’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

I need help learning how to make it so I need to kill each person before examining computers. And I need help having three of the same(similar) object in the same room. If anyone has any ideas, please share. Thank you.

Hello there. The reason the lines such as “After killing John” fail is because your killing action applies to two things. Your rules need a little extra to reflect that.

Since your action is “killing someone with something”, rules have to refer to both of the nouns involved in the action.

This will work:

After killing John with something, say "You have murdered John! His computer is now accessible.".

But be careful! This code alone is will allow you to attack with nearly ANYTHING. This includes, for example, the ability to kill Alex with Alex. In order to avoid that, you’ll have to write up some new code which will limit the items usable as weapons. Being the flexible language Inform 7 is, there are quite a few ways to do this. Let me know if you’re curious about a few examples.

The same could be said for your scenario regarding computer access–it can be done in a lot of ways. Here is a strategy off the top of my head: Create a ‘corpse’ object for each of the three victims. After killing one of them, replace them with the corresponding corpse. Then make either a “check” or “before” rule that blocks access to the computer if the corpse is not present.

There is a thing called Alex's corpse.
There is a thing called Alex's computer in Control Tower.

Before doing anything to Alex's computer: if Alex's corpse is not in the Control Tower, say "You'll have to get rid of Alex first." instead.

After killing Alex with something:
	say "You have eliminated Alex! Feel free to use his computer.";
	remove alex from play;
	now alex's corpse is in control tower.

I hope this helps a little. Let me know if there are any other concerns.

This was helpful. I realized that my character should be more heroic and not killing people. So I changed my code to this:

Understand the command “tie up” as something new.
Tying Up with is an action applying to two things.
Understand “Tie up [someone] with [something]” as tying with.
After tying up John with, say “You have tied up John! His computer is now accessible.”.
After tying up Alex with, say “You have secured Alex! Feel free to use his computer.”.
After tying up Patrick with, say “You have tied up Patrick! You can now access his computer.”.

But it is giving me an error in the third line->
Problem. You wrote ‘Understand “Tie up [someone] with [something]” as tying with’ : but ‘understand … as …’ should be followed by a meaning, which might be an action (e.g., ‘understand “take [something]” as taking’), a thing (‘understand “stove” as the oven’) or more generally a value (‘understand “huitante” as 80’), or a named token for use in further grammar (‘understand “near [something]” as “[location phrase]”’). Also, the meaning needs to be precise, so ‘understand “x” as a number’ is not allowed - it does not say which number.

Any ideas how to fix that? If I just want to tie him up, how would I make it so you have to do this before being able to use the computer?

In this line:

Understand "Tie up [someone] with [something]" as tying with.

you left out the “up” in “tying up with” at the end.

I also get a problem with the last three lines:
Problem. You wrote ‘After tying up John with’ , which seems to introduce a rule taking effect only if the action is ‘tying up John with’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

Not quite sure what is wrong?

I believe the problem is that your definition specifies that you have to “tie [someone] up with [something]” whereas your code for “After tying up John with” does not specify an object/thing of any kind.

Try

After tying up John with something, say "You have tied up John! His computer is now accessible.".

You need to tell where the first noun should be placed with the word “it”.

Tying up it with is an action applying to two things.
Understand "Tie up [someone] with [something]" as tying up it with.

After tying up John with, say "You have tied up John! His computer is now accessible.".

You don’t need the “understand … as something new” line because the new grammar doesn’t overlap with an existing command.

That worked Juhana, thank you so much for your help. Now, if I wanted to make it so my character cannot view the computer without tying up each person, how would I do that? I also want to make it so once a player is tied up, he stays tied up in the room? Also, I was wondering how you make it so he can only tie up a person with a rope, not like a knife or camera as well. So far for my section of the project, I have.

The Control Tower is a room. “After walking up several flights of steps, you are now at the top of the control tower. The tower is surrounded by windows. There are three air traffic control men in the room: John, Alex, and Patrick. You know their names from nameplates on their desks. Each person has a computer in front of them. To the west back down the stairs is the Gate.”
The player carries a rope.

John is a man in the Control Tower. “John is working to the left of you at a desk.” The description of John is “John is wearing a headset.”
Alex is a man in the Control Tower. “Alex is in the middle working in front of you at a desk.” The description of Alex is “Alex is wearing a headset.”
Patrick is a man in the Control Tower. “Patrick is working to the right of you at a desk.” The description of Patrick is “Patrick is wearing a headset.”

Understand the command “tie up” as something new.
Tying up it with is an action applying to two things.
Understand “Tie up [someone] with [something]” as tying up it with.
After tying up John with, say “You have tied up John! His computer is now accessible.”.
After tying up Alex with, say “You have secured Alex! Feel free to use his computer.”.
After tying up Patrick with, say “You have tied up Patrick! You can now access his computer.”.

Any ideas?

This is pretty straightforward:

Check tying up someone with something: if the second noun is not the rope, say "You can't tie someone up with that." instead.

“The second noun” is the second thing involved in the action – here if you have “tie Alex up with camera,” the noun is Alex and the second noun is the camera. The word “instead” in this command means that this rule stops the action (in fact, there’s a phrase “stop the action” that has the same effect, but it has to be on its own line of the code), so none of your other rules will fire.

The “check” rules run before the carry out, after, and report rules (among others), so when a check rule stops an action it prevents any of the other rules from running. (You can look at the chapters in the documentation on Advanced Actions and Rulebooks to see more about the order in which the rules run, and what’s going on here.)

In your other thread I mentioned something similar for killing people, but you can try defining a property that says whether people are tied up or not, and then you can block examining a computer when its operator isn’t tied up.

[code]A person can be tied or untied. A person is usually untied.
Carry out tying up a person with a rope:
remove the second noun from play; [you don’t want to still be holding the rope after you tie someone up with it. Remember, the “second noun” is the rope.]
Now the noun is tied. [Note that “the noun” is the person you’re tying up. You might also want to block the player from doing this to anyone who isn’t an air traffic controller. It might work to define an air traffic controller as a kind of person.]

Check examining Alex’s computer when Alex is untied: say “Alex moves to block you from seeing his computer.” instead.[/code]

You’ll also want to change their descriptions and initial appearances:

 Alex is a man in the Control Tower. "[if untied]Alex is in the middle working in front of you at a desk.[otherwise]Alex is in the middle, tied to his chair." The description of Alex is "[if untied]Alex is wearing a headset.[otherwise]Alex is tied to his chair and looks somewhat annoyed."

You may notice that I said “a rope.” Technically it doesn’t make any difference to the code whether you say “a rope” or “the rope,” but in this case the player would need three ropes, one for each controller. You can take care of that thus:

A rope is a kind of thing. The player carries three ropes.

Another perhaps more elegant solution would be to treat the player’s rope as an infinite supply, so that they can just break off a length to tie someone up and still have the rope left. If you want to do that, you could just delete the “remove the second noun from play” line in the rule above, but you should also change your text to make clear what’s going on. (Say something like “You break off a length of rope and tie John up.”)

Wow this is is extremely helpful. I am learning so much, and I have been able to apply this to other parts of my game in other rooms. I have test played it, and I realized you can tie a person multiple times? How would you write a rule to make it so you can only tie once?

Ah! Good catch! Write another check rule that tests whether the noun is tied.

Something like this?

Check tying up a person with a rope when Alex is tied: now the noun cannot be tied again.

But it produces an error.

No, you want to model it on the check rule I wrote before. Inform doesn’t understand “now the noun cannot be tied again” – just tell it to stop the action (with “instead”) and say an appropriate message. So:

Check tying someone up with a rope when the noun is tied: say "[The noun] is already tied up!" instead.

Remember, “the noun” is the first thing involved in the action – here, the person that you’re tying up. That “[The noun]” inside the quotation marks is a text substitution – it prints out whatever the name of the noun is. And “instead” means that this rule interrupts the action, so the “carry out” and “after” rules don’t run.

(By the way, you could change the “after” rules to “report” rules and it would work just as well.)

This was my code:
Understand the command “tie up” as something new.`
Tying up it with is an action applying to two things.
Understand “Tie up [someone] with [something]” as tying up it with.

But it doesn’t seem to be working anymore. Producing this problem.
Problem. You wrote ‘Understand “Tie up [someone] with [something]” as tying up it with’ : but ‘understand … as …’ should be followed by a meaning, which might be an action (e.g., ‘understand “take [something]” as taking’), a thing (‘understand “stove” as the oven’) or more generally a value (‘understand “huitante” as 80’), or a named token for use in further grammar (‘understand “near [something]” as “[location phrase]”’). Also, the meaning needs to be precise, so ‘understand “x” as a number’ is not allowed - it does not say which number.

Nevermind to that last one.

Something like this should do it:

Check tying up a person with something: if the noun is tied, say "[The noun] is already tied up." instead.

or even:

Check tying up a tied person with something: say "[The noun] is already tied up." instead.

You may also want to add a check rule to prevent the player from tying up himself (or other random people), or at least make the game react to it appropriately. (Successfully tying up yourself in the middle of a mission sounds like “end the story” time to me…)

Ps. Adding a DTPM rule should make the interface a bit more friendly:

Does the player mean tying up a person with a rope: it is likely.

This way, typing just “tie up alex” will automatically select the rope, if the player has any.