A Bus Route with scheduled stops around the map

This seems like something I could achieve by making some count downs at the various stops before moving the bus onwards with the player inside who would have to “wait” or look or whatever to advance the count.

I feel like I could do it relatively easily but this is likely the hubris of the inexperienced. EDIT: I’m concerned that even if it works it will have unintended consequences.

stopone is a room.

stoptwo is a room.

stopthree is a room.

every turn when the player is on the bus and the bus is in stopone and buscount1 is 0:
     now the bus is in stop2.

buscount1 is a value.

buscount1 is 4

every turn when the player is on the bus and the bus is in stopone and buscount1 > 0:
     now buscount1 is buscount1 - 1.


every turn when the player is on the bus and the bus is in stoptwo and buscount2 is 0:
     now the bus is in stop3.

buscount2 is a value.

buscount2 is 4

every turn when the player is on the bus and the bus is in stoptwo and buscount2 > 0:
     now buscount2 is buscount2 - 1.


every turn when the player is on the bus and the bus is in stoptwo and buscount3 is 0:
     now the bus is in stop1.

buscount3 is a value.

buscount3 is 4

every turn when the player is on the bus and the bus is in stopthree and buscount2 > 0:
     now buscount3 is buscount3 - 1.

1 Like
A bus is an enterable supporter.
The bus has a list of rooms called the schedule. The schedule of the bus is {Alpha, Beta, Gamma, Delta}.
The bus has a number called the countdown. The countdown of the bus is 5.
Every turn:
    decrement the countdown of the bus;
    if the countdown of the bus is less than one:
        let the destination be entry 1 in the schedule of the bus;
        if the player can see the bus, say "The bus moves on toward [the destination].";
        move the bus to the destination;
        rotate the schedule of the bus backwards;
        now the countdown of the bus is 5.

But, do you really want to make the player type “wait” 20 times if they miss the bus? This seems like a place where accurate simulation doesn’t add much to the experience, and will just annoy the player.

2 Likes

Emily Short has an extension called “Transit System”. I can’t find it online but it’s in the Inform 7 Public Library in the IDE - 7:2 under “Ships Trains and Elevators.”

@draconis that’s an important point. I put four in there without thinking. The stop will be just one in the game so that they can get off at any point if they’ve not discovered the correct stop.

With @Draconis’s point about unnecessary waiting aside for now, would it be possible to have the bus leave and then have to wait for it to return like this (it runs fine but perhaps there are issues I can’t see)?

alpha is a room. "There is a steeple here."

aphan is a room. "There is a dog".

alphan is north of alpha.

beta is a room. "There is a shop here."

betan is a room. "There is a cat".

betan is north of beta.

gamma is a room. "There is a boat here."

gamman is a room. "There is a weasle".

gamman is north of gamma.

delta is a room. "There is a carnival here."

deltan is a room. "There is a donkey".

deltan is north of delta.

the bus is in alpha.

A bus is an enterable supporter.
The bus has a list of rooms called the schedule. The schedule of the bus is {Alpha, Beta, Gamma, Delta}.
The bus has a number called the countdown. The countdown of the bus is 3.
Every turn:
	decrement the countdown of the bus;
	if the countdown of the bus is less than one:
		let the destination be entry 1 in the schedule of the bus;
		if the player can see the bus, say "The bus moves on toward [the destination].";
		move the bus to the destination;
		rotate the schedule of the bus backwards;
		now the countdown of the bus is 3.
		

every turn when the player is not on the bus:
	if a random chance of 1 in 2 succeeds:
		move the bus to the location;
		say "the bus has arrived".
Definition: a room is a bus stop if it is listed in the schedule of the bus.
Every turn when the location is a bus stop and the bus is not in the location:
    say "The bus arrives.";
    move the bus to the location.

This means the bus will appear at a bus stop any time the player arrives there. If you want it to take a few more minutes, you can add a delay.

