Skip to content
C1200 edited this page Feb 22, 2025 · 7 revisions

Create: Tramways' configuration is stored in the JSON format. The JSON file can be found at .minecraft/config/tramways-config.json.

The default configuration

{
  "trains": {
    "*": {
      "announcer": "en-GB-SoniaNeural",
      "messages": {
        "AT_STATION": ["This is, $current. This tram is for, $end. The next stop is, $next, $next_extra."],
        "AT_TERMINUS": ["This is, $current. This tram terminates here."],
        "AFTER_STATION": ["This tram is for, $end. The next stop is, $next, $next_extra."],
        "PRE_TERMINUS_AT_STATION": ["This is, $current. The next stop is, $next, $next_extra, which is the last stop."],
        "PRE_TERMINUS_AFTER_STATION": ["The next stop is, $next, $next_extra, which is the last stop."]
      }
    }
  },
  "stations": {
    "*": {
      "alias": null,
      "extra": null,
      "announcer": "en-GB-SoniaNeural",
      "messages": {
        "WITHOUT_PLATFORM": ["The next train to arrive will be a $train_name service to $destination."],
        "WITH_PLATFORM": ["The next train to arrive at platform $platform will be a $train_name service to $destination."]
      }
    }
  }
}

trains and stations map keys

The keys in the trains and stations maps refer to the names of trains and stations, respectively. Keys can feature wildcards to select multiple trains or stations, as shown in the example default config.

Announcers

All available announcers can be found here. You should use the ShortName property as the value for announcer.

Messages

You may notice that the messages are given as arrays. This is because multiple messages can be specified for one to be picked out at random when it comes time to announce.

Message Types

Here's a list of all available message types:

  • For trains:
    • PRE_TERMINUS_AT_STATION - the train has arrived at the station, the next stop is the last
    • AT_STATION - the train has arrived at the station
    • PRE_TERMINUS_AFTER_STATION - the train has departed from a station, the next stop is the last
    • AFTER_STATION - the train has departed from a station
    • AT_TERMINUS - the train has arrived at the last stop
  • For stations:
    • WITHOUT_PLATFORM - no wildcard was used in the schedule/the station is not multiplatform
    • WITH_PLATFORM - a wildcard was used in the schedule and the platform number/letter is known

Message Placeholders

Within each message, placeholders that look like $this or ${this} are used. Here's all of the available placeholders:

  • For trains:
    • current, next, end - the station name or alias of the current, next, or final stop
    • current_extra, next_extra, end_extra - the extra field for the current, next, or final stop (intended for "change here for" announcements)
    • train_name - the train's name
    • train_length - the amount of carriages in a train
    • Create Railways Navigator
      • crn:group, crn:line - the group or line of the train
      • crn:arrival_time, crn:departure_time - the arrival or departure time for the train, formatted as HH:MM
      • crn:arrival_time_hours, crn:arrival_time_mins, crn:departure_time_hours, crn:departure_time_mins - individual time components for arrival and departure times
  • For stations:
    • all train placeholders, and:
    • destination - the train's final destination (alias of end)
    • platform - the platform that the train is arriving on

Advanced Syntax (for custom audio)

Instead of using strings in the messages array, you can use objects formatted like this:

{
  "type": "files",
  "message": ["myresources:this_is.mp3", "myresources:${current}.mp3", ...]
}

The strings in the array refer to a file in a resource pack. When specifying files, it is important to include the file extension (supported extensions are .mp3 and .ogg). It is also important to remember that Tramways will look from the root of the pack's namespace (assets/myresources, not something like assets/myresources/sounds).

Like TTS announcements, file names can include placeholders. Please note that: the value that the placeholder gets replaced by will be cleaned up (i.e. will be made lowercase and any characters that aren't a-z, 0-9, _, ., /, or - will be replaced with _). Also, it is recommended to use the ${placeholder} syntax in file names to avoid including any part after the placeholder in the placeholder name.

Clone this wiki locally