Thread Tools Display Modes
02-12-11, 04:27 AM   #1
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Loot strings problem

Hello.

Sorry for creating an other topic in such a short period of time, but there's something that's been bugging me and I can't really figure out what's wrong with it.

These are defined in GlobalStrings.lua:

Code:
COPPER_AMOUNT = "%d Copper";
COPPER_AMOUNT_SYMBOL = "c";
COPPER_AMOUNT_TEXTURE = "%d\124TInterface\\MoneyFrame\\UI-CopperIcon:%d:%d:2:0\124t";

GOLD_AMOUNT = "%d Gold";
GOLD_AMOUNT_SYMBOL = "g";
GOLD_AMOUNT_TEXTURE = "%d\124TInterface\\MoneyFrame\\UI-GoldIcon:%d:%d:2:0\124t";

SILVER_AMOUNT = "%d Silver";
SILVER_AMOUNT_SYMBOL = "s";
SILVER_AMOUNT_TEXTURE = "%d\124TInterface\\MoneyFrame\\UI-SilverIcon:%d:%d:2:0\124t";
So to get coin icons to show in the chat frame rather than text, I simply did this:

Code:
COPPER_AMOUNT = COPPER_AMOUNT_TEXTURE
SILVER_AMOUNT = SILVER_AMOUNT_TEXTURE
GOLD_AMOUNT = GOLD_AMOUNT_TEXTURE
Or this:

Code:
COPPER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-CopperIcon:%d:%d:2:0\124t"
SILVER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-SilverIcon:%d:%d:2:0\124t"
GOLD_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-GoldIcon:%d:%d:2:0\124t"
The strange thing is that most of the time, it works just fine, but about 20% of the time it'll simply print the entire texture path, like this:



Anyone have an idea how I can prevent this?

Thanks.
  Reply With Quote
02-12-11, 07:04 AM   #2
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Looks like there's a value passed to the format that it doesn't like, in your example it's the 6904978~ part, which probably makes the texture far too wide and as such it fails. Dunno where that number is coming from though.. guess overwriting GlobalStrings can have unexpected results. Maybe you can try setting the size-related %d's to 0.

Like this:
Code:
COPPER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0\124t"
SILVER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0\124t"
GOLD_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0\124t"
__________________
Oh, the simulated horror!
  Reply With Quote
02-12-11, 08:14 AM   #3
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
That worked, thank you.
  Reply With Quote
02-12-11, 01:04 PM   #4
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
Thanks for this! Was looking for a way to do it for a long time.
__________________
"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
02-12-11, 09:24 PM   #5
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
Something that's bugging me about this is, how would I remove the comma in the printed chat message?

Before, it printed as "+ 27g 34s 23c" but now it's printing as ""+ 27[gold icon], 34[silver icon], 23[copper icon]".

The snippets below are what I'm using (credit to both previous posters in this thread):

Code:
"|cffffffff+|r |cffffffff%s"
Code:
COPPER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0\124t"
SILVER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0\124t"
GOLD_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0\124t"
__________________
"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
02-12-11, 09:53 PM   #6
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Decabah View Post
Something that's bugging me about this is, how would I remove the comma in the printed chat message?

Before, it printed as "+ 27g 34s 23c" but now it's printing as ""+ 27[gold icon], 34[silver icon], 23[copper icon]".

The snippets below are what I'm using (credit to both previous posters in this thread):

Code:
"|cffffffff+|r |cffffffff%s"
Code:
COPPER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0\124t"
SILVER_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0\124t"
GOLD_AMOUNT = "%d\124TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0\124t"
A gsub may work:
Code:
COPPER_AMOUNT = gsub(COPPER_AMOUNT, ",", "")
  Reply With Quote
02-12-11, 10:11 PM   #7
Moxie
A Cobalt Mageweaver
 
Moxie's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 206
That didn't seem to do anything. : (
__________________
"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
02-13-11, 05:32 PM   #8
Akkorian
A Flamescale Wyrmkin
 
Akkorian's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 111
Hi Decabah,

There’s nothing in the code you posted that actually adds any text to the chat frame. If you’re doing that yourself, could you post the rest of the code? If you’re letting Blizzard do it, and you’re just changing the global strings, which global string are you overwriting with "|cffffffff+|r |cffffffff%s" ?
__________________
“Be humble, for you are made of earth. Be noble, for you are made of stars.”
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Loot strings problem


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