How would I dump that variable ? You don't have to explain it in detail. Honestly, if you don't wanna explain it at all, that's cool too, LOL.. I guess I would have to dump it from the beamng.lua file in the lua\vehicle directory. After thinking about it for a few minutes, is v.data a temporary file while playing the game ? Alright, this correctly puts the air speed in the variable called vName, but for the last line of code, what would put the current vehicle name in it ? Code: local function getPlayerCarID() for objID = 0, BeamEngine:getSlotCount(), 1 do local slot = BeamEngine:getSlot( objID ) if slot ~= nil and slot.activationMode == 1 then return objID end end return 0 end local carID = getPlayerCarID() if carID == nil then return 0, 0 end local VName2 = BeamEngine:getSlot( carID ) local vName = VName2:getVelocity():length() - - - Updated - - - I'm just bumping this once because I don't know if the last update was seen.
Thanks for the reply. It returns "unable to find function printCurrentCarId". I find it crazy that I can get the air speed around the vehicle but not the name of it.. - - - Updated - - - OK, if I go into the console, select BNGV, then enter "print (v.vehicleDirectory)", I get the vehicle directory path, which I could work with, but.. v.vehicleDirectory doesn't seem usable from a .lua file.. I mean, it probably is able to be used from a .lua file, but I'm missing something.
Do you need the name the computer assigns to it or the name of it in BeamNG? in the vehicles folder there is a "name" .cs file, the computer may uses that as an official Identifier. The computer assigned name, using the printcarID handle it shows the player car as "0" the player car is always "0" other cars in the scene simply go up "1" "2" "3" etc. and when you switch to another car it changes its name to "0", the player id's (names) seem to be variable not static. Other than that I don't know what else to look for.
I'd like to have the name of the car being driven from it's name.cs file into a Lua file. My track timer is considered a system Lua, so I'm having trouble accessing metatables that were created in a vehicle Lua.
This function defined in waypoints mod. So, if the op didnt installed this mod he must define this function. P.S. The cars ids changing after reset (CTRL+R). Perhaps, op trying to know how to get this name: I didn't find this name in v.data dump View attachment v.data_dump.zip
I appreciate the dump file, but is it possible for me to access any of the data in those tables from a system Lua file ?
that's not part of default beamng, that's from the waypoints mod by incognito EDIT: Ninja'd by incognito, lol
Most likely, no. Only in vehicle lua. It will be possiblee when devs will add data exchange between system lua and vehicle lua.
I put a couple requires ( default.lua and beamng.lua from the lua vehicle directory ) into my track timer and I was able to access the v.table but it wasn't complete. It was just basic. - - - Updated - - - I guess there's no possible way to bridge Torque ( vehicle chooser ) with Lua ? It seems like it is in a way.. Code: function VehicleChooser::apply(%this){ %cval = %this.getSelectedVehicle(); %config = %this.getSelectedVehicleConfig(); %obj = %this.getCurrentObject(); if( %obj != 0 ) { %obj.JBeam = %cval; %obj.partConfig = %config; %obj.requestReload(); if(%config !$= "") { [COLOR=#006400][B] %obj.lua("partmgmt.load('" @ %config @ "')");[/B][/COLOR] } } Canvas.popDialog(VehicleChooser); } - - - Updated - - - HA, even after figuring out how to dump the v table to a file, the vehicle name that's contained in the name.cs file is not even in it.. It's crazy.. The only thing I can do is get the active vehicle directory name and trim it.. - - - Updated - - - Holy shit, I did it.. completely automated.. dumps v.vehicles to a file on vehicle spawn, which my system Lua file reads from.. It isn't just to echo on the screen. I'll log the vehicle used with lap times. I'll include this with all my tracks eventually. Now I have it so the lap timer display depends on which vehicle is being driven, so.. the best time displayed will be the best time for the vehicle being driven. It was a joy to learn Lua tables.......