Transit System by Emily Short

This topic is for discussions related to Transit System by Emily Short

1 Like

As of version 6, the code includes:

A train-car has a time called the waiting duration. 

and later:

Rule for stopping at station a functional train-car (called relevant car) (this is the stopping cars rule): move the relevant car to the next stop of the relevant car; now the next-departure of the relevant car is the time of day plus the waiting duration of the relevant car; increase the next-departure of the relevant car by 1 minute.

but I think this causes an issue for absolutely-scheduled train-cars when no waiting duration is set. It appears that the waiting duration property defaults to the default value of a time (i.e. 9:00 AM, unless modified?), and that this is interpreted as a duration of 540 minutes (i.e. the number of minutes past midnight), which is what gets added to the time of day to determine next-departure.

1 Like

Help! I’m doing something wrong!

My main problem (please help): The case of the disappearing bus.

I made a bus called Whizz bus.

The Whizz bus is a train-car. Whizz bus is in mainroadsouth. The t-schedule of the Whizz bus is the Table of Bus t-schedule.

Table of Bus t-schedule
transit time	destination 
1 minute	mainroadmid 
1 minute	mainroadnorth 
1 minute	otherroad

I started the game, and went to have a ride.

>go to mainroadsouth

        *    *    *

mainroadsouth
You can see a Whizz bus here.

The door of the Whizz bus closes.

The Whizz bus sets off.

No worries, I thought. I just hopped to a location further along the bus route, and waited. But the bus never arrived. I’ve tried jumping to the very next stop, then to a place several stops away, to be absolutely sure I hadn’t missed it.

Investigating with showme whizz bus, I found that it starts where it should, then goes to “transitional location”, never to be seen again.

>showme whizz bus
Whizz bus - train-car
    door (part of Whizz bus) - train-car-door
location: in mainroadsouth
singular-named, improper-named; lit, inedible, portable; enterable, opaque, open, openable, unlocked; absolutely-scheduled, functional
list grouping key: none
printed name: "Whizz bus"
printed plural name: "train-cars"
indefinite article: none
description: none
initial appearance: none
carrying capacity: 100
t-schedule: Table of Bus t-schedule
waiting duration: 12:01 am
next-departure: 9:00 am
next-arrival: 9:00 am
next stop: Transitional Location
stop number: 0

>wait
Time passes.

>showme whizz bus
Whizz bus - train-car
    door (part of Whizz bus) - train-car-door
location: in Transitional Location
singular-named, improper-named; lit, inedible, portable; enterable, opaque, closed, openable, unlocked; absolutely-scheduled, functional
list grouping key: none
printed name: "Whizz bus"
printed plural name: "train-cars"
indefinite article: none
description: none
initial appearance: none
carrying capacity: 100
t-schedule: Table of Bus t-schedule
waiting duration: 12:01 am
next-departure: 9:00 am
next-arrival: 12:01 am
next stop: mainroadmid
stop number: 1

>

After scratching my head for a while, I pasted the example “COTA” into a new project. I usually find that doing this gives me a working experience as a starting point for finding where I’ve messed up.

Naturally, when I ran ahead of the COTA bus, it joined me right on time. So I now KNOW the problem is my own game - not the extension, not my I7 installation, etc. But since I had originally just pasted the example code into my game, and renamed the bus and the stops, I can’t even begin to think what the problem is.

FWIW: I don’t have anything else with similar names; all the locations on the schedule are valid visitable and adjacent rooms with working connections.

This is my most immediate problem. I’d appreciate any tips.

But just while I’m here, I came across another couple of issues while playing with the CODA example.

First CODA issue (solved): The bus revisits the initial departure point.
(Apologies for the somewhat unintuitive positioning of the status-bar info in my pasted tests. It just seemed the least ambiguous placement in terms of timing.)

COTA
An Interactive Fiction
Release 1 / Serial number 230414 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

Starr Avenue
You can see a COTA bus here.

<< Status bar: “Starr Avenue                        Time: 9:00am” >>

>get on bus
You get into the COTA bus.

The door closes.

The COTA bus starts moving again.

<< Status bar: “The COTA bus                        Time: 9:01am” >>

>wait
Time passes.

The COTA bus stops at Starr Avenue. The door opens.

<< Status bar: “Starr Avenue                        Time: 9:02am” >>

>

So the bus arrived back at the starting point.

