I6: preventing line break

Is there a directive for preventing a line break?

when_closed “Passage south is barred by a stone door”;

I want all the when_closed and when_open texts to be rpinted on the same line, so that when there are three doors in the room I get this

Passage south is barred by a ston door, passage east by boulder and passage north is open.

Instead of the clunky

Passage south is barred by a stone door.

Passage east is barred by a boulder.

Passage north is open.

Looks to me like you’ll need to write your own code for this. It could be done as a global function, if you have a lot of rooms.

You may need to hack the library code. It appears (judging from the brief example in the DM4) that when_closed is intended just to print a string when it’s called. So if you have three doors in the location, when_closed or when_open may get called on all three of them in turn. OTOH, if two of them supply no string for this, what happens? Maybe you could make the when_closed and when_open on one door do all the work of printing composite messages, and leave the other doors without these properties. Have you tried that?

If I have time, I’ll try a few things and let you know what I learn – no promises, though.

This is kind of ridiculous, but I have no idea how I6 handles strings. When printing the name of an object I use

print (name) obj;

but how do I get the actual name string so I can do something like this

print (string) obj.name;

?

I think that is

print (address) obj.name;

(As usual, only the first 9 characters of the name are internally stored.)

Dictionary words need the print (address) syntax, I think.

[** Programming error: stone door (object number 89) has a property name, but it is longer than 2 bytes so you cannot use “.” to read **]

This is apparently a special case. When I tried “print (address)” with other string values, it printed gibberish.

Well, the problem with getting the name property is that it’s not a string value, I don’t think. For example:

Object cundwe “cool underwear” Toiletary
with
name ‘bvds’ ‘hanes’ ‘joe boxer’,
has stinky;

Do you want to print out all of the names of the object?

I want to duplicate the functionality of “print (name) obj” in the form of a string so I can do this (using the functions in istring.h)

LStrCat(Text,obj.name);
printString(Text);

Here’s how I solved it. The code below belongs to the Room class, of which every location in the game is a member.

after [i flag;
  Look:
   
   objectloop(i in real_location && i ofclass DoorClass)
   {
    if(flag==0)
     {print "^";flag=1;}
    if(i has open)
    {
     i.whenopen();
    }
    else
    {
     i.whenclosed();
    }
   }
   if(flag==1)
    {print "^";}
 ],

I replaced when_open and when_closed with my own non-library functions whenopen and whenclosed and gave all DoorClass objects the concealed flag. The whenopen/whenclosed are called from an after routine in the relevant location.

Here’s the output

It was much simpler than I thought. OO is much cooler than BASIC. :ugeek: