Jump to content

Forwarding lua events in C#


scsfl

Recommended Posts

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
Share on other sites

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".

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...