Vehicle Lua and HTML

Vehicle Lua and HTML

From BeamNG

Why would you want to use Vehicle Lua and HTML?

They allow for Vehicles to have custom scripts. Custom Scripts can be used to control/monitor vehicle parameters and create interactive textures such as digital dashboards.

How does it work?

What each file does

Lua This is where your programming Logic should go.
HTML This is where your user interface should go (if you want one), as well as any JavaScript functions that modify it (UI code only, not logic).
materials.cs Your vehicle should already have one of these. If you wish to use a HTML material you need to define that materials properties here first, just like a normal material.

Lua?

Each vehicle can have many Lua files. When a vehicle is loaded its Lua files are executed. Lua code can read vehicle data such as wheel speed and engine RPM, it can also write this data too, for example setting the throttle position. If you have an HTML file, your Lua can call its JavaScript functions.

Lua files must be in a folder named "lua" in the same directory as your jBeam.

HTML?

Each vehicle can have many HTML files. A Lua file is required to assign the HTML file a material. These HTML documents can then be displayed on surfaces in game with the corresponding material. Lua files can then call JavaScript functions to modify the contents of the HTML and CSS. This allows for complex visual displays with animations to be achieved.


Lua and HTML explained in more Depth