scsfl 2 Posted July 5, 2020 Share Posted July 5, 2020 Hi there! Does anybody know Is there way to make fight class listen to Lua events? Especially COMBAT_LOG_EVENT_UNFILTERED. Yeah I know there is EventsLuaWithArgs.OnEventsLuaStringWithArgs but it pretty often skips COMBAT_LOG_EVENT_UNFILTERED and even when it fires it doesn't return any args cuz I have to use CombatLogGetCurrentEventInfo() function to get a payload. How can I subscribe COMBAT_LOG_EVENT_UNFILTERED with args using c#? Thank you. Link to comment https://wrobot.eu/forums/topic/12331-forwarding-lua-events-in-c/ Share on other sites More sharing options...
Matenia 628 Posted July 5, 2020 Share Posted July 5, 2020 Pro tip: There are no events being skipped. If you look at my framework it works perfectly. If you're running patch 6.x or higher, you need your own combatlog parser. Create a lua frame that subscribes to the event, get the payload, store it in a table and periodically empty the table and read the contents "line by line". scsfl 1 Link to comment https://wrobot.eu/forums/topic/12331-forwarding-lua-events-in-c/#findComment-59103 Share on other sites More sharing options...
scsfl 2 Posted July 9, 2020 Author Share Posted July 9, 2020 Can I ask one more dumb question please. Ok I did lua string that initialize lua frame and I'm able to store the payload in table each time event fired. luaString = @" local function OnEvent(self, event) local args = { } eventInfo = {CombatLogGetCurrentEventInfo()} for key, value in pairs(eventInfo) do table.insert(args, tostring(value)) end args = (table.concat(args, ',')) print (args) --debug end local f = CreateFrame('Frame') f: SetAttribute(name, 'CLEU') f: RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED') f: SetScript('OnEvent', OnEvent)"; Also I've got a C# function that which takes CLEU args as parameter. Is there way to call this function inside luaString? In other words I need to send args to a function every time event fired. The only thing comes in mind is to create chat frame inside lua string, sent CLEU args to this frame and read this frame using EventsLuaWithArgs.OnEventsLuaStringWithArgs. But It looks awful ? Link to comment https://wrobot.eu/forums/topic/12331-forwarding-lua-events-in-c/#findComment-59140 Share on other sites More sharing options...
Matenia 628 Posted July 9, 2020 Share Posted July 9, 2020 Don't create a frame locally and you'll find you can actually access globally. It's Lua 101. scsfl 1 Link to comment https://wrobot.eu/forums/topic/12331-forwarding-lua-events-in-c/#findComment-59141 Share on other sites More sharing options...
scsfl 2 Posted July 9, 2020 Author Share Posted July 9, 2020 Brilliant advice man! I'm very appreciating your help. var luaString = @" function OnEvent(self, event) local args = { } eventInfo = {CombatLogGetCurrentEventInfo()} for key, value in pairs(eventInfo) do table.insert(args, tostring(value)) end _G.args = (table.concat(args, ',')) end print ('frame works') f = CreateFrame('Frame') f: SetAttribute(name, 'CLEU') f: RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED') f: SetScript('OnEvent', OnEvent)"; Now I'm able to access _G.args from OnEventsLuaStringWithArgs ?. Thanks ? Link to comment https://wrobot.eu/forums/topic/12331-forwarding-lua-events-in-c/#findComment-59147 Share on other sites More sharing options...
Matenia 628 Posted July 10, 2020 Share Posted July 10, 2020 argsForCombatLogEventPuller = { } There you go, that would've been more than enough. You don't have to assign it to the global pseudo table. Link to comment https://wrobot.eu/forums/topic/12331-forwarding-lua-events-in-c/#findComment-59149 Share on other sites More sharing options...
scsfl 2 Posted July 10, 2020 Author Share Posted July 10, 2020 Fixed. Thank you for code review. Link to comment https://wrobot.eu/forums/topic/12331-forwarding-lua-events-in-c/#findComment-59165 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