PDA

View Full Version : getBitmapName()



Brenn
November 12th, 2008, 15:12
Is there something a bug with the getBitmapName() function for bitmap widgets? It's returning "" for me on bitmap widgets that I have a bitmap set for... The widgets are displaying properly and all, that function just doesn't seem to work.

my code in progress-


function update()
local totalWounds = totalDatanode.getValue();
if totalWounds > table.maxn(woundWidgets) then
numToAdd = totalWounds - table.maxn(woundWidgets);
print("Adding this many wound widgets: " .. tostring(numToAdd));
for i = 1, numToAdd do
table.insert(woundWidgets, addBitmapWidget("wound_none"));
end
end
for i, v in ipairs(woundWidgets) do
if table.maxn(woundWidgets) < 11 then
v.setPosition("topleft", (i+((i-1)*15)), 17);
else
if i < 11 then
v.setPosition("topleft", (i+((i-1)*15)), 10);
else
v.setPosition("topleft", ((i-10)+((i-11)*15)), 26);
end
end
v.setVisible(true);
end
local shockDmg = shockDatanode.getValue() - previousShockDmg;
local killingDmg = killingDatanode.getValue() - previousKillingDmg;
print("Shock Damage to apply: " .. shockDmg);
print("Killing Damage to apply: " .. killingDmg);
if (shockDmg > 0) or (killingDmg > 0) then
if shockFirst then
for i, v in ipairs(woundWidgets) do
print("bitmap name: " .. v.getBitmapName());
if v.getBitmapName() == "wound_none" then
if shockDmg > 0 then
v.setBitmap("wound_shock");
shockDmg = shockDmg - 1;
end
end
end
if shockDmg > 0 then
--SOMEWHERE IN HERE I NEED TO UPDATE THE killingDatanode value
--THERE IS A LOGIC PROBLEM WITH CARRYOVER.
--ARMOR CODE NEEDS TO BE IMPLEMENTED.
killingDmg = killingDmg + shockDmg;
end
for i, v in ipairs(woundWidgets) do
if (v.getBitmapName() == "wound_none") or (v.getBitmapName() == "wound_shock") then
if killingDmg > 0 then
v.setBitmap("wound_killing");
killingDmg = killingDmg - 1;
end
end
if killingDmg > 0 then
print("Bleedthrough Damage: " .. killingDmg);
--WRITE ROUTINE FOR BLEEDTHROUGH
end
end
else
--WRITE KILLING FIRST ROUTINE
end
else
end
end

Brenn
November 13th, 2008, 12:27
I just ended up working around this, but I'm fairly sure I wasn't doing anything wrong.