My DM is getting this error "Script Error: [string "scripts/manager_token.lua"]:1009: bad argument #1 to 'setBitmap' (string expected, got table)" but not sure what's causing it.
My DM is getting this error "Script Error: [string "scripts/manager_token.lua"]:1009: bad argument #1 to 'setBitmap' (string expected, got table)" but not sure what's causing it.
@Styrmir
Weird, I'm having the same behavior on two different PCs. It's worth mentioning that I'm running published modules, given the map image incompatibility issues mentioned in the old Advanced Kombat extension.
One other note of something I just noticed when redownloading the .ext files: The image folder name has changed. For those of us migrating over from the AK extension, the images folder that you put in your Tokens/Host folder was called "items", it's now supposed to be called "Combat Enhancer" (a better name, but a change nonetheless). I wonder if that's what's been contributing to some of the console errors.
I think I found the problem with some people getting the message "The ranged attack is OUT OF RANGE and misses. Dagger (0) from 31 feet." IE ranges aren't being detected from some char sheets.
The code starts looking for weapons in the weapon list starting with 1 then on till it doesn't find any more weapons. IE charsheet.id-00002.weaponlist.id-00001 then charsheet.id-00002.weaponlist.id-00002 etc etc. However FG doesn't maintain the list like that. For example if I look at the xml for a char that has the problem I see the below weaponlist. Notice it starts with weapon 00004 and then 00006 etc. I believe that when a weapon is deleted it causes this issue IE delete weapon 1 and the other weapon don't get renumbered down to start with 1 again. Perhaps a "quick" fix would be to remove all weapons from the char then re-add them so they are save sequentially starting with 1 again.
<weaponlist>
<id-00004>
<ammo type="number">12</ammo>
<attackbonus type="number">0</attackbonus>
<carried type="number">2</carried>
<damagelist>
<id-00001>
<bonus type="number">0</bonus>
<dice type="dice">d4</dice>
<stat type="string">base</stat>
<statmult type="number">1</statmult>
<type type="string">bludgeoning</type>
</id-00001>
</damagelist>
<isidentified type="number">1</isidentified>
<maxammo type="number">20</maxammo>
<name type="string">Sling</name>
<prof type="number">1</prof>
<properties type="string">Ammunition (range 30/120)</properties>
<shortcut type="windowreference">
<class>item</class>
<recordname>....inventorylist.id-00018</recordname>
</shortcut>
<type type="number">1</type>
</id-00004>
<id-00006>
<attackbonus type="number">0</attackbonus>
<attackstat type="string">dexterity</attackstat>
<carried type="number">2</carried>
<damagelist>
<id-00001>
<bonus type="number">0</bonus>
<dice type="dice">d6</dice>
<stat type="string">dexterity</stat>
<type type="string">piercing</type>
</id-00001>
</damagelist>
<isidentified type="number">1</isidentified>
<maxammo type="number">0</maxammo>
<name type="string">Shortsword</name>
<prof type="number">1</prof>
<properties type="string">Finesse, light</properties>
<shortcut type="windowreference">
<class>item</class>
<recordname>....inventorylist.id-00021</recordname>
</shortcut>
<type type="number">0</type>
</id-00006>
<id-00007>
<attackbonus type="number">0</attackbonus>
<attackstat type="string">dexterity</attackstat>
<carried type="number">2</carried>
<damagelist>
<id-00001>
<bonus type="number">0</bonus>
<dice type="dice">d4</dice>
<stat type="string">dexterity</stat>
<type type="string">piercing</type>
</id-00001>
</damagelist>
<isidentified type="number">1</isidentified>
<maxammo type="number">0</maxammo>
<name type="string">Dagger</name>
<prof type="number">1</prof>
<properties type="string">Finesse, light, thrown (range 20/60)</properties>
<shortcut type="windowreference">
<class>item</class>
<recordname>....inventorylist.id-00022</recordname>
</shortcut>
<type type="number">0</type>
</id-00007>
<id-00008>
<ammo type="number">0</ammo>
<attackbonus type="number">0</attackbonus>
<attackstat type="string">dexterity</attackstat>
<carried type="number">2</carried>
<damagelist>
<id-00001>
<bonus type="number">0</bonus>
<dice type="dice">d4</dice>
<stat type="string">dexterity</stat>
<statmult type="number">1</statmult>
<type type="string">piercing</type>
</id-00001>
</damagelist>
<isidentified type="number">1</isidentified>
<maxammo type="number">2</maxammo>
<name type="string">Dagger</name>
<prof type="number">1</prof>
<properties type="string">Finesse, light, thrown (range 20/60)</properties>
<shortcut type="windowreference">
<class>item</class>
<recordname>....inventorylist.id-00022</recordname>
</shortcut>
<type type="number">2</type>
</id-00008>
</weaponlist>
@Thristerhall
Thanks for that, that does make sense.
The code will iterate through the item list by counting the ID's upwards, until there is a missing one. At which point it exits the loop.
Hadn't considered weapons getting deleted, hence breaking the iteration.
Same would go with spells.
Which explains why it wouldn't come up during my testing, as I wouldn't be deleting the test weapons added.
I'll see if I can find a solution that isn't to resource heavy.
ps. The quick fix is indeed that to remove all the weapons to empty the list. That way the iterator should be reset to 00001 for the first weapon, then onward I'd imagine.
Is this in referral to the condition issues you were having?
Does this only happen when you're using a map in module?
Does it happen for all maps in that particular module or just one?
Does it only happen with certain settings turned on?
What module are you using?
What map within the module?
What OS are you using?
Does this only happen with particular NPCs or PCs in play?
Are they in the CT and on the map, or only one of the two?
Any other further specifics that could narrow it down?
Thanks Trenloe, I reckon that might work. Currently it's a manually created datastring lookup, so I might change that to using the APIs instead, as it turns out there may be gaps in the count after items get deleted.
Token Helper v1.1.5 Relased
v1.1.5 (April 16th, 2019)
* Bugfix: If weapon or spell was deleted from the actions tab, the range finder would break at that point as there would be a gap in the iteration numbers. Fix: DB.getChildren used instead of manual iterator. [scripts/ranged_attacks.lua: getWeaponRanges5e]
Great Extension...
How do I get the Green checks or Red X's off the tokens when my players make the NPC save?