Even while typing this post, I suddenly realised what’s going on here, but I’ll leave it in, in case anyone else is puzzled about the COTA example. It’s dead simple: The first row of the schedule is the initial position of the bus. Remove that, and all is good. :blush: Perhaps this was intentional, and/or is plainly obvious to more experienced people, but it properly did my head in for ages!

Second CODA issue (yikes, help!): I can’t disembark.

Keen to try riding my bus, I had it spawn at the player start location instead, and was then able to board it. I won’t clutter an already over-long post with more pasted stuff, but I found it never got anywhere. I wasn’t able to disembark either, but that made perfect sense (at the time) as the bus hadn’t reached a stop.

So I returned to the COTA example, and that’s when my head started to hurt, lol.

Continuing the test above…

>get off bus
But you aren't on the COTA bus at the moment.

<< Status bar: “Starr Avenue                        Time: 9:03am” >>

>look
Starr Avenue (in the COTA bus)
The door closes.

The COTA bus starts moving again.

<< Status bar: “Starr Avenue                        Time: 9:04am” >>

>look
The COTA bus
The COTA bus stops at Fourth Street. The door opens.

<< Status bar: “Starr Avenue                        Time: 9:05am” >>

>get off bus
But you aren't on the COTA bus at the moment.

<< Status bar: “Starr Avenue                        Time: 9:06am” >>


>look
Starr Avenue (in the COTA bus)
The door closes.

The COTA bus starts moving again.

<< Status bar: “The COTA bus                        Time: 9:07am” >>

So I wasn’t able to replicate my runaway bus, but couldn’t disembark anyway. Very weird!

This hostage-passenger situation - aka the inept noob coder situation - isn’t yet a problem to the inept noob in question, as I his own dratted bus doesn’t even stop, lol. But I it’ll raise its head again once my main problem is solved, so any thoughts on it would also be most welcome.

Thanks for reading :slight_smile:

1 Like

Troubleshooting by comparison to a working example is exactly the right idea. I think you just overlooked a small thing, which can easily happen of course.

While adapting the example, you seem to have deleted the part of the definition that says that the bus is “relatively-scheduled”. The SHOWME output confirms that your Whizz bus is “absolutely-scheduled” (which is the default setting in the extension).

Since your table gives the times in minutes, meaning a duration, you need to declare the bus as relatively-scheduled, otherwise the extension will be confused when trying to use the numbers to calculate arrival times.


The reason for this is that “getting off” only applies to enterable supporters like chairs. In contrast to that, the bus (or train-car, in the terms of the extension) is implemented as an enterable container, and needs the “exiting” action.

The ACTIONS debugging command and the Actions Index under the Index tab in the IDE can generally be helpful for troubleshooting such issues.

Of course, “get off bus” makes perfect sense as a command for the player, so we can accept that by redirecting “getting off” to “exiting” like this:

Instead of getting off a train-car:
	try exiting;

(Side note: make sure that you don’t use such a rule for a supporter, because, as the Index says about the exiting action: “if the actor is on top of a supporter instead, an exiting action is converted to the getting off action.” – you’d get an infinite loop.)

3 Likes

I’m so disappointed! I had high hopes after reading your suggestion (despite “get off” being invalid after “get on” was fine) and agreed, that’s easy to work around. But this is what I get using exit:

>wait
Time passes.

The COTA bus stops at Starr Avenue. The door opens.

>exit bus
I only understood you as far as wanting to exit.

>

However, I shall have a poke around in the extension code and see whether it sheds any light.

Thank you so much for your input - it’s opened a new line of enquiry for me.

EDIT: I’ve just checked my own game to verify I haven’t already overriden the exit command, but no dice! :frowning:

Regarding the scheduled setting, that’ll be a big “doh!” from me. I thought it said unscheduled was the default. I’ll fix that pronto.

By default, EXIT is a one word command that doesn’t take an object, so that’s the last snag you’re running into - “Understand “exit [something]” as getting off” might work?

1 Like

Ahhhh the light dawns. Thank you once again.

Definitely something I’ll want to fix. Accepting “get on” on then requiring just “exit” is one too many leaps of the imagination for a player who’s not in the know. (And “But you aren’t on the Whizz bus at the moment” just adds to the confusion.)

runs for his bus in a happy mood…

EDIT: Fixed the illogical command problem. (I was vehicle specific, in case I want to add a taxi later (requiring “get out” - gotta love English!)

So my life is complete! I must say I’m heartened by the high proportion of helpful replies on this forum. A breath of fresh air after the forums dedicated to Arduino and (particularly) Raspberry Pi, which range from dismissive to outright toxic.

2 Likes