bind lua script to buttons

Discussion in 'Utilities and programming' started by svan, Sep 12, 2024.

  1. svan

    svan
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    1
    i have my lua script in beamng folder and want to run it by specific keybind from keyboard is it possible?
    if so please write how
     
  2. daniel-w

    daniel-w
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 28, 2017
    Messages:
    282
    Hey :)
    If you're looking to call your Lua function via a keybind then you can do this.
    1. Create an actions file: yourMod/lua/ge/extensions/core/input/yourActions.json
    2. Edit the following and put it inside that json file:
    Code:
    {
        "flood_ui": {
            "cat": "gameplay",
            "order": 0,
            "ctx": "tlua",
            "onDown": "if extensions_yourExtension then extensions_yourExtension.yourFunction() end",
            "isBasic": true,
            "title": "Title",
            "desc": "Description"
        }
    }
    
    You will want to change the extension and function name so it works with yours.

    Take a look how I have done it here:
    https://www.beamng.com/resources/flood.23313/
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice