Custom Room Leaving Action

Hi all,

in my WIP I need a custom room leaving action, because I don’t intend use the traditional compass directions.
Strangely, I never succeed in remapping the getOutOf action to my custom new action “Leave”:

First of all “>leave department” (assuming that the room has a vocabWords = ‘compartment’ property) leads (also strangely) to different messages
depending whether you type first

What do you want to get out of?

You can’t get out of that.


leave compartment
You’ll have to say which way to go.

I tried overriding the existing macro in the room object by calling
dobjFor(GetOutOf) asDobjFor(Leave)

or setting
remap = nil

or overriding the disembark() function in the room object.

Neither of them seems to have any result, I only achieved that the action is cancelled and I get a
“Nothing happens” message. Does anyone know how to remap the getOutOfAction properly?

– MI

I’m not sure I have a full answer to your problems, but I can offer a couple of quick thoughts.

  1. The VerbRule for GetOutOfAction defines ‘leave’ as one of the verbs that triggers the action. If you’ve also defined a VerbRule for your new LeaveAction that also matches ‘leave’ singleDobj, it may be far from clear what action is actually being triggered by commands like LEAVE SO-AND-SO

  2. If you want the command LEAVE (by itself) to take the player character from the current room, just define the result of leaving on the out direction of the Room, e.g.

compartment: Room 'Compartment'

   out = someOtherPlace

   vocabWords = 'compartment'
  1. You could then remap GetOutOf to Out, for example:
compartment: Room 'Compartment'

   out = someOtherPlace
   dobjFor(GetOutOf) remapTo(Out0)

   vocabWords = 'compartment'

But in fact you shouldn’t need to, since a remapping similar to this is already defined in the library, so defining an out exit on the Room should be all you actually need to do. (Incidentally, it may well be the fact that the library already defines this remapping that’s defeating your attempt to use asDobjFor).

I haven’t tested this, I think such a scheme should work without the need for defining a new LeaveAction, which may only be confusing matters.

If leaving a room could take the player character to more than one location, you may need to define an AskConnector on the out property of the room instead of linking it directly to the destination room.

That’s a good idea, thanks Eric. I think that got me in the right direction.