System Message Parsing
I apologize if this has been answered else where but I have been unable to find what I am looking for.
I am looking to parse the name of the player (PlayerX) in each of the following system messages. PlayerX is already in a group. PlayerX declines your group invitation. PlayerX joins the party. PlayerX has joined the raid group Cannot find 'PlayerX'. I have some hacked together code that will do this below that I have taken from another mod. It takes the entire string from CHAT_MSG_SYSTEM and looks for the space in the first 4 cases or the ' in the last one and sends me back just the name. Code:
function RN_GetArgs(message, separator) Any information greatly appreciated as this is my first shot at a 'real' mod. |
If you take a look in FrameXML\GlobalStrings.lua, you'll find all of the game's localized format strings. You use the provided format string to create a pattern, which is used to parse the message. The awesome thing about this is that it's localized, so your mod will work overseas barring other problems.
local pattern = string.format(ERR_ALREADY_IN_GROUP_S, "(%a+)") local startIndex, endIndex, characterName = string.find(arg1, pattern) |
All times are GMT -6. The time now is 09:14 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI