Thread Tools Display Modes
09-02-12, 12:08 AM   #1
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
Crash On Looting - Global String Edits

I crash when receiving quest rewards (items only, not money) or when looting a boss due to various global string edits that I've collected from threads here and there. I've looked through the latest list of strings and can't see anything that's amiss in mine, aside from removing the brackets around [Loot] -- which wouldn't affect quest rewards, and I crash with or without brackets.

Any ideas on where I'm going wrong? Am I missing something basic after staring at this for hours?

Here's the code in question:

Code:
LOOT_ROLL_ALL_PASSED = "|HlootHistory:%d|hLoot|h: Everyone passed on %s"
LOOT_ROLL_DISENCHANT = "%s has selected disenchant for %s"
LOOT_ROLL_DISENCHANT_SELF = "|HlootHistory:%d|hLoot|h: You have selected disenchant for %s"
LOOT_ROLL_GREED = "%s has selected greed for %s"
LOOT_ROLL_GREED_SELF = "|HlootHistory:%d|hLoot|h: You have selected greed for %s"
LOOT_ROLL_INELIGIBLE_REASON1 = "Your class may not roll need on this item."
LOOT_ROLL_INELIGIBLE_REASON2 = "You already have the maximum amount of this item."
LOOT_ROLL_INELIGIBLE_REASON3 = "This item may not be disenchanted."
LOOT_ROLL_INELIGIBLE_REASON4 = "You do not have an enchanter of skill %d in your group."
LOOT_ROLL_INELIGIBLE_REASON5 = "Need rolls are disabled for this item."
LOOT_ROLL_LOST_ROLL = "|HlootHistory:%d|hLoot|h: You have rolled %s - %d for %s"
LOOT_ROLL_NEED = "%s has selected need for %s"
LOOT_ROLL_NEED_SELF = "|HlootHistory:%d|hLoot|h: You have selected need for %s"
LOOT_ROLL_PASSED = "%s passed on %s"
LOOT_ROLL_PASSED_AUTO = "%s automatically passed on %s because he cannot loot that item."
LOOT_ROLL_PASSED_AUTO_FEMALE = "%s automatically passed on %s because she cannot loot that item."
LOOT_ROLL_PASSED_SELF = "|HlootHistory:%d|hLoot|h: You passed on %s"
LOOT_ROLL_PASSED_SELF_AUTO = "|HlootHistory:%d|hLoot|h: You automatically passed on %s because you cannot loot that item."
LOOT_ROLL_ROLLED_DE = "Disenchant roll of %d for %s by %s"
LOOT_ROLL_ROLLED_GREED = "Greed roll of %d for %s by %s"
LOOT_ROLL_ROLLED_NEED = "Need roll of %d for %s by %s"
LOOT_ROLL_ROLLED_NEED_ROLE_BONUS = "Need roll of %d for %s by %s + Role Bonus"
LOOT_ROLL_STARTED = "|HlootHistory:%d|hLoot|h: %s"
LOOT_ROLL_WON = "%s won %s"
LOOT_ROLL_WON_NO_SPAM_DE = "|HlootHistory:%d|hLoot|h: %s (Disenchant - %d) |cffffffff+|r %s"
LOOT_ROLL_WON_NO_SPAM_GREED = "|HlootHistory:%d|hLoot|h: %s (Greed - %d) |cffffffff+|r %s"
LOOT_ROLL_WON_NO_SPAM_NEED = "|HlootHistory:%d|hLoot|h: %s (Need - %d) |cffffffff+|r %s"
LOOT_ROLL_YOU_WON = "|cffffffff+|r %s"
LOOT_ROLL_YOU_WON_NO_SPAM_DE = "|HlootHistory:%d|hLoot|h: You (Disenchant - %d) |cffffffff+|r %s"
LOOT_ROLL_YOU_WON_NO_SPAM_GREED = "|HlootHistory:%d|hLoot|h: You (Greed - %d) |cffffffff+|r %s"
LOOT_ROLL_YOU_WON_NO_SPAM_NEED = "|HlootHistory:%d|hLoot|h: You (Need - %d) |cffffffff+|r %s"
LOOT_DISENCHANT_CREDIT = "+  %s was disenchanted by %s."
ERR_QUEST_REWARD_EXP_I = "+  %d xp."
ERR_QUEST_REWARD_ITEM_S = "+ %s"
ERR_QUEST_REWARD_MONEY_S = "+ %s"
ERR_QUEST_REWARD_ITEM_MULT_IS = "+  %d %s|cffffffffs|r."
__________________
"Someday we'll look back on this, laugh nervously and quickly change the subject."

"The truth is like sunlight: people used to think it was good for you."
  Reply With Quote
