openOMSI GitHub Discord

Docs / Making content / HTML textures: modern engine

Acting on the vehicle

1 min readEdit this pagedocs/HTMLTEXTURE_MODERN.md

omsi.setVar(name, value) Write a script variable.
omsi.trigger(name) Press a trigger of the bus's scripts, like a button in the cab does.
omsi.setRoute(index) Type route omsi.depot.routes[index] into the IBIS: line, route and destination, the way a driver would.
omsi.setLine(text) Set a line by its text. The game takes the first route of that line in the depot file. It matches the whole text (any letter case) or the leading digits.
omsi.setDestination(index) Only change the destination sign, using omsi.depot.destinations[index]. The line and route stay as they are.
omsi.clearLine() Clear the IBIS: no line, no route. Use it before a route is chosen, or to throw the current one away.
omsi.setNextStop(index) With a timetable: jump to stop index of the trip, forwards or backwards. Skipped stops are not served; going back makes them due again.

Two details that trip people up:

  • setNextStop goes both ways. Forwards, the stops in between are skipped. Backwards (a "back one stop" button), the stops from index on are due again and served is false for them. A request for the stop the bus is already heading for changes nothing. The game applies it on its next tick, so route.nextIndex follows a moment later.
  • clearLine() only touches the IBIS. It does not end the duty in the game. If the page reads route.active afterwards it may still be true, so don't switch screens based on that alone.

Calls like these are handed to the game, which applies them a moment later. They don't take effect inside the same script run. Read omsi.vehicle again in the next update.

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open