Saturday, February 12, 2011

How To: Edit Global Strings

How To: Edit Global Strings
Current Wowcraft build: 4.0.6


You know what I don't like? Spam. You know what is spammy? All this crap:

Your share of the loot is 2 Silver, 14 Copper. (21 Copper deposited to guild bank)
Your share of the loot is 12 Silver, 27 Copper. (1 Silver, 23 Copper deposited to guild bank)
Your share of the loot is 12 Silver, 56 Copper. (1 Silver, 26 Copper deposited to guild bank)
Your share of the loot is 12 Silver, 22 Copper. (1 Silver, 22 Copper deposited to guild bank)
Your share of the loot is 9 Silver, 11 Copper. (91 Copper deposited to guild bank)
Your share of the loot is 13 Silver, 35 Copper. (1 Silver, 33 Copper deposited to guild bank)
Your share of the loot is 9 Silver, 27 Copper. (93 Copper deposited to guild bank)
Your share of the loot is 2 Silver, 92 Copper. (29 Copper deposited to guild bank)
Your share of the loot is 10 Silver, 25 Copper. (1 Silver, 2 Copper deposited to guild bank)
Your share of the loot is 13 Silver, 16 Copper. (1 Silver, 32 Copper deposited to guild bank)
Your share of the loot is 5 Silver, 12 Copper. (51 Copper deposited to guild bank)
Your share of the loot is 6 Silver, 51 Copper. (65 Copper deposited to guild bank)
Your share of the loot is 10 Silver, 92 Copper. (1 Silver, 9 Copper deposited to guild bank)
Your share of the loot is 12 Silver, 16 Copper. (1 Silver, 22 Copper deposited to guild bank)
Your share of the loot is 6 Silver, 93 Copper. (69 Copper deposited to guild bank)
Your share of the loot is 6 Silver, 24 Copper. (62 Copper deposited to guild bank)
Your share of the loot is 7 Silver, 38 Copper. (74 Copper deposited to guild bank)


You know what's not spammy?
Your share: 7 s, 38 c. (74 c to gbank)

Look how much less space that takes up. This is done by editing global strings. At first the task might seem daunting, but just remember you don't have to edit all the strings, only the one you want. Here is a quickie tutorial on editing global strings.

First, somewhere like maybe your desktop, or maybe a small storage folder next to your main Wow folder, make a New Text Document, then rename it to something like EditedGlobalStrings.lua (make sure it does not end in .txt). You will end up with 2 copies of this file, one in a 'safe' place like this where it won't get over-written, and the other will be your 'active' copy. Open up your file in Notepad or your favorite text editor.

Next, go to
http://wowprogramming.com/utils/xmlbrowser/test/FrameXML/GlobalStrings.lua
Do not be afraid of all those strings. You don't need to worry about most of them. Think of something you wish to alter, like "Your share of the loot". Use the find function (in MSIE you still need to use ctrl F, in Firefox you can just start typing /your share, and it will start the search) to look for the text you want to change. You may need to use F3, but you should pretty quickly find these lines:
LOOT_MONEY_SPLIT = "Your share of the loot is %s.";
LOOT_MONEY_SPLIT_GUILD = "Your share of the loot is %s. (%s deposited to guild bank)";

Copy that entire line into your EGS lua. Now, make the non-variable part (the %s part) say whatever you want. Mine look like
LOOT_MONEY_SPLIT = "Your share: %s.";
LOOT_MONEY_SPLIT_GUILD = "Your share: %s. (%s to gbank)";

This line is for when you are not grouped and loot money:
YOU_LOOT_MONEY_GUILD = "You loot %s. (%s to gbank)";

Save your EditedGlobalStrings.lua. Now we need to put it someplace where the game will know how to read it. You do not overwrite the base global strings in the core code of the game; those are always there. What you do is 'fool' the game into using your strings instead of the base strings. Sort of like having an apple on the counter every morning that you eat for breakfast, but one morning someone has put a banana right in front of the apple, and you take the banana instead. Mm, potassium.

The easiest way to do this is to choose an existing addon that you know you will run on every character that you want to be affected by your edited strings. I use Altoholic on every.character.ever. So I save my EGS.lua and close the Notepad, and open up my Interface/Addons/Altoholic folder and just drop it right in the main folder. Now we have to tell Altoholic to load that lua.

Open the Altoholic.toc (or the .toc file of whatever addon you are using). Go down to the very bottom and just add the name of your file, mine being EditedGlobalStrings.lua. Save the .toc, close the Notepad, and fire up Wowcraft. Now, all characters that have that addon enabled will use your banana-strings instead of the default apple-strings.

Just make sure to always edit your safe file and then drop it into the addon that you've told to use it. Whenever you update the addon that uses your active file, it will wipe out your lua and your edited toc, and you'll have to go put it back in and re-edit the toc. This is why you want a safe copy, one that is not in danger of being over-written.

As you play through the game, you can keep an eye out for things you wish would take up less space in the chat box, then search through the list up there, find the string, and play around with how you want it to look. Happy customizing!