Solved Digital Dashboard Guages

Discussion in 'Mod Support' started by aljowen, Nov 2, 2016.

  1. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    Is it possible to have a material set to a html file and use that as the dashboard guages?

    If so how would I pass the data required (such as wheelspeed and revs) to the html file's javascript to allow me to update the html output displays?

    Currently I have got the dashboard cluster showing a html file that is essentially a clone of the navigation code with the background colour changed to black. It is using a slightly modified version of the "screens.lua" file that comes with the ETK 800.

    The general idea is that I am wanting to emulate having a computer display based instrument cluster, so I would use the speed variable in javascript to create a rotation which would be applied to the speedometer needle. By doing this through a html window it allows for dynamic content, for example making the parts of the cluster change colour based upon speed.
    screenshot_00069.png

    Thanks for any help :)
     
  2. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,600
    The ETK800 has the beginnings of a dash like that (in addition to it's navi screen). I think that everything useful is commented out currently. Take a look at these two files:

    \vehicles\etk800\gauges_screen.html
    \vehicles\etk800\lua\screens.lua
     
  3. Bernd

    Bernd
    Expand Collapse

    Joined:
    Dec 27, 2015
    Messages:
    1,387
    • Like Like x 2
  4. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    Yep, that helped a lot.
    Turns out passing the variables was quite a bit easier than expected...

    For future reference of others:
    Code:
    obj:queueGameEngineLua("if be:getObjectByID("..vehicleID..") then be:getObjectByID("..vehicleID.."):queueJSUITexture('"..clusterScreenName.."', 'updateSpeed("..wSpeed..")') end")
    clusterScreenName = whatever texture you are mapping onto
    updateSpeed = name of the function in javascript being called (in html file)
    wSpeed = variable that is being passed (in this name wheel speed which is set elsewhere)

    Code:
    electrics.values.wheelspeed
    Set a variable equal to the above in your lua and that variable will contain the wheel speed.

    This wiki page contains a list of parameters you can grab from the game: http://wiki.beamng.com/Streams

    I guess this is a start :p


    Now time to do some maths and make it look pretty.
     
    #4 aljowen, Nov 3, 2016
    Last edited: Nov 5, 2016
    • Like Like x 3
  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