Docs / Plugins
Plugin API reference
Every omsi.* function, by namespace.
Every function and event a plugin can use, grouped by namespace. It is for plugin authors; start with the plugin guide if you have not written a plugin yet.
The same list is in plugin-api.json, for editors, SDKs and other tools. Both come from the game's API registry, so a function exists here exactly when the game has it.
Chapters
- 1. Reading this referenceEach function shows its call, what it returns, what it does, its parameters, the openOMSI version that added it, and the permission it needs (if any).…2 min read
- 2. Player's busomsi.bus.* and the core functions omsi.var, omsi.position, omsi.trigger and friends read and drive the vehicle the player is in. Every reading is nil …13 min read
- 3. Game data gettersomsi.game.query reads the same game-owned data as the vehicle scripts' getter functions, without running a script. Getter arguments keep OMSI's zero-b…2 min read
- 4. HOF depot fileomsi.hof.* reads the player's loaded HOF depot file as a snapshot. Records keep their zero-based index for the getters; Lua lists start at 1. Snapshot…1 min read
- 5. Duty and timetableomsi.duty.* is the player's current duty (line, tour, trip, stops). omsi.timetable.* reads the whole map's timetable without taking a duty. Times are …5 min read
- 6. Mapomsi.map.* reads the map: tiles, ground height, lanes, stops, objects, start points; and moves the player's bus. Coordinates are map metres: x east, y…3 min read
- 7. Scenery objectsomsi.object.* is for scripts that a scenery object's .sco names with [lua_script] (see Scripts of map objects). They only work on objects that script …3 min read
- 8. AI trafficomsi.traffic.* reads and changes the AI traffic. omsi.others and the other_* functions also cover other players' buses in a LAN game.3 min read
- 9. Peopleomsi.people.* reads the pedestrians and passengers, and lets a plugin set a boarding passenger's ticket. See Passengers' tickets for the full flow.3 min read
- 10. Time and dateomsi.world.* reads and sets the game's clock, date and pause; omsi.clock() is the time of day as text.1 min read
- 11. Weatheromsi.weather.* reads the weather and changes it as the game menu does. Changes are refused in a LAN game as a client, and while the weather follows a …1 min read
- 12. Cameraomsi.camera.* reads the camera and moves it. Changing it needs the camera permission.2 min read
- 13. Inputomsi.input.* reads keys, the mouse and game controllers, and registers hotkeys. Key names are winit's: KeyH, F5, Numpad8, ShiftLeft.1 min read
- 14. Soundomsi.audio.* plays WAV files from the plugin's folder: everywhere, at a map point, or moving with the bus.1 min read
- 15. Screen and panelsomsi.ui.* puts panels, notifications and pause-menu lines of the plugin on the screen. The panel table and every element type are described in Panels.…4 min read
- 16. Cables and meshesomsi.cable.* draws thin tubes (cables, ropes, wires) in the 3D world, in map coordinates or attached to the bus. omsi.mesh.* draws any triangles the p…3 min read
- 17. Events and timersRegister event handlers, timers and watches. The events themselves are listed under Events.1 min read
- 18. The plugin itselfomsi.plugin.* is about the plugin: its name, files, settings, permissions, and messages to other plugins.3 min read
- 19. Storage and filesomsi.storage.* is a key/value store, omsi.files.* reads and writes files. Both live only in the plugin's data folder. Paths are relative to that folde…2 min read
- 20. External programsomsi.process.* starts native helper programs from the plugin's own folder. Every helper needs the player's approval first, see Native helper programs.…3 min read
- 21. Local UDPomsi.send talks to other programs on the same computer. It never reaches the network.1 min read
- 22. Read-only WebSocket feedsomsi.ws.* listens to wss:// feeds from hosts the player allowed in websocket-hosts.txt in the plugins folder. The connection runs on its own thread an…1 min read
- 23. LAN gamesomsi.lan.* reads the LAN session and sends short texts to the same plugin on the other players' games.1 min read
- 24. Full accessomsi.fs.*, omsi.net.*, omsi.http.* and omsi.system.* reach the whole computer: any file, any network address, any program. They need the native permis…6 min read
- 25. The gameomsi.game.*, omsi.info and the log functions: the game's state, version, settings, commands and logging.4 min read
- 26. Helpersomsi.fmt.* formats numbers, times and distances, omsi.json.* reads and writes JSON, omsi.vec.* does map geometry, omsi.util.* gives real time and rand…4 min read
- 27. EventsRegister a handler with omsi.on(name, fn) or define a global function on_<name>. The handler gets the arguments listed after the name. Events that com…7 min read
Something wrong or missing? Fix it on GitHub or open an issue.