I6: Going directions

I’m in a boat, and the river runs west. I want to parse “row west”. Could anyone help me on parsing that? I got my RowSub, but how do I catch the input? If I had the string “west” in a variable, I would be able to do the rest myself. Thanks!

I would understand rowing the boat as moving the boat, with an exception for the player not being in the boat.

Also, as far as I know, you’ll have to tell the boat to move to a room, not move to a direction.

Look at the Go verb to see the details on how to set up a verb which takes a direction as its argument.

Each direction is an object. The direction used will end up in the variable ‘noun’. Code could look something like this:

if(noun==w_obj && location.w_to) move Boat to location.w_to;

This is not a complete and general solution, but I hope you get the idea.

1 Like

I would do something like this (untested):

Verb 'row'
    * -> VagueGo
    * noun=ADirection -> Row
    * noun -> Push;

The Push (“move”) action for the boat would have to do something appropriate.

Then have the Row action invoke if you’re in the boat, and print a useful error message if you’re not.

1 Like

Thanks for that. And how do I prevent the player from going in a direction because he’s supposed to row, but not walk there?

Trap it in a before-rule. If there are several rooms with rowing, create a class for those rooms.

I’ll do. Is there something like “if player in vehicle”?

Check the discussion of the object tree in the DM4.

Ha, works! Thanks!