Loads of questions

Hello there! I am new around here, so sorry if I mess anything up.

I have been learning Inform 7 for my college major project (Games Design), because I have a love of IF, and the creative writing side is the area of Games Design I want to go into. However, our class has not learnt Inform 7, so it is a major risk on my part. I have mostly been able to work through and around issues that arise, but I have a few I cannot seem to sort out. I will probably post on this forum often, so if anyone is really good at Inform and don’t mind me messaging them, please let me know!

Anyway, onto the issues and questions I have at this time:

I want to have the player be able to push a Werewolf (my game is about them and MC is being attacked). I think pushing is actually in Inform 7 though? I get a stock message of “The werewolf may not like that” instead of the text I want to be displayed. I tried making it its own action as well, to no luck. At the moment I have a work around with an action called “Off-pushing” but that requires the player to type “Push Werewolf off” or “Push off Werewolf” then simply “Push werewolf”.

Similarly, I also can’t get a code for standing up to work. Again it comes up with another stock message “But you aren’t in anything at the moment”. However, I cannot seem to get a work around for this to work, like I had done with pushing. All I want to happen is for the player to be “lying down” when he is attacked, and then a few turns later to be able to get up, displaying a bit more text. That’s it. Nothing too complex.

The final question I have at the moment is about descriptions. At the moment I have the werewolf, with the description of “A big brown wolf”. However, when he dies, I want that to change, as well as the name (From Werewolf to Dead Werewolf). I have the latter working with “now the printed name of the Werewolf is “Dead Werewolf”;” However “now the description of the Dead Werewolf is” or “The description of the Dead Werewolf is”) just comes up with errors. If I just have “now the description of the Werewolf is” it will change, however only if I type “Examine werewolf.” “Examine Dead Werewolf” comes back with “I don’t see such a thing.”

Thanks if anyone can help with any or all of these problems!

Post your code. Lot’s of people are here to help.

There are various tools you should know about for working out what’s going wrong with your code. Firstly, there’s the Index tab in the IDE, which gives you lots of information about the standard rules and the built-in actions, and also details of the world which the compiler has understood it from your code.

Secondly, there’s the testing commands (used when playing the compiled game in the IDE); the most useful are ACTIONS (which tells you how your commands are resolved into actions) and RULES (which tells you which rules are being checked). There are others; see Section 24 of Writing with Inform.

If you look at “pushing” in the Actions Index, you’ll see it’s in the section called “Standard actions which are checked but then do nothing unless rules intervene”. There are several check rules which can block a pushing action, and the one you’re running into is the “can’t push people rule”. You can block this with a line of code such as

The can't push people rule does nothing when pushing a werewolf.

But even if you get past the check rules, the pushing action has no effect unless you write rules for it, so you’ll need to write a “carry out pushing a werewolf” rule.

If you try a STAND UP command with ACTIONS on, you’ll find that STAND/STAND UP are aliases for the EXIT command, which isn’t what you want. So you’ll need to redefine it. You might want to look at the extension, Postures by Emily Short.

For the alive/dead werewolf, I’d recommend having two different objects: a “person” object for the living werewolf, and a “thing” (or maybe a “container”) object for the dead werewolf. At the critical moment, just move the living werewolf off-stage and bring in the dead one to replace it. But if you want to stick with what you’re doing at the moment, you could try something like this:

Understand "dead" as the werewolf when the printed name of the werewolf is "Dead Werewolf".

This will allow the player to type DEAD/DEAD WEREWOLF and be understood. It won’t let you refer to the werewolf as “dead werewolf” in your code, though.

“Pushing” is indeed a built-in action. You can work within its parameters.

One trick when playing the game in the IDE for testing is a command called “actions” When you type it in as a command, it will display the game showing every action Inform is performing in response to a command.

The easiest way to take care of one circumstance is to use an “instead” rule.

Instead of pushing the werewolf: say "The werewolf cringes back, 'Hey bub, don't be rude!'"

The problem with an instead rule is it overrides every other rule. Inform will check that the werewolf is indeed available to push, but in your case where you’ve killed the werewolf, it will still fire. We can use what the game told us - that the pushing action is blocked by the “can’t push people rule” to allow it in this circumstance.

[code]Forest is a room.

A werewolf is a man in forest.

The can’t push people rule does nothing when the noun is the werewolf.[/code]

“Nothing obvious happens.” is the default report response. The action worked, but we have no rules or responses specifically.

[code]Carry out pushing a person:
say “You give [the noun] a mighty shove.”

After pushing the werewolf:
say “The werewolf whines, ‘Hey, stop that!’”[/code]

