Parsing event messages Event messages are things like combat log messages , loot messages , online / offline notifications , and so on . If you are writing an AddOn that wants to take some sort of action when a certain event happens ( for example , tracking your honor from PvP kills ) , you need to find the correct event and register to listen for that event . Some events provide you the information about that event in compact easy - to - use arguments . For example , the REPLACE _ ENCHANT event has two arguments , arg1 ( the name of the enchant ) and arg2 ( the name of the item ) . Other events don ' t provide you the arguments in such an easy - to - use form . For example , the CHAT _ MSG _ COMBAT _ HONOR _ GAIN event has one big long argument , arg1 , that looks something like " Joe dies , honorable kill Rank : Commander ( Estimated Honor Points : 10 ) " . What you really want to know , though , is In order to get this information , you need to parse the big long string . What ' s the quick - and - dirty way to parse an event message ? Well , you can look at how the event message looks , and you can manually write a string . find over that string to extract the information you need . For example , What ' s the clean - and - easy way ? Well , first , you should extract GlobalStrings . lua out of your WoW install . Then , you will want to look through that file for the variable that contains the template of the message you ' re looking for . In our case , it is This variable is the key to this method . Basically , Blizzard has already done the work of creating translations for every language that WoW supports , and they have provided this GlobalStrings . lua to map those translations to common variable names . We just need to figure out how to harness this information . Harnessing this information yourself can be quite a task . You need to revise your code to look at this variable , transform the value of this variable into a value suitable for your pattern variable , run your pattern , and then be able to reorder the parameters correctly based on the value of this variable . However , each AddOn author should not have to do nearly this much work . There ' s a library called MarsMessageParser . I don ' t have a link to that file directly , but you will find it as a separate file inside of this AddOn . You can copy MarsMessageParser . lua out of MarsNeedyGreedy and put it in your AddOn , say MyHonorTracker . Make sure MarsMessageParser . lua is listed before MyHonorTracker . lua in your MyHonorTracker . toc file or your MyHonorTracker . xml file . Then , all of the above code can be trimmed down to just this : Well , that isn ' t exactly true : MarsMessageParser also needs to be initialized . Fortunately , this can be done with just one line ( put this line somewhere in your initialization area ) : The parameters to the RegisterFunction function are as follows : The parameters to the ParseMessage function are as follows : MarsMessageParser will take care of reading the GlobalStrings . lua , creating the correct pattern for the current locale , re - ordering the parameters accordingly , and finally calling MyHonorTrackingFunction with three parameters : killed , rank , and honor . What ' s the Clean - And - Not - So - Easy way ? If you don ' t want to download the MarsMessageParser and include it in your addon , the thing you ' re left to do is find a way to do it yourself . But rather than develop a ton of code , you just want to " hardwire " your addon for just the string you want to use , rather than the infinite amount of infinite variables in every string in GlobalStrings . lua . Well , let ' s look at FACTION _ STANDING _ INCREASED . According to GlobalStrings . lua , this says " Reputation with % s increased by % d . " Well , to make it work like the strings at the top , we ' d need to replace % s and % d with ( . + ) . But how do we do that ? Here ' s how : This example will properly parse the string , and return all the information we need . How was this achieved ? By using a % in front of the % s , it tells it to look for % s in stead of a space , which is what % s would normally be looking for . This way , even though we have to hardcode in the strings we want , we can also don ' t have to bother with translations .