Inform 6 - Shipboard Directions

I am trying to add shipboard directions to my i6 based game.

I have used DM4 Sections 9 and 36 and Example 9 as a reference. I am unable to facilitate port, starboard, fore and aft. DM4 mentions that it is used in Curses but I have been unable to locate the source code.

This is a sample of the code I have tried:

CompassDirection port_obj "port wall" compass
    with name 'port' 'wall', door_dir w_to;

w_to works in the object definition but not port_to.

I am not sure how to enter a code block. sorry

I have tried several variations of the above.

Suggestions?

Thank you, Jeff

This is what I used in ATS:

CompassDirection aft_obj "aft" Compass
    with door_dir s_to, name 'a//' 'aft';
CompassDirection fore_obj "forward" Compass
    with door_dir n_to, name 'f//' 'fore' 'forward';
CompassDirection port_obj "port" Compass
    with door_dir w_to, name 'p//' 'port';
CompassDirection starboard_obj "starboard" Compass
    with door_dir e_to, name 'sb//' 'starboard';

This is in the across.inf, I didn’t edit anything in the English.h for this.

  • Hope it helps
1 Like

I will give this a try.

Thank you for your help!
v/r
Jeff

If you want to use port_to as the property name, you need to declare it first—otherwise, Inform has no idea what port_to means (since it could also be the name of an object, or an attribute, or a routine, or…).

I believe (though I’d need to test this) that the library accomplishes this with the Property directive:

Property port_to;

Alternately, if you want to save a few bytes, you can use a rather obscure trick:

Property port_to alias w_to;

This makes port_to an alias of w_to, assuming you’ll never need them to be distinct directions. (You can then block all attempts to Go w_obj by saying you don’t know which way is west, or make them line up based on the direction the ship is moving—if the ship is going north, “west” and “port” are truly equivalent.)

2 Likes

This works perfectly!

just using w_to in the Object code allows the use of “port” or “go port” in the compiled game.

I am adding this to my bag of tricks.

Thank you very much!

Jeff

PS. I did have to change the tilde and apostrophe from the above code. It was a different character code than " and ’ in my system.

Yeah. Sorry. I don’t know how to post Code on these forums. I’m not sure what the command is, and < code > didn’t work very well for me. The forums likes to change things.

I’m glad you got it working :slight_smile:

1 Like

Type three backticks: ``` on a separate line before and after the code.
You can also use square brackets instead of angle brackets: [code]your code here[/code]
(That’s wrapped in two sets of tags, because the first set actually created a code block.)

Angle brackets get turned into HTML if possible, I think, but the code tags are Markdown rather than HTML.

1 Like

Or click on the </> icon in the toolbar.

Code icon

1 Like

@matt_weiner @Juhana

Yeah, that worked. Thanks. I cleaned it up. :slight_smile:

1 Like

thanks again for all of the help.

One of my tasks today is to define synonyms for UP and DOWN. I should be good to go. Maybe? :wink:

Jeff