Using “after” instead of “report” stops the action and runs before report rules so we don’t get “Nothing obvious happens.” Report rules do not stop the action and will all run in sequence.

Check out the rest of this and see if it helps:

[code] Forest is a room.

A person can be dead.

understand “dead” as a thing when the item described is dead.

A werewolf is a man in forest. The description is “[if dead]This is apparently an ex-werewolf.[otherwise]The werewolf menaces you![end if]”

The can’t push people rule does nothing when the noun is the werewolf.

Check pushing a dead person (this is the can’t push a dead person rule):
say “You nudge [the noun] with your toe. Yep, dead.” instead.

Carry out pushing a person:
say “You give [the noun] a mighty shove.”

After pushing the werewolf:
say “The werewolf cries in pain and collapses, dead from the humiliation you have caused it.”;
now werewolf is dead;
now the printed name of werewolf is “dead werewolf”.
[/code]

Similarly, we can figure out the problem with “stand” using the ACTIONS command:

And one extra flourish, since I called the werewolf something else when it’s dead:

understand "ex-werewolf" as the werewolf when the werewolf is dead.

Holy. I am so glad I came onto this forum, a lot more active than the reddit and other forums I have been trying, thanks everyone so far!

@DavidC will do in my next reply.

@jrb Cheers, will try that code for the dead werewolf in a few minutes! If not, I’ll just go around it with the other werewolf. Have one in a hidden area and move it into the scene, while removing the other from play.

@HanonO Holy code! Thank you so much. I feel really bad because that took you some time and between posting this thread and it getting approved I found out a way to do it. I simply had to include the line "understand “push [thing]” as off-pushing (off-pushing is my action name), and it worked. It was right under my nose! However I still cannot get Standing up to work, so if you have any idea on that, I would be so happy!

Code that I have for the standing up ( [] is in comments so not active, let me know if I need any of this active )

[Understand the commands “stand” and “sit” and “lie” as something new.

A posture is a kind of value. The postures are seated, standing, and reclining.

A person has a posture. The posture of a person is usually standing.

Understand “lie down” as lying down.

Understand “sit down” or “sit” or “sit up” as sitting down.

Lying down is an action applying to nothing.

Sitting down is an action applying to nothing. ]

up-standing is an action applying to nothing.
understand “stand” as up-standing.
understand “stand up” as up-standing.

After up-standing:
say “You push the dead animal off of you, but even then it was still as much of a struggle as it was beforehand. Getting up, you dust yourself off and almost instantly clasp your injury. The blood slowly trickling out. While it’s not too bad of an injury, it still hurts a lot and probably would be better if you bandage it up as soon as possible. You know that you have a bandage at home, so maybe you should head straight there. But maybe you should also thank the archer? After all, without him you might not be alive!”;
continue the action;

(Later on in code, before I want the player to stand up)

After going to Forest path North when WWattack is true:
now the description of Forest path North is “As you move down the path a little more, you suddenly hear a loud roar to your right. When you turn towards the bush, you see a flash of brown before your vision gets filled with the black dirt below. A cry of pain comes out as you quickly gather yourself, now having this massive beast on top of you. You scream out, only able to see its golden yellow eyes and its drooling saliva that is now pouring over your face as it roars out again. You have to push it off you!”;
[now the posture of the person who is the player is lying down;]

This is one of the best replies on this forum ever. This is how it should be done.

Okay, pushing and dead werewolf down. Just Standing. I now see the index, so thanks for that. Helps a lot, as sleeping was something I am going to need later on. I can’t seem to see the extension for Postures from Emily Short. I have some of her others but not that one. Any way I can get that or work a way around without it?

Also, David I agree. That was an amazing response and even though I found a way to fix it, it actually helped me learn a few things with the carry rule and also the actions listing.

And as I say that, I worked it out. Thanks to JRB and HanonO, I looked in the Writing new actions thread, and the LAST LINE was EXACTLY what I needed! How often can I post on the forums or shall I just keep this one going if I need any further assistance? Thank you all so much!

You could use “Instead of exiting when WWAttack is true…” This piggybacks off the existing action that uses the command “stand” and is faster and simpler than making your own action.

I would keep creating new posts with specific questions, but also search for your question on the forum first. Someone is likely to have asked before.

You can also try (with varying success), ifMud on channel #I7.

The forums are free to use, so ask away. You can use this thread for your particular series of questions, or if you have a specific issue, we always appreciate informative topic titles in case people are searching for answers to the same issue.

There has been a lot of good advice given over the years, so don’t hesitate to search for past topics on your issue as well. We will occasionally tidy threads if they’re posted in the wrong place, but that’s not a jailable offense (yet-muahaha :smiling_imp: )

(and thanks for the compliment, DavidC!)