Making New Commands

A command is only an exit which performs a function rather than takes you to a different location. These are often referred to as actions.

Items you need to create to achieve this

A room #1234, an exit #1235, an exit #1236, an exit #1237.
#1235 is called lock, #1236 is called unlock, #1237 is called out.

What you need to do

The code to get unlock to change a value on out, you need to use the store command from MPI to change the value of a property on out called locked to no.

unlock must be linked - never ever leave unlinked exits, if you don't have a specific program or room to link it to, link it to $donothing, the obligatory program it does and achieves nothing other than meaning when you run the command nothing will be done.

Then use the success option on the unlock program to do store no in the locked property, with {store:no,locked,#1237} however, if you use this code on its own, you will see the lock changed code, ie you will see "no" appear on the screen, you don't really wish to do this, so you need to use the {null:} command with it as in.

@succ #1236={null:{store:no,locked,#1237}}

The code for lock of course is similar, link it again to the $donothing program

@succ #1235={null:{store:yes,locked,#1237}}

Although you aren't actually currently locking the door because you haven't set the lock on the door to do this- this will be done with the locking section, but you have learnt a method of making commands and altering properties on an object - the object must be something you own. You may experiment such as showing some text of "You open the door" and so on, but we are on the functional side here for the moment.

An example of adding text

@succ #1235={null:{store:yes,locked,#1237}}You close the door.

Advanced Locks >>