1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.37 Bug Reporting thread
    Solutions and more information may already be available.

Custom Input LUA for all vehicles

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by Olivier80, Aug 27, 2024.

  1. Olivier80

    Olivier80
    Expand Collapse

    Joined:
    Aug 20, 2024
    Messages:
    47
    I'm writing a transmission extension using an input mapping to select differential modes and lockings.

    I'd like to use the same input mapping for all vehicles, using a custom lua file for the actions code.

    Then i tried to put the input_actions.json file in this mod path :

    mods\unpacked\advanced_transmission\lua\ge\extensions\core\input\actions

    It works if i'm using electricals signals directly in the input_actions.json file.

    But i'd like to use a custom_input.lua file for easier modes management.
    then if using this kind of command in the input_actions.json :

    onUp: "custom_lua_file.set(VALUE)"

    Then it does not work, i get an error when the extension is loaded regardless where i try to put the custom_lua_file.

    The reason for using the same mapping for all vehicles is that it will avoid to have to redo the bindings for each different car, and to avoid the files duplications hassle.

    Then my question is, how can i use the same input action mapping for all vehicles, using a custom lua file ?
     
  2. golgo1387

    golgo1387
    Expand Collapse

    Joined:
    Sep 9, 2023
    Messages:
    130
    Not to be 'that guy', but I think your post should be in Content Creation, and probably the Programming subcategory.

    I hope someone answers your question because I'd like to know too.
     
  3. Olivier80

    Olivier80
    Expand Collapse

    Joined:
    Aug 20, 2024
    Messages:
    47
    Sorry i'm a beginner here. Perhaps a moderator can change the path of my post.

    Here is the error i get :

    erreurlua.png

    If i'm using a vehicle path in the mod for the input_actions.json file, then it's working, i do not get this error.

    I did check how a custom lua file is called in the game from the "BeamNG.drive\lua\ge\extensions\core\input\actions" folder, we have that for example for camera.json :

    "bigMapZoom":{"cat":"camera", "order": 121, "ctx": "tlua", "onChange":"if freeroam_bigMapMode then freeroam_bigMapMode.zoom(VALUE) end"

    Then it should be possible to use that in a mod as well.

    Without success. I did not find in the documentation where we should put the custom lua file in the mod folder structure.

    I tried using "ctx": "bvlua" '“bvlua” (according to the documentation it is for all vehicles - lua (async)). But again it was not working and i'm not sure about the folder structure that needs to be respected in this case. It is not documented.
     
    #3 Olivier80, Aug 27, 2024
    Last edited: Aug 27, 2024
  4. Olivier80

    Olivier80
    Expand Collapse

    Joined:
    Aug 20, 2024
    Messages:
    47
  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