Basics (Need Some Help I7)

Works perfect thanks :slight_smile:

My room that transfers my player to another room is still giving me problems. How would I go about using this line of code…

after going to Memory Of Father Leaving: move player to Esher's Cabin.

and still displaying description of the first room. As it is the player is transferred, but the rooom descriptino is skipped…

Did you try “Every turn when the player is in Memory of Father Leaving…”? That seems like it should do it (though there may be some timing issues.) Actually “Every turn when the location is Memory of Father Leaving” might be better; the location is the room where the player is (techically the player isn’t “in” the room if he’s, for instance, on a supporter in the room).

That worked out perfect. It’s only ever going to be entered once, but it does the trick…

I find with the documentation it gives the simplest answers, but not really what I’m looking for, lol…

do you have any other book suggestions? I think there was a couple suggested on the first page. I’m gonna go back, and take a look.

Erg. I’m having a bit of trouble with a door. It’s one that the player can’t pass through unless they’re wearing a cape.

Esher's Door is a door. Esher's Door is north of Esher's Cabin and South of Outdoors. Esher's Door is scenery. Esher's door is closed. before going through Esher's Door: if Esher's Door is closed; if the player is wearing Esher's Cape; say "You step outside". otherwise if the player is not wearing Esher's Cape: say "You decide not to go outside without your cape because of the story.".

I get this error.

The sentence ‘Esher’s Door is north of Esher’s Cabin and South of Outdoors’ appears to say two things are the same - I am reading ‘Esher’s Door’ and ‘South of Outdoors’ as two different things, and therefore it makes no sense to say that one is the other:

The capital S in “south of Outdoors” confuses Inform.
Make it a lower case s and it’s gonna work (supposing you have a room called “Outdoors” rather than “South of Outdoors”).

Thanks, didn’t notice that error, but I’m still getting another one. It’s something to do with puncuation…

this is the new code.

Esher's Door is north of Esher's Cabin and south of Outdoors. Esher's Door is a door. Esher's door is closed. before going through Esher's Door: if Esher's Door is open; if the player is wearing Esher's Cape; say "You step outside". otherwise if the player is not wearing Esher's Cape: say "You decide not to go outside without your cape because of the storm.".

new error is.

The sentence ‘otherwise if the player is not wearing Esher’s Cape’ appears to say two things are the same - I am reading ‘otherwise if the player’ and ‘not wearing Esher’s Cape’ as two different things, and therefore it makes no sense to say that one is the other:.

could you possibly clearify the difference between : and ; as a side note?

Also the before rule needs to be properly indented and punctuated.
The rule preamble (the name etc. of the rule) should end in a colon.
Conditions (if, else, and otherwise) should end in a colon, too.
All other lines should end in a semicolon.
Except the last one, which can end in a full stop instead.
Indentations represent the scope (so to speak) of the conditions: a condition holds for everything that is further indented than itself.

Before going through Esher's Door: if Esher's Door is closed: [colon] if the player is wearing Esher's Cape: [colon] say "You step outside."; [semicolon] [here ends the condition about wearing the cape] otherwise if the player is not wearing Esher's Cape: say "You decide not to go outside without your cape because of the story." [here ends the condition about *not* wearing the cape] [here ends the condition about the door being closed]

Also, you should make that an instead rule, instead. Otherwise, when a player tries to go through the door, your before rule will run first (telling him he can’t leave without the cape) and then the ordinary rules for going through doors will also run (letting him out anyway).

Check and Before rules continue the action by default. Using an Instead rule is one alternative, but I like check rules. If you use a check or before rule, you have to say “stop the action,” or begin or end a statement with “instead” to make the action stop. If you use an Instead rule, you have to say “continue the action” to let it continue as normal.

A few suggestions:

First, “otherwise if the player is not wearing Esher’s cape” is redundant unless the first part of the if statement changes whether or not the player is wearing the cape. A simple “otherwise” will do. If it’s not redundant, consider removing the word “otherwise.”

Second, I’d probably make this a check rule rather than a Before or Instead rule. Then the standard rules will handle checking whether the door is open or not. If you don’t use an Instead rule, though, you probably want to put the “you step outside” message into an After rule so it appears at the right time. You can do it all with an Instead rule, but then you have to do the open-door check yourself.

Third, you’re going to get the message “you step outside” every time you go through the door, even when you’re going inside. You might want to change that.

[code]Esher’s Door is a scenery door. It is north of Esher’s Cabin and south of Outdoors.

Check going to Outside through Esher’s Door:
if the player is not wearing Esher’s Cape:
say “You decide not to go outside without your cape because of the story.”;
stop the action.

