PDA

View Full Version : Error in Warhammer Ruleset after 2.7 update



terrell
August 19th, 2010, 14:21
After loading the 2.7 update, I am getting a script error in the Warhammer Ruleset.
Script Error [String "scripts/combattracker_targeting.lua"]:26: attempt to index local 'V'[a userdata value]

This happens after a token on the map has been targeted and untargeted. The next time the token is targeted the script error occurs. Also, the token will no longer show being targeted on the combat tracker. It still shows it is being targeted on the map. Everything seems to work correctly the first time only.

Any suggestions?

I have to assume this is happening in this function:
function update(token)
for k, v in ipairs(widgets) do
v.destroy();
end
empty = true;

local ids = token.getTargetingIdentities();

local w, h = getSize();
local spacing = w / #ids;
if spacing > tonumber(iconspacing[1]) then
spacing = iconspacing[1];
end

for i = #ids, 1, -1 do
widgets[i] = addBitmapWidget("portrait_" .. ids[i] .. "_miniportrait");
widgets[i].setPosition("right", -(iconspacing[1]/2 + (i-1)*spacing), 0);
empty = false;
end

window.setDefensiveVisible(not isEmpty());
end

Moon Wizard
August 19th, 2010, 23:04
Yes, the quick fix is to add a "widgets = {};" line right before "empty = true".

This is actually bad widget cleanup code that has been shared quite a bit. I'm looking into why this didn't generate an error before.

Cheers,
JPG

terrell
August 20th, 2010, 12:30
Worked like a champ! You rock!

Thanks,
Terrell



Yes, the quick fix is to add a "widgets = {};" line right before "empty = true".

This is actually bad widget cleanup code that has been shared quite a bit. I'm looking into why this didn't generate an error before.

Cheers,
JPG