09-02-12, 05:29 AM   #2
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
I had an similar issue, where my custom stats on items strings made it crash, I used $ that was Cata, but later they changed it to % and that made it crash, hehe. Make sure you look at the new strings and translate those, keeping the number of variables intact. Perhaps some changed, some were added, removed, e.g. That's enough to start a crash. "ExportInterfaceFiles code" and start fresh.
__________________
Profile: Curse | Wowhead
  Reply With Quote
09-02-12, 05:33 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I'm not sure what the question is. Are you trying to edit global strings, or use them? You shouldn't be editing strings, as that creates all kinds of problems. To use them, do something like
Lua Code:
  1. -- this translates and prints
  2. -- Everyone passed on: %s
  3. -- automatically, as the game itself does the translating for you
  4. Print(LOOT_ROLL_ALL_PASSED)
If you edit the global strings in any way, shape, or form, yes, you will crash because the game expects something, but you changed it, so boom.
  Reply With Quote
09-02-12, 06:28 AM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Editing globals depends on several factors, the global and what addosn you run. So far I've edited some globals too, and no other addons use them so they don't crash either. It's important to not local variable global strings in case of situations like this where the string changed. Other than that, the crash is due to conflict of interests I suspect. Does it happen when you only load your string overrides?
__________________
Profile: Curse | Wowhead
  Reply With Quote
09-02-12, 07:02 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Vladinator View Post
"ExportInterfaceFiles code" and start fresh.
You can also just look at them online:

https://github.com/phanx/wow-globalstrings
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-02-12, 07:10 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by myrroddin View Post
You shouldn't be editing strings, as that creates all kinds of problems. ... If you edit the global strings in any way, shape, or form, yes, you will crash because the game expects something, but you changed it, so boom.
I'm not sure what strings you've been editing, or what you've been doing to them, but changing a string is perfectly safe. The only caveat is that if the string contains substitution tokens -- things like %s or %d or %2$s -- you need to make sure that your new string also contains all of those tokens, in the same order. Well, it's okay to switch up the order if the tokens are all %1$s and %2$d types, but if they are plain %s %d %0.1f they must be in the same order.