After going to Outside through Esher’s Door:
say “You step outside.”;
continue the action.
[/code]

Okay, here’s what I have…

Before going through Esher's Door: if Esher's Door is closed: if the player is wearing Esher's Cape: say "You open the door and step outside"; otherwise if the player is not wearing Esher's Cape: say "You decide not to go outside without your cape because of the storm.".

I fixed a typo realized I had story instead of storm there, lol.

is that right?

also I haven’t gone about creating the cape in the room yet, is that why I get these errors…

:laughing: Aha - storm makes a lot more sense!

Why not write yourself a little test script? Something like:

Test me with "n/wear cape/n/remove cape/s"

Then you’ll know if your game is doing what you expect. It looks to me like you’re still not stopping the action, and you’re still saying “you step outside” even when you’re going inside, but that’s the sort of thing test scripts are good at catching.

It’s simple to check:

Esher's cape is a wearable thing in Esher's Cabin.

The quickest way to fix something when you think you know the problem is to try it out. Then you’ll see. It certainly looks like the problem to me.

Yup. I’ve been playtesting all along…which brought up another issue…

here’s my code for that part of the game.

[code]Before going through Esher’s Door:
if Esher’s Door is closed:
if the player is wearing Esher’s Cape:
say “You open the door and step outside”;
otherwise if the player is not wearing Esher’s Cape:
say “You decide not to go outside without your cape because of the storm.”.

[Room Descriptions In Chapter 1 - Esher’s Island]

[Things in Chapter 1 - Esher’s Island]

Esher’s chest is a closed openable container in Esher’s Cabin.

Esher’s cape is a thing. Esher’s cape is wearable. Esher’s cape is in Esher’s chest.
[/code]

The issue is. Nothing is stopping the player from going outside…he’s able to do it with or without the cape, lol.

just look at it I’m thinking it’s because I’m using the before rule…should that be something else?

I answered that question in one of my earlier posts, when I discussed the differences between Before, check, and Instead rules, and the need for “stop the action” and “continue the action.” Did you miss it?

A harder to spot problem is that the indentation of the rule as you have it, correlates the “otherwise” with the first “if” (the “if the door is closed”) rather than with the second “if” (the “if the player wears the cape”). Which means that the rule will say “You open the door and step outside.”, if and only if BOTH the door is closed AND the player wears the cape; and it will say “You decide not to go outside without your cape because of the storm.”, if and only if BOTH the door is open AND the player doesn’t wear the cape.
If the door is closed but the player doesn’t wear the cape, the rule will do nothing. And if the door is already open and the player does wear the cape, the rule again won’t do anything.

A second subtle thing is that you should keep the full stop inside the quotation marks of “You open the door and step outside.” (and end the whole line with a semicolon outside the quotation). That full stop ensures that a line break is printed after the sentence.

Also, if you won’t use capmikee’s suggestion for rules (which I recommend you to do), your before rule needs the line ‘stop the action;’ after the line ‘say “You decide not to &c.”;’ (or if you make it an instead rule, it would need the line ‘continue the action;’ after the line ‘say “You open the door &c.”;’).

I’m a big fan of having a different rule for each case instead of one rule with complex control structures. It makes the code easier to read (YMMV), maintain and organize, and you rarely if ever need to use “stop the action” or “continue the action”.

[code]Before going through closed Esher’s Door when the player is wearing Esher’s Cape:
say “You open the door and step outside.”

Instead of going through Esher’s Door when the player is not wearing Esher’s Cape:
say “You decide not to go outside without your cape because of the storm.”[/code]

Yeah, that does seem easier, lol…

capmikee, sorry, I missed that post all together, but I went back to read it. Certianly helpfull…

Where can I find more information on the proper spacing of control structures?

Felix, I’m having a hard time understanding that at all, haha. sorry.

I think it’s because I need to learn more about control sturctures, and indentation in general.

All the more reason to go by Juhana’s wise suggestions. :slight_smile:
(In my opinion, that kind of solution is much more Informish than the other ones discussed in this thread.)

See the built-in documentation chapter 11 (“Phrases”).
(When-clauses in rule preambles are discussed in chapter 7.12.)

I’m working on a set up cupboards in Esher’s Cabin. I want them to contain things that the player can’t take. What’s the best way to do this? having each thing be it’s own thing? or by making whats in the cupboard scenery…but then I run into the problem of if the player looks in the cupboards sees this scenery, and types take…they’ll get you dont see any such thing, or something like that…

I could make a thing for each thing…like Esher’s cups, Esher’s plates, Eshers utencils, and what not…

also…is there any easy way to tell inform not to display whats in the room?