Route finding stops.

Hi, I have a scene in my game where the player is shunted along a conveyor belt using route-finding, but the route-finding stops after one room. Is there any kind of script or command that might be interrupting it? The script is just:

let the way be the best route from the location of the player to the location of the Warehouse, using doors; try the player going the way;

Hi. If you mean that you have an Inform-defined scene -

(IE You’re not just saying ‘There’s a part in my game with a conveyer belt…’ You are actually saying ‘I have defined a scene using Inform 7, and in that scene the player goes along a conveyer belt…’)

  • so if you ARE saying that second thing, the issue is that you need to run the route-finding routine every turn from then on to have it continue to work. If you only run it when the scene begins, it will only happen once, moving the player one room and then not happening again, which is what sounds like is the case.

So what you need is an every turn rule. But we don’t want it to happen if the player is already in the warehouse.

Let’s say your scene is called Conveyer Belt Action. You could do this:

Every turn during Conveyer Belt Action: if the player is not in Warehouse: let the way be the best route from the location to the Warehouse, using doors; try the player going the way.
This fixes everything except that it will keep going until you end the scene.

Btw, notice that we don’t need to say ‘the location of the Warehouse’ if the Warehouse is a location. Also, the shortcut for ‘the location of the player’ is just ‘the location’.

If you want the scene to end once the player has reached the warehouse, (I THINK) you could say:

Conveyer Belt Action ends when the player is in Warehouse.

If I made any tiny errors due to me not using scenes much myself, I’m sure someone will tweak them out shortly. But this should be broadly or fully correct.

-Wade

I’d change it not to use the “going” action, personally, to try to minimize strange interactions with other rules. (E.g. “Instead of going somewhere when the player wears the Cursed Boots of Immobility…”).

Every turn during Conveyor Belt Action:
    let the way be the best route from the location to the Warehouse;
    if the way is nothing, make no decision;
    let the place be the room way from the location;
    say "The conveyor belt continues to turn, pulling you inexorably into...";
    move the player to the place.

I wouldn’t even use route-finding here, depending on the details of your game. Route-finding pushes the player toward the Warehouse no matter where they are–so if they’re on a north-south path to the warehouse and they manage to go east, the conveyor belt will drag them back onto the path (or maybe some other way?) even though there’s no conveyor belt in the area. It acts more like a magnet than a conveyor belt, if you see what I mean.

One approach would be to explicitly list the conveyor belt’s route in a table:

[code]Every turn during Conveyor Belt Action:
if the location is an origin room listed in the Table of Conveyor Belt Places:
let the place be the destination room entry;
say “The conveyor belt continues to turn, pulling you inexorably into the…”;
move the player to the place.

Table of Conveyor Belt Places
origin room destination room
Hopper Egress Shuntery
Shuntery Widget Blopper
Widget Blopper Inspectatorium
Inspectatorium Warehouse[/code]

There might be some fancy way to do it all in one column, but I couldn’t quite figure out how to do “Find a row and then look at the next row.”

Here’s a working example:

[code]Hopper Egress is a room. Shuntery is south of Hopper Egress. Widget Blopper is south of Shuntery. “There seems to be an alcove to the east.” Inspectatorium is south of Widget Blopper. Warehouse is south of Inspectatorium. Alcove is east of Widget Blopper. “The Widget Blopper is back to the west.”

Conveyor Belt Action is a scene. Conveyor Belt Action begins when the location is the Hopper Egress. When Conveyor Belt Action begins: say “The conveyor belt begins to turn, dragging you along!”

Conveyor Belt Action ends when the location is the Warehouse. When Conveyor Belt Action ends: say “Having deposited you in the Warehouse, the conveyor belt stops.”

Every turn during Conveyor Belt Action:
if the location is an origin room listed in the Table of Conveyor Belt Places:
let the place be the destination room entry;
say “The conveyor belt continues to turn, pulling you inexorably into the…”;
move the player to the place.

Table of Conveyor Belt Places
origin room destination room
Hopper Egress Shuntery
Shuntery Widget Blopper
Widget Blopper Inspectatorium
Inspectatorium Warehouse

Definition: A room is belty if it is an origin room listed in the Table of Conveyor Belt Places.
Definition: A room is non-belty if it is not belty.

Report going from a belty room to a non-belty room during Conveyor Belt Action: say “You scramble off the belt.”

After looking in a belty room: say “There is a conveyor belt here, leading south.”

Hopper Mouth is above Hopper Egress. “There is an inviting chute leading down here.” The player is in Hopper Mouth.[/code]

Thanks a lot! :slight_smile: I really like the one you made Matt! Is there any way I could activate the Conveyor Belt Action as a line of script?

You’re welcome!

If you want to activate it as a script, you just have to change it from a scene to a truth flag or a property of some object. Then you can switch it on and off with “Now Belt Moving is true” (if Belt Moving is the name of the truth flag) or “Now the conveyor belt is moving” (if that’s the property).

In this case, you probably want to have the conveyor belt be a backdrop in all the belty rooms or a bunch of scenery objects in the belty rooms, so the player can examine the belt. So you might want to do something like this:

[code]Hopper Egress is a room. Shuntery is south of Hopper Egress. Widget Blopper is south of Shuntery. “There seems to be an alcove to the east.” Inspectatorium is south of Widget Blopper. Warehouse is south of Inspectatorium. Alcove is east of Widget Blopper. “The Widget Blopper is back to the west.”

The conveyor belt is a backdrop. The conveyor belt can be moving or stationary. The conveyor belt is stationary. The description of the conveyor belt is “The belt is [if moving]moving[otherwise]stationary[end if].”

Definition: A room is belty if it is an origin room listed in the Table of Conveyor Belt Places.
Definition: A room is non-belty if it is not belty.

When play begins: move the conveyor belt backdrop to all belty rooms.

Every turn when the conveyor belt is moving:
if the location is an origin room listed in the Table of Conveyor Belt Places:
let the place be the destination room entry;
say “The conveyor belt continues to turn, pulling you inexorably into the…”;
move the player to the place;
if the place is the Warehouse:
say “Having deposited you in the Warehouse, the conveyor belt grinds to a halt.”;
now the conveyor belt is stationary.
.
After looking in a belty room: say “There is a conveyor belt here, leading south.”

Table of Conveyor Belt Places
origin room destination room
Hopper Egress Shuntery
Shuntery Widget Blopper
Widget Blopper Inspectatorium
Inspectatorium Warehouse

Report going from a belty room to a non-belty room when the conveyor belt is moving: say “You scramble off the belt.”

Hopper Mouth is above Hopper Egress. “There is an inviting chute leading down here.” The player is in Hopper Mouth.

Every turn when the location is the Hopper Egress and the conveyor belt is stationary:
say “The conveyor belt shudders to life!”;
now the conveyor belt is moving.[/code]

This is a bit messy because the check for being a belty room and the check for whether the belt is in the room duplicate each other–you want to be careful not to move the belt out of the belty rooms.

Thanks, it is a bit confusing but I’m sure I can make it fit!

Hey, I’m wondering, would it be possible to make a fast travel map using this? I don’t want the player to go through every room as that would take forever, but maybe there is a way to get the game to calculate a route, work out if there are any enemies or locked doors on it, and then teleport the player either to the first obstacle, or the destination?

Something like:

If a location on the route contains a door that is locked or a person who is hostile: Now the target location is the first locked door or enemy; Move the player to the target location;

The easiest way would be to use a loop. Figure out the next step on the route, go there, if there’s a hostile stop.