k3_direction in I6: where is it, what to replace it with?

I have a chase scene where room a is both above and to the south of room b. I also have a “go to” command that lets you jump rooms. Now I don’t want the player to jump over their chaser, so I used the handy “best route” to get something like this…

let X be the best route from the location of the player to the noun;
if X is opposite of last-chase-direction, say “You were caught!” instead;

The only problem is, from room A to B could be down or north, so the player could slip out.

I could hard code in something that says “check going up in room A when being-chased is true” (and have) but that is hacky. I would love to be able to find a simple I6-based solution.

Debugging the “best route” code leads to this, in relations.i6t:

 FastRouteTo from to filter use_doors diri i dir oy;
	if (from == to) return nothing;
	i = (FWMatrix-->(from.room_index*NUM_ROOMS + to.room_index))/No_Directions;
	if (i == 0) return nothing;
	diri = (FWMatrix-->(from.room_index*NUM_ROOMS + to.room_index))%No_Directions;
	i=0; objectloop (dir ofclass K3_direction) {
		if (i == diri) return dir;
		i++;
	}
	return nothing;
;

I was unable to find what K3_direction did, or how I would replace it with a different sort of class. I’m not even quite able to swing replacing the objectloop with something like this:

[code]
Array myDirs --> 4 = north, south, east, west;
for (i = 1 : i <= myDirs–>0 : i++) {
if (myDirs–>i == diri) return myDirs–>i;
}

But I can’t see how. Would anyone have an idea how to specify an array of directions? http://www.firthworks.com/roger/informfaq/ gives me ideas such as the below, but I can’t (and probably should) figure it out.

Array xxx --> 4 w_obj, e_obj, n_obj, s_obj;

Any help is appreciated. I have a feeling I’m just missing how directions are defined in I6. Thanks!

K3_direction is a class (“kind” in I7) which includes all the direction objects. I’m not sure what you want to do to it, though.

The direction objects have I6 names like I51_north, I52_northeast, etc. However, the numeric indexes aren’t guaranteed – you shouldn’t rely on them. Instead, you can write (+ north +) in I6 code to import an I7 object name. So this will work:

Include (-
Array TestArray --> (+ north +) (+ south +) (+ east +) (+ west +);
-).

(Note that there are no commas in the array definition.)

Again, though, I’m not sure what you want to do with this array.

Really it would be acceptable to just disable the “go to” command during the chase scene. Or limit it to one-room jumps.

If you don’t want to do that, I’d look for a solution which involves checking rooms, not directions. Directions will always be tricky. You could use “best route” to check the chain of rooms from the player to the destination, and see if it goes through the pursuer’s location. Or “best route from X to Y through safe rooms” where “safe” is defined as not containing the pursuer.

You could also hand-code a definition of “reachable-safely” which depends on the pursuer’s location. This is hard in general, but depending on your map, it might be doable.

Thanks … knowing (+ north +) is enough for me. Now I think I should have figured that out, based on how I’d used I6 to declare other I7 variables before. I’d used I7 variables in I6 before, but only ones I’d already written.

My map is pretty spider-y … there are no loops, so there is only one way between any two rooms. But yes, if it weren’t, things would be a lot trickier. As it is, I can just use the four cardinal directions.