0
I have recently been "learning" mecher with programming, but I’m still very lay. And recently I developed a HUD where I play, but I’d like to change the string format. his.
local function AddLoot(id, new)
local newVal = new * GetValue(id)
Looted = Looted + newVal
local hud = LootedHUDs[id]
if hud then
hud.count = hud.count + new
hud.hud:SetText(hud.count .." (".. GetValue(id) * hud.count .." gp)")
else
local hud = {}
hud.count = new
NewlyLooted = NewlyLooted + 1
hud.posy = TotalLoot.posy
hud.img = HUD.New(Hudx-5, hud.posy-5, id, textColor.r, textColor.g, textColor.b)
hud.img:SetItemSize(10)
hud.name = HUD.New(Hudx+30, hud.posy, Item.GetName(id), countColor.r, countColor.g, countColor.b)
hud.hud = HUD.New(Hudx+165, hud.posy, new .." (".. newVal .." gp)", textColor.r, textColor.g, textColor.b)
LootedHUDs[id] = hud
TotalLoot.posy = TotalLoot.posy + 15
TotalLoot.hud:SetPosition(Hudx + 80, TotalLoot.posy + 15)
TotalLootTitle.hud:SetPosition(Hudx, TotalLoot.posy + 15)
end
end
That part [ Hud.Hud = HUD.New(Hudx+165, Hud.Posy, new ." (".. newVal .." gp)", textColor. r, textColor. g, textColor. b. b) ] is where it shows what was counted, but it does not separate the thousands. For example:
total loot: 1000000 gps <- so it gets
total loot: 1,000,000 gps <- so I want it to stay.
Could someone help me ?
Francisco! Thanks for the information but adding it is not transforming the value.
– Thanatos
@Thanatos probably you would have to change the if from above too:
hud.hud:SetText(hud.count .." (".. addSeparators(GetValue(id) * hud.count) .." gp)")
– Francisco
Thank you my friend! I made the adjustment and was!
– Thanatos