Colmillo Posted July 10, 2023 Share Posted July 10, 2023 Hello Please I need help with this Script: function timeTostr(seconds) local secs = string.format('%02.0f', math.fmod(seconds, 60)); local minutes = string.format('%02.0f', math.fmod(seconds/60, 60)); local hours = string.format('%.0f', math.modf(seconds/3600)); return (hours .. ":" .. minutes .. ":" .. secs) ; end; KILL = EVENTHANDLER:New() KILL:HandleEvent(EVENTS.Kill) function KILL:OnEventKill(EventData) if EventData.IniPlayerName==nil then return false end local who = EventData.IniPlayerName or "A player" local sqn = EventData.IniGroupName or "A unit" local t = EventData.IniTypeName or "a plane" local tgt = EventData.TgtTypeName or "(JUST DAMAGED)" local wep = EventData.weapon_name or "a weapon" if EventData.IniGroupName then local grp = GROUP:FindByName(EventData.IniGroupName) local coa = grp:GetCoalitionName() local bullseye = grp:GetCoordinate():ToStringBULLS(grp:GetCoalition(), _SETTINGS:SetImperial()) trigger.action.outTextForGroup(3, who .. ", from " .. sqn .. " SQN. in their ".. coa .. " " .. t .. " has killed a " .. tgt .. " with a " .. wep .. " at "..bullseye .. " Time: " .. timeTostr(timer.getTime()),10); end end It works perfect, but when I want to add the env.info line, it stops working. The line that added it was located immediately after the trigger.action, and it is this: env.info( "V_TACS -- " .. who .. " has destroyed: " .. tgt .. ) I have searched for many ways and have not been able to find the way. I thank you in advance Cheers [sIGPIC][/sIGPIC] Intel(R) Core(TM) i9-10900KF CPU @ 3.70GHz 3.70 GHz ROG STRIX Z490-E GAMING RAM 128 M.2*2 2T total SSD*3 2.5T total GeForce RTX 3090 Orion2 HOTAS F-16EX Saitek Pro Rudder Link to comment Share on other sites More sharing options...
Solution Maverick87Shaka Posted July 10, 2023 Solution Share Posted July 10, 2023 (edited) You can only print string within env.info commands, so probably some of the variable that you're using it's a lua table, so you need a different approach to print a table in the log. Check DCS.log, it should tell you what was the problem and what is/are the variable that is causing the problem EDIT: Looking better your code, there is an error, you have another concatenate at the end but without anything after that. Change this: env.info( "V_TACS -- " .. who .. " has destroyed: " .. tgt .. ) to this: env.info( "V_TACS -- " .. who .. " has destroyed: " .. tgt ) Edited July 10, 2023 by Maverick87Shaka 1 1 FlighRIG => CPU: RyZen 5900x | RAM: 64GB Corsair 3000Mhz | GPU: nVIDIA RTX 4090 FE | OS Storage: SSD NVMe Samsung 850 Pro 512GB, DCS Storage: SSD NVMe Sabrent 1TB | Device: Multipurpose-UFC, VirPil T-50, TM WARTHOG Throttle, TrackHat, MFD Cougar with screen. Our Servers => [ITA] Banshee | Krasnodar - PvE | PersianConquest PvE Live Map&Stats | Syria Liberation PvE Conquest Support us on twitch subscribing with amazon prime account linked, it's free! Link to comment Share on other sites More sharing options...
Colmillo Posted July 10, 2023 Author Share Posted July 10, 2023 (edited) Thanks, but the log doesn't say much: 52: unexpected symbol near ')' It corresponds to the line that I want to add, I tried removing all the parameters and leaving only env.info( "V_TACS -- ") it sends the information to the log, but I want the information to be more detailed... I will keep trying. (I just see your edit, I will try) Edited July 10, 2023 by Colmillo [sIGPIC][/sIGPIC] Intel(R) Core(TM) i9-10900KF CPU @ 3.70GHz 3.70 GHz ROG STRIX Z490-E GAMING RAM 128 M.2*2 2T total SSD*3 2.5T total GeForce RTX 3090 Orion2 HOTAS F-16EX Saitek Pro Rudder Link to comment Share on other sites More sharing options...
Colmillo Posted July 10, 2023 Author Share Posted July 10, 2023 26 minutes ago, Maverick87Shaka said: You can only print string within env.info commands, so probably some of the variable that you're using it's a lua table, so you need a different approach to print a table in the log. Check DCS.log, it should tell you what was the problem and what is/are the variable that is causing the problem EDIT: Looking better your code, there is an error, you have another concatenate at the end but without anything after that. Change this: env.info( "V_TACS -- " .. who .. " has destroyed: " .. tgt .. ) to this: env.info( "V_TACS -- " .. who .. " has destroyed: " .. tgt ) Thank you!!!! That was the problem!! [sIGPIC][/sIGPIC] Intel(R) Core(TM) i9-10900KF CPU @ 3.70GHz 3.70 GHz ROG STRIX Z490-E GAMING RAM 128 M.2*2 2T total SSD*3 2.5T total GeForce RTX 3090 Orion2 HOTAS F-16EX Saitek Pro Rudder Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now