Hey guys, i just wanted to ask if someone of you is able to inegrate a working clock as a material (like the nav screen) into my dashboard. i have the html code for the clock but no clue how to make it work in beamng. can someone help me? Code: <script src="http://www.clocklink.com/embed.js"></script> <script type="text/javascript" language="JavaScript">obj=new Object;obj.clockfile="5005-green.swf";obj.TimeZone="Germany_Frankfurt"; obj.width=240;obj.height=80;obj.wmode="transparent";showClock(obj);</script> or Code: <embed src="http://www.clocklink.com/clocks/5005-green.swf?TimeZone=Germany_Frankfurt" width="240" height="80" wmode="transparent" type="application/x-shockwave-flash"> website: http://www.clocklink.com/gallery/view/5005 this is where i want to place it
You would need to change the material of the 3d model in the area that you wish to embed the clock to a new material. Then you need to find the lua file for the vehicle you want to add the page into. This will be found in a folder called lua which is contained in the root folder of the vehicle. Then copy a line of code that will look something like: Code: local naviScreenName = "@R60_Nav" And change the bit that states "naviScreenName" to something along the lines of "digiClock", then change the bit that states "R60_Nav" (or your vehicle equivalent) to the name of the material you created on the model. You will also find a line of code that looks similar to this: Code: obj:queueGameEngineLua('be:getObjectByID('..vehicleID..'):createUITexture("'..naviScreenName..'", "local://local/vehicles/Raven R60/navi_screen.html", 256, 128, UI_TEXTURE_USAGE_AUTOMATIC, 30)') Then copy this line of code and change where it states "naviScreenName" to be "digiClock" (keep the dots etc). I think the numbers "256,128" of the code adjust the resolution of the HTML web page that is created. Can't quite remember. Then when the vehicle loads, the lua file will tell the game you want to assign the material (on the 3d model) to be a HTML material, as well as that you want that material to be one from the html file you specified.
thats really useful; thank you. We tried to add this (html/lua file) and also added some lines in materials.cs but we just get orange no texture instead of the clock time.
Did you change the texture on the actual model within your modelling software? Also putting "--" in front of a line in lua comments it out. Which means the game will just ignore it as it is a comment for human reading only.
The UI runs in a sandbox. It'll not be able to connect to websites to get data and alike. If you want a clock, you need to code it yourself :/
That's good to hear actually, since many a bad thing could happen if you give mods internet access. Although I did find myself wondering if it was possible to auto-update the OS of a cars nav system within BeamNG among other things such as streaming YouTube to the navigation screen xD
This is interesting. I saw in one of YBR's videos a mod with a clock that syncs to your system time, but I've never seen one with a clock that accurately displays the time the map is set to instead. I wonder if that's possible?
All right, thank you for the replies. Since tdev said it isnt possible with different websites I finally found an html code which works without any website. Can I use this one instead? Is this possible?
Tdev is right you should provide the file locally and not ask a server. moreover, you should avoird using flash because it will be dead soon and it eat quit a lot of resources for simple things. I made a simple clock using code from stackoverflow. Javascript interval refresh a text in a SVG image If you want help contact me via pm or here To @tdev : is there a way to get the temperature of the map?
the file is in this thread https://www.beamng.com/threads/converting-to-powertrain.35997/ Can you have a quick look at this thread too please https://www.beamng.com/threads/json-forest-data-v2-support.34660/
could you please share the code? I would like to test if the triggered updates are working, and this would be an ideal usecase