Execution: Custom Alert Mod (GUI now available)

All things /script related

Moderators: Fridmarr, Worldie, Aergis, _Chloe

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Fri Aug 14, 2009 5:44 pm

fafhrd wrote:Hm. Is it possible at all to have a rule span multiple events? Like say you get a UNIT_DIED for a tank, which I think includes the ID of the UNIT that killed him. You then want to see the last buff that unit gained (not the tank, the mob that killed him).


It's not currently possible, but a plan to be able to do something like this is definitely in the works. This would be a little more advanced and specific for something I'd make a function for, but should easily be possible with a custom reaction in Lua after I implement the ability for rules to enable and disable other rules. I don't think UNIT_DIED lists a source normally, but the way you'd probably implement it would be:

    Rule 1: Triggered when an enemy mob gains a buff. Custom reaction is to save a new variable, which would be a table that contains the mob's GUID and the buff gained.
    Rule 2: Triggered when the designated player (or role, such as "tank") takes damage. Custom reaction is to save the GUID of the last mob to do damage to him to a different variable (will be invalid if it's not from a mob with a GUID).
    Rule 3: Triggered when the designated player dies. Custom reaction is to check the variable for last mob to damage him and check that with the variable that matches. If nothing is invalid, announce that value.
    Rule 4 (Optional): Triggered when the player leaves combat. Clears all variables.

You could save yourself a rule by just looking for an overkill value that's more than zero on the tank, but that would (presumably) not work if the tank is hit to exactly 0 HP. Hmph. I guess you wouldn't even have to enable or disable other rules for that one, but it's still on the list because it definitely has some practical uses.

Code: Select all
7/15 19:35:36.858  UNIT_DIED,0x0000000000000000,nil,0x80000000,0x020000000270D6D8,"Durga",0x2000514


fafhrd wrote:I suppose that's actually jumping ahead a bit by needing to remember past events, a simpler start would be to see something related to the mob after it kills the tank, like the next buff it gets, or the next person it attacks. A rule to catch a mob killing the tank is easy, and a rule to catch a mob hitting a player is easy, but how about a mechanism to pass attributes of an event caught by the first rule (viz. "this is the guid of the mob that killed a player") as input to the second rule (viz. "filter SPELL_DAMAGE for unit with GUID"). And then add something so that the 2nd rule only matches one event and is then disabled (until the first rule triggers again).


I'm having difficulty following this. Could you offer a clearer example?
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby fafhrd » Fri Aug 14, 2009 10:57 pm

i think the 2nd case is doable in a similar way to what you suggested for the first, but for a clearer example:

Suppose for whatever reason, you want to announce who Patchwerk hits first after killing the tank. You only want to announce the first person though, you don't want a listing of all the hits he does on the new "tank".

So you have one rule (rule A) that picks up when tank dies. Maybe it's watching overkill, maybe it's unit_died. For the sake of the example, assume unit_died lists the mob that killed the unit as source. So now this rule has triggered, and knows that Mob#123 killed Player#1.

Now you need to make a rule (rule B) to catch outgoing damage from Mob#123. You only know that it's Mob#123 you want and not some other mob because the first rule you had found out it's Mob#123 that killed Player#1. So you either create a new rule that catches Mob#123's attacks, or you have an existing rule that catches a variable mob's attacks and you feed it #123 so that it catches the ones for the mob you're interested in.

Once this rule triggers, it disables itself so it doesn't keep spamming ever attack on the new tank (although when he dies, the cycle would probably start again).

With the system you outlined for the first case, rule A would likely save "Mob#123" in some variable somewhere, and rule B would be coded to match events for the mob with Guid equal to whatever happens to be saved in that variable.

Other interesting and probably more useful cases for things like this would be "who killed the lasher on freya or guardian on yogg that blew up and killed someone". In both those cases you should be able to trace the GUIDs through a chain of events to find out who started the chain.
ImageImage
1/1 Lore pre-nerf.
User avatar
fafhrd
 
Posts: 5432
Joined: Fri Aug 31, 2007 2:31 pm

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Sat Aug 15, 2009 8:27 pm

I've posted up an update with the following new stuff:

    An options GUI. "/ex" will bring it up, and it's under the Addon options in the UI.
    Added a localization dropdown. It doesn't yet do much since I only have an English set, but it should work correctly when I add other localizations.
    Added a "hide outgoing whispers sent by this add-on" option.
    Fixed an issue that would cause variables in chat reactions (like *target) to not be replaced if they weren't the first reaction in the list.
Mainly my first attempt at visual frames.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby Arees » Sun Aug 16, 2009 7:07 am

I like TJH so much... I'm definitely going to try this out soon modus.
Image
User avatar
Arees
 
Posts: 546
Joined: Tue Dec 25, 2007 9:50 pm

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Sun Aug 16, 2009 4:16 pm

WATERBOYsh wrote:I like TJH so much... I'm definitely going to try this out soon modus.


I won't recommend it as a 100% replacement until I get the GUI working. The text UI isn't bad, but aside from the TJH import, it's fairly painful to input and manage rules.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Mon Aug 17, 2009 9:41 pm

Alright. Evidently my problem with excess garbage is more serious than I thought. I thought it was my algorithm but I guess that actually had nothing to do with it (even though the new one is better anyway). I ran AddonUsage, commented out the part where the add-on does reactions, and you can just watch the add-on's memory usage get higher and higher as events come in. A quick garbage collect brings it back to normal size, though, so it must be a problem with my code.

If this WoWWiki page is correct, my strings, numbers, and booleans should be irrelevant, and this problem can only be occurring because of how I'm using my tables. It did correctly outline what I was doing wrong (creating a new table with each new event and then never using it again), but I believe I changed that and the problem is still happening. I double checked that all other variables used aren't tables, and that all other methods used don't generate tables, yet the add-on's garbage generation still seems to increase steadily with each event checked.

If anyone who knows anything about this subject would like to help out, you can grab the code here. The relevant blocks are the EX_OnEvent function and any function called therein. The OnEvent function is in Execution.lua but it does reference some functions in Ex_vars.lua.

EDIT: Right now I'm trying to comment out the different pieces to narrow it down.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Mon Aug 17, 2009 10:11 pm

I suppose disregard that last post. It ends up my excess garbage appears to be from how I'm using gsub. I was creating a new function for it to use every time (albeit a very simple function, still a function) which appears to be what's doing it.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Mon Aug 17, 2009 10:55 pm

Alright, so now I have a different problem. I'd like to be able to create new functions without excess garbage. One of the reasons this causes an issue is because my logical operator script works by making the expression into a string and loadstring'ing it. Evidently that creates a function, though, which is now creating garbage. Likewise, in my gsub function, I was using something simple like:

Code: Select all
extraFilterString = gsub(extraFilterString, argumentPattern, function(eachArgument) return tostring(checkArgument(eachArgument)) end)


Obviously that's a very tiny function, but it is technically creating a function each time, which appears to be adding to my garbage. That particular situation is easier to work around, but I'm having difficulty getting gsub to call a function with any parameters other than the ones it's found, which is another problem for me.

Bottom line: Is there a way to create a function or overwrite a function without creating extra garbage?

My add-on's memory usage continually grows to out-of-control levels in raid combat and drops FPS significantly.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby _Chloe » Tue Aug 18, 2009 1:09 am

Use local variables instead of globals?
User avatar
_Chloe
Moderator
 
Posts: 971
Joined: Fri Dec 07, 2007 6:36 pm
Location: Santa Monica, CA

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Tue Aug 18, 2009 3:59 am

_Chloe wrote:Use local variables instead of globals?


Hmm. In what sense? Like, here's one function that could cause problems. This particular one is more easily worked around but is clearer for showing you guys:

Code: Select all
function EX_CheckExtraFilter(extraFilterString)

   if extraFilterString == "" or extraFilterString == nil then return true end

   local argumentPattern = "[^&|()!][^&|()]*"

   extraFilterString = gsub(extraFilterString, argumentPattern, function(eachArgument) return tostring(EX_ExtraFilterHandler(eachArgument)) end)

   return EX_Evaluator(extraFilterString)

end


Slapping local in front of that function causes a compile-time error. Or do you mean defining the function locally beforehand, and then calling it there in the gsub? That might work. Brb trying.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Tue Aug 18, 2009 4:06 am

Doesn't look like it's doing it. I commented out the two other places it's happening before I tried it and it was still going up quickly in combat, then commented out where it was creating that function and it came back down to a steady memory usage in combat.

Or do you mean to set the function itself as local?
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby _Chloe » Tue Aug 18, 2009 5:14 am

In the WoW environment, local variables generally use up less memory and don't pollute the global namespace. If the function is declared local, then the functions it spawns should be local as well. Also are you checking to see if the function already exists or no?
User avatar
_Chloe
Moderator
 
Posts: 971
Joined: Fri Dec 07, 2007 6:36 pm
Location: Santa Monica, CA

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Tue Aug 18, 2009 5:22 am

_Chloe wrote:In the WoW environment, local variables generally use up less memory and don't pollute the global namespace. If the function is declared local, then the functions it spawns should be local as well. Also are you checking to see if the function already exists or no?


I went ahead and set the functions that create the local functions (like EX_CheckExtraFilter) as local but the problem is still happening. Normally are local variables garbage collected once the client leaves their block? I'm not sure what function I'd be checking to see if it already exists. The only one I redefine is the one in the gsub, and I'm not sure how or why I'd check if it already exists.

Now in-game, if I try to do /script EX_CheckExtraFilter() it'll tell me I'm trying to reference a global function that's nil, which is what it should do now that it's local to the add-on.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

Re: Execution: Custom Alert Mod (Now available for testing)

Postby Arees » Tue Aug 18, 2009 6:17 am

I wish I could help you modus. I could tell you all about Java garbage collecting... but thats not of much use. I do think Chloe is on to something though. It sounds like something isn't going out of scope when it should so its not being garbage collected. If I get a chance during my lunch break or something I'll look at the code some, but I'm afrad my limited LUA knowledge wont be much help.
Image
User avatar
Arees
 
Posts: 546
Joined: Tue Dec 25, 2007 9:50 pm

Re: Execution: Custom Alert Mod (Now available for testing)

Postby moduspwnens » Tue Aug 18, 2009 6:38 am

I talked to Chloe in vent and we took care of two of the three places that the excess garbage is being generated. I think the last has both of us stumped, and it's where it appears that using a loadstring to evaluate logical expressions is creating a function that sits in memory until it is garbage collected. I tried defining an addon-wide "placeholder" function and then changing that function to the loadstring's result, but that still creates the garbage. I'm hoping there's some solution that doesn't involve me writing my own function for logical evaluation.
I rule.
moduspwnens
Moderator
 
Posts: 6211
Joined: Tue Nov 06, 2007 12:28 pm
Location: Shattered Hand

PreviousNext

Return to Add-ons, UI, and Macros

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Who is online

In total there are 2 users online :: 1 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 380 on Tue Oct 14, 2008 6:28 pm

Users browsing this forum: Google [Bot] and 1 guest