Solved Get vehicle name in UI when going to free-roam from time-trial

Discussion in 'Mod Support' started by [CAMSO] Lurlidon, Oct 27, 2018.

  1. [CAMSO] Lurlidon

    [CAMSO] Lurlidon
    Expand Collapse

    Joined:
    Oct 11, 2017
    Messages:
    6
    I've created a small UI app for BeamNG streamers to use to show the current car name while driving in BeamNG but have run into some issues with the transition from the end of a time-trial to the start of free-roam.

    I'm using Hooks ("VehicleChange", "VehicleconfigChange") to grab the car name in free-roam and the start of a time trial to use in the UI element. This is working fine at the moment. When the time-trial finishes and the user clicks "Free Roam" the UI changes from the time-trial preset to the free-roam preset. Seemingly I cannot find any hooks that fire on the transition to get the car name out for the free-roam UI's version of my car name element? The "ScenarioChange" hook fires, but seems to be missing the .vehicle parameter for some reason.

    This means when you transition to the free-roam UI the UI element has no idea what the current car name is.

    Is there a Stream I can get the name from, or a hook I'm missing that fires on that transition that contains the name?

    If not, can the free-roam and time-trial UI elements communicate to store what the current car name is?

    Thanks!
     
  2. thomatoes50

    thomatoes50
    Expand Collapse
    Staff Member

    Joined:
    Jan 31, 2013
    Messages:
    650
    To force Lua to send you this data again use this.
    Code:
    bngApi.activeObjectLua('partmgmt.reset()');
    You will receive a `VehicleconfigChange` event
     
  3. [CAMSO] Lurlidon

    [CAMSO] Lurlidon
    Expand Collapse

    Joined:
    Oct 11, 2017
    Messages:
    6
    Nice thanks, that works for the config event.

    Is there an object to call reset on to re-call the VehicleChange event? The VehicleconfigChange hook actually doesn't appear to have the car name in it, unless it's deep in the arguments & I missed it.
     
  4. Vaasik

    Vaasik
    Expand Collapse

    Joined:
    Aug 6, 2012
    Messages:
    16
    If you want the data to persist across multiple states I would recommend you use an Angular Service.

    Attached you can find an example mod of how this could work.

    Hope this helps! :)
     

    Attached Files:

    • Like Like x 3
  5. [CAMSO] Lurlidon

    [CAMSO] Lurlidon
    Expand Collapse

    Joined:
    Oct 11, 2017
    Messages:
    6
    That works almost perfect! All I had to do is replace Automation car-name underscores and it was good to go. Thanks a bunch.
     
  6. FreakDustSK

    FreakDustSK
    Expand Collapse

    Joined:
    Aug 4, 2019
    Messages:
    1
    Where can I find this mod, please? I am looking for thing just like this
     
  7. It's No Use

    It's No Use
    Expand Collapse

    Joined:
    Jun 16, 2014
    Messages:
    19
    Hate to be of any bother but may I see the app? I'd be interested in something like this :)
     
  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