This is excellent @Draconis . Thank you.

I want the player to be able to get off the bus at various stops for some red-herring action. I’d also like them to have to wait just 1 turn at the “station” when they return to it after discovering they’ve been on a short wild goose chase. The reason I want the bus to wait at the station, even when the player is on it is I want them to be able to get off.

@Draconis I’ve incorporated both pieces but when it runs it seems to have two buses going around and sometimes the bus arrives but you can’t get on it.

It is bewildering.

EDIT: it looks like the the bus moves before the game processes the get on bus command.

the castle is a room.

the castle is south of the busshelter.

The Busshelter is a room.

[The busshelter is south of the park.]

the printed name of the busshelter is "Bus Shelter".


beta is a room. "There is a shop here."

betan is a room. "There is a cat".

betan is north of beta.

gamma is a room. "There is a boat here."

gamman is a room. "There is a weasle".

gamman is north of gamma.

delta is a room. "There is a carnival here."

deltan is a room. "There is a donkey".

deltan is north of delta.

The bus is nowhere.

A bus is an enterable supporter.

The bus has a list of rooms called the schedule. The schedule of the bus is {busshelter, Beta, Gamma, Delta}.

The bus has a number called the countdown. The countdown of the bus is 5.

Every turn:
	decrement the countdown of the bus;
	if the countdown of the bus is less than one:
		let the destination be entry 1 in the schedule of the bus;
		if the player is on the bus, say "The bus moves on toward [the destination].";
		move the bus to the destination;
		rotate the schedule of the bus backwards;
		now the countdown of the bus is 5.


Definition: a room is a bus stop if it is listed in the schedule of the bus.
Every turn when the location is a bus stop and the bus is not in the location:
	say "The bus arrives.";
	move the bus to the location.	

It’s because you now have two separate rules moving the bus, and they can both apply on the same turn.

2 Likes

Hi again. Firstly I aplogise for posting something similar as I had before. I’m not sure if the etiquette is to remove the “solution” check mark for an old post and post there again or to start a new thread but here we are.

I got some excellent advice for my bus situation @HanonO suggested a tried and true solution of Emily Short’s however, being the sort of person who wants to get under the hood I used some code generously written by @Draconis to put together a bus route situation.

In most respects it does what it is supposed to do but I fear that I have somehow undercut its functionality as the reported position of the bus doesn’t match where the bus should be especially after a player gets off the bus and then back on, sometimes the bus is there but you can’t get on it too. It’s like there are two counts or something.

"improved_busshelter" by ron_ditto

the castle is a room.

the castle is south of the busshelter.

The Busshelter is a room.

the printed name of the busshelter is "Bus Shelter".


beta is a room. "There is a shop here."

betan is a room. "There is a cat".

betan is north of beta.

gamma is a room. "There is a boat here."

gamman is a room. "There is a weasle".

gamman is north of gamma.

delta is a room. "There is a carnival here."

deltan is a room. "There is a donkey".

deltan is north of delta.

The bus is nowhere.

A bus is an enterable supporter.

The bus has a list of rooms called the schedule. The schedule of the bus is {busshelter, Beta, Gamma, Delta}.

The bus has a number called the countdown. The countdown of the bus is 2.

Every turn:
	decrement the countdown of the bus;
	if the countdown of the bus is less than one:
		let the destination be entry 2 in the schedule of the bus;
		if the player can see the bus, say "The bus moves on toward [the destination].";
		move the bus to the destination;
		rotate the schedule of the bus backwards;
		now the countdown of the bus is 2.


Definition: a room is a bus stop if it is listed in the schedule of the bus.
Every turn when the location is a bus stop and the bus is not in the location:
	say "The bus arrives.";
	move the bus to the location.

Thank you @draconis for confirming that.

I did some process of elimination work on the elements of it, and I shortened up the wait to 1, and eliminated the second routine with the bus arriving and I think I have it sorted.

Thank you for your help.