I am having trouble with one of the most basic concepts in Inform7, creating a working door. I have looked at several guides etc, and they all form their doors the same way I do, but mine does not function how it should.
When in the game, I can go south which is where the door is, but I cannot type anything like “Go Bedroom Door” or “Go though Door”. I don’t know how to fix this as it gives no error when I type those things. Yet when I “Go South” it prints
(first opening Bedroom Door).
My code is as follows :
Bedroom Door is a door.
Bedroom Door is south of 1-1c and north of 1-2c.
1-1c and 1-2c are different rooms…
1-1c is the Bedroom.
1-2c is the Hallway.
I have tried commenting out all door extensions I am using before testing this to no avail.
The Goal: Be able to type “Go Door” or at least “Go Bedroom Door” to go through it instead of having to type “Go South”.
Thanks for any help,
I pasted in your code and it seems to work fine for me:
You can see Bedroom Door here.
go through door
You can see Bedroom Door here.
go bedroom door
You can see Bedroom Door here.[/spoiler]
Is that not what you wanted to happen?
Same here. The behaviour you want is the default behaviour. Maybe there’s an extension interfering? What extensions are you using? Could you try it in your code using RULES ON and/or ACTIONS ON?
EDIT - Hang on, “it gives no error when you type those things”? What does that mean, exactly? What does happen when you type GO DOOR in your example?
Thanks for all the replies everyone! I ran the diagnostics tools like Peter suggested and found that it was one of my rules that I thought was unrelated. Although now I don’t know how to fix that rule so it works without interfering with this function.
Instead of entering something (called B), if B is the Bed, move the player to the Bed.
Inform7 must be interpreting Bed as a shorthand reference to Bedroom Door, but I only want that to work in gameplay not in code.
Thanks again everyone, I’m getting there slowly…
No, that’s not what’s happening. The problem is that your instead rule will always fire when entering something. If the thing happens to be the bed, it moves the player there, otherwise it does nothing but still stops the default action because that’s what instead rules do.
You’ll have to make the rule more specific so that it’s triggered only when entering the bed:
Instead of entering the Bed:
move the player to the Bed.
That said, the entire rule should be unnecessary altogether because the standard library already handles enterable containers and supporters correctly. Would it work if you removed that rule and declared the bed enterable?
Yeah, a few people seem to encounter this kind of issue.
In general, if you want a rule only to apply to a specific case, don’t check for the case in an “If” statement in the first line of the rule; put the case in the rule heading.
So instead of:
Instead of jumping:
if gravity of the location is reversed:
it’s better to say:
Instead of jumping when gravity of the location is reversed:
…unless you’ve got other stuff for the rule to do when gravity of the location isn’t reversed. This means that the rule will only run if you need it; which is particularly important for Instead rules, because they will stop the processing of the action if they run at all (unless they use “continue the action”), whether or not the code in them does anything.
Is there some central repository of I7 programming tips where we could put something like this?
You could post a question to ifanswers.com/ and answer it yourself.
Thanks for the help everyone, I made the changes matt suggested and everything is running and functioning as intended (for) now.
I created an extension called “Easy Doors” which allows the creation of doors which do not require a map direction. It’s helpful if you want rooms crazy with doors.