New here. I figured out a lot but still need help trying to figure out how do certain things

Sorry if this is in the wrong forum. If it is please let me know where I should post this instead. There are two things I mainly want to do at this point that are obstacles for me.

One is have a numbered padlock which a player would have to provide the code to unlock the door. I already know about basics of making doors, locking doors but only really how to do so with keys.

The other thing is a place where the player would have to put a ladder they could pick up from a location against a tree in order to move up from an area. I have looked at the “if” commands but being new to this I can’t quite get it to work. I already have the tree as an object in the particular place. I already have a “instead” condition preventing the player from moving up originally.

Instead of going up in The Eastern Side of the House, say “The Tree’s branches are too high to reach while the trunk is too thick to climb.”

Basically I need to know how to use something on something in order to change something, in this case, allowing the player to move up once the ladder is “used on” “placed on/against” the tree.

I’ve read all the main rules but right now it’s so much that it’s overwhelming. I learned a lot by going step by step but I need help here.

Welcome Zack! This is the right place to ask.

For the first one, you could start by looking at the example Safety in the Recipe Book: http://inform7.com/book/RB_9_2.html.

One thing is that that technically doesn’t use the “locked” property. You can do something similar by making the door locked, and having it unlock when you enter the proper combination:

Lobby is a room. The iron door is a door. The iron door is south of lobby and north of vault. The iron door is locked. The description of the iron door is "[If locked]It seems to be locked with a padlock[otherwise]The padlock is now unlocked[end if]."

A padlock is part of the iron door. The padlock can be closed. The padlock can be openable. The padlock is closed. The padlock is not openable. The description of the padlock is "You can SPIN it to a four-digit number."

Spinning it to is an action applying to one thing and one number. Check spinning it to: if the noun is not the padlock, say "[The noun] does not spin." instead. 

Report spinning it to: say "Click! and nothing else happens."

Understand "spin [something] to [a number]" as spinning it to.

After spinning the padlock to 1384: now the iron door is unlocked; say "Clonk! and the padlock unlocks."

The “locked” property prevents us from opening the door in the standard way–but there’s no matching key, so there’s nothing that the player can unlock the door with. Instead, we have the rule for entering the correct combination change the door to be unlocked (that’s what “now the door is unlocked” does).

Hope this is useful!

You can add conditions to rules to define when they apply and when they don’t. Here, if you disable your Instead rule then the move would be allowed.

One quick answer is if you don’t especially care how the ladder got there (i.e. drop ladder in the right room is considered an acceptable use of the ladder against the tree, but merely carrying the ladder is not):

Instead of going up from The Eastern Side of the House when the ladder is not in the location:
	say “The Tree’s branches are too high to reach while the trunk is too thick to climb.”

You could enhance this a bit by making the player automatically use the ladder if they’re carrying it, by adding:

Before going up from The Eastern Side of the House when the ladder is carried:
	now the ladder is in the location;
	say "(first placing the ladder against the tree) [command clarification break]".

But there’s other ways to do things as well. If merely dropping the ladder isn’t enough and you want the player to specifically put the ladder against the tree – well, the first place to start is to look in the Index at the Actions tab and see if any of the existing actions or Commands seems suitable for the action you’re trying to use. If it is, then you can define a rule for it; if not, then you might need to make a new action. You can see an example of making a new action in the reply above.

As for how to tell the difference between a ladder that has been properly placed (whichever action is used for that) and one that has merely been dropped: usually the best way is to define a new either-or property on the object in question (or something else nearby that seems appropriate):

The tree can be ladder-adjacent.

(Putting it on the tree rather than the ladder seems appropriate in case the ladder can be placed against other things elsewhere.)

After declaring this, you can now ask is the tree ladder-adjacent and declare now the tree is ladder-adjacent and so forth. Set it when your placement action occurs and remove it if they take the ladder again.

(There’s many many other ways to do this sort of thing, of course, depending on exactly what you want. If you have a lot of ladder usage, you can define general systems for putting a ladder against things. If you want the ladder to become completely immobile after being placed against the tree, you could use now the ladder is part of the tree rather than defining a new property.)

I wanted to add that ladders are notoriously difficult to code because there are so many ways to describe what you want to do with a ladder (like leaning it on a tree, putting it under the tree, putting it by the tree, dropping the ladder, using the ladder to climb the tree, placing the ladder, etc.)

1 Like