If the tokens are missing, or in the wrong order, then the values being passed to Lua functions like string.format -- or their C equivalents -- are incorrect. If the values are being handled in Lua (eg. the game's FrameXML code, or another addon) then you should get a Lua error. If the values are being handled in C (eg. populating the tooltip with unit data) then you may well crash the client, though you should report such crashes to Blizzard so they can fix them.

If you want to get rid of some part of the string that includes a substitution token, you'll need to find another way to do it. For example, if the final, formatted string is shown in the chat frame, you should use the chat filtering API to remove the unwanted parts. Same goes if you want to change the order in which tokens appear.

Check your strings against Blizzard's current global strings for your game client's locale, and make sure your tokens are all correct.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-02-12, 08:45 AM   #7
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
Yup, it happens only with the string edits loaded. Any time I loot a boss or receive a quest item, boop - disconnected. It, of course, doesn't happen with them disabled (or the ones listed removed from the file).

I've been comparing the strings in the file you listed, Phanx, over the last few days and I honestly can't see what's causing me to crash. That's why I'm so confused. At most, I remove a few words and no tokens. As far as I can see, all tokens are in the same order but I'm obviously missing something.

@ Myroddin I've been replacing strings like this with no problem for ages.
__________________
"Someday we'll look back on this, laugh nervously and quickly change the subject."

"The truth is like sunlight: people used to think it was good for you."
  Reply With Quote
09-02-12, 09:30 AM   #8
Farmbuyer
A Cyclonian
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 43
Undo all your edits. Load the game and make it sure it all works.

Restore half your edits. Load the game and see what happens.

If it crashes, undo half of the restored half. If it works, restore the other half of the original instead. Load the game and see what happens.

Repeat as needed, continuing to narrow down which edit(s) are responsible. This kind of search chops down the search space very quickly.
  Reply With Quote
09-03-12, 02:32 PM   #9
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
This is getting to be incredibly confusing. I had no problems running Vortex Pinnacle last night, but crashed again in Grim Batol without changing anything. The search continues.
__________________
"Someday we'll look back on this, laugh nervously and quickly change the subject."

"The truth is like sunlight: people used to think it was good for you."
  Reply With Quote
09-03-12, 03:04 PM   #10
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
I think I figured it out. I did, in fact, have the tokens reversed in one string that was actually not listed in my original post: faction_standing_increased. The crash was happening on characters that aren't fully exalted with my guild, which is why it happened sporadically last night.

.. At least I hope that's what's happening. I'll go test it.
__________________
"Someday we'll look back on this, laugh nervously and quickly change the subject."

"The truth is like sunlight: people used to think it was good for you."
  Reply With Quote
09-05-12, 08:37 PM   #11
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
I had a very similar issue when I logged in after patch. Game crashing when doing various stuff, removed my globals and disconnects stopped. I actually followed a few threads here and grabbed the code that people were posting. I do not really understand any of this coding stuff =p but love having these nifty little changes to my ui!

I have a massive long list of globals and instead of me just throwing it away, is there any chance you would post your list again with the fixed version?

If it is far too cheeky for me to ask I apologise and I will try to someday get round to figuring it all out
  Reply With Quote
09-05-12, 09:19 PM   #12
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
Sure, here's what I have so far with no crashes in the last couple days.

-- Loot nubbins, inc. currency loot.
CREATED_ITEM = "%s |cffffffff+ %s|r"
CREATED_ITEM_MULTIPLE = "%s |cffffffff+ %sx%d|r"
LOOT_ITEM_CREATED_SELF = "|cffffffff+ %s|r"
LOOT_ITEM_CREATED_SELF_MULTIPLE = "|cffffffff+ %sx%d|r"
YOU_LOOT_MONEY = "|cffffffff+ %s|r"
YOU_LOOT_MONEY_GUILD = "|cffffffff+ %s|r"
LOOT_MONEY = "|cffffffff%s + %s|r"
LOOT_MONEY_SPLIT = "|cffffffff+ %s|r"
LOOT_MONEY_SPLIT_GUILD = "|cffffffff+ %s|r"
LOOT_ITEM = "%s + %s"
LOOT_ITEM_MULTIPLE = "%s + %s x%d"
LOOT_ITEM_SELF = "+ %s"
LOOT_ITEM_SELF_MULTIPLE = "+ %s x%d"
LOOT_ITEM_PUSHED_SELF = "+ %s"
LOOT_ITEM_PUSHED_SELF_MULTIPLE = "+ %s x%d"
LOOT_ROLL_ALL_PASSED = "|HlootHistory:%d|hLoot|h: Everyone passed on %s"
LOOT_ROLL_PASSED_AUTO = "%s passed on %s"
LOOT_ROLL_PASSED_AUTO_FEMALE = "%s passed %s (auto)"
LOOT_ROLL_PASSED_SELF = "|HlootHistory:%d|hLoot|h: passed on %s"
LOOT_ROLL_PASSED_SELF_AUTO = "|HlootHistory:%d|hLoot|h: passed on %s."

CURRENCY_GAINED = "+ %s"
CURRENCY_GAINED_MULTIPLE = "+ %s x%d"


-- Quest nubbins.

NORMAL_QUEST_DISPLAY = "|cffffffff%s|r"
TRIVIAL_QUEST_DISPLAY = "|cffffffff%s (low level)|r"

ERR_QUEST_ACCEPTED_S = "%s accepted."
ERR_QUEST_REWARD_EXP_I = "+ %dxp"
ERR_QUEST_REWARD_ITEM_MULT_IS = "+ %d %ss"
ERR_QUEST_REWARD_ITEM_S = "+ %s"
ERR_QUEST_REWARD_MONEY_S = "|cffffffff+ %s|r"

-- Random nubbins.

ERR_AUCTION_SOLD_S = "%s sold."
CHAT_FLAG_AFK = "afk. "
CHAT_FLAG_DND = "dnd! "

-- Rep nubbins.

FACTION_STANDING_DECREASED = "- %s %d rep"
FACTION_STANDING_INCREASED = "+ %s %d rep"

The rep nubbins were crashing me, because the tokens were back to front. I'd like to find a way to have them that way again, but I'm just happy to not be crashing over and over anymore.

Hope you find that useful.
__________________
"Someday we'll look back on this, laugh nervously and quickly change the subject."

"The truth is like sunlight: people used to think it was good for you."

Last edited by Moxie : 09-06-12 at 11:06 AM. Reason: Fixed an errant space that might break stuff.
  Reply With Quote
09-05-12, 10:23 PM   #13
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
This is fantastic! Thank you sooo much! The loot ones were the ones I missed the most, hate seeing all that useless text

Such a quick response aswell, can't thank you enough =)
  Reply With Quote
09-05-12, 10:29 PM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Decabah View Post
FACTION_STANDING_DECREASED = "- %s %d rep"
FACTION_STANDING_INCREASED = "+ %s %d rep"

The rep nubbins were crashing me, because the tokens were back to front. I'd like to find a way to have them that way ...
There's no way to do that by editing the global strings. You'd need an addon that caught the messages as they were added to the chat frame, and changed them on the fly. Something simple like:

Code:
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(frame, event, message, ...)
    local which, faction, amount = strmatch(message, "^[%+%-] (%+) (%d+) rep$")
    if which and faction and amount then
        return false, (format("%s%d %s rep", which, amount, faction)), ...
    end
end)
CHAT_MSG_SYSTEM may not be the right event.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-08-12, 02:45 PM   #15
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
Thanks for that, Phanx. I'll have a tinker with it this weekend.
__________________
"Someday we'll look back on this, laugh nervously and quickly change the subject."

"The truth is like sunlight: people used to think it was good for you."
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Crash On Looting - Global String Edits

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off