
I'm getting an odd difference occurring when accessing a repeating row table on a character sheet from an API script using getAttrByName, and via ability macros or the chat window, which is causing multiple issues. I'm fairly new to API creation, so I may be doing something obviously wrong...
If I use the following code:
for (let i = 0; i < 24; i++) {
qty = getAttrByName( targetID, 'repeating_potions_$' + i + '_potionqty' );
mi = getAttrByName( targetID, 'repeating_potions_$' + i + '_potion' );
log('ID: '+targetID+' repeating_potions_$'+i+'_potion: '+qty+' '+mi);
};
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$0_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$1_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$2_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$3_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$4_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$5_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$6_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$7_potion: 0 -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$8_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$9_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$10_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$11_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$12_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$13_potion: 0 -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$14_potion: 0 -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$15_potion: 0 Cube-of-Force"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$16_potion: 0 -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$17_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$18_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$19_potion: 1 Magical-Sword"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$20_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$21_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$22_potion: -"
"ID: -MGOSZ7Pnz1Fn3t1W9Ja repeating_potions_$23_potion: -"
However, if I run the following in an Ability macro:
&{template:2Edefault}{{name=test}}{{desc=
repeating_potions_$0_potion: @{selected|repeating_potions_$0_potion}
repeating_potions_$1_potion: @{selected|repeating_potions_$1_potion}
repeating_potions_$2_potion: @{selected|repeating_potions_$2_potion}
repeating_potions_$3_potion: @{selected|repeating_potions_$3_potion}
repeating_potions_$4_potion: @{selected|repeating_potions_$4_potion}
repeating_potions_$5_potion: @{selected|repeating_potions_$5_potion}
repeating_potions_$6_potion: @{selected|repeating_potions_$6_potion}
repeating_potions_$7_potion: @{selected|repeating_potions_$7_potion}
repeating_potions_$8_potion: @{selected|repeating_potions_$8_potion}
repeating_potions_$9_potion: @{selected|repeating_potions_$9_potion}
repeating_potions_$10_potion: @{selected|repeating_potions_$10_potion}
repeating_potions_$11_potion: @{selected|repeating_potions_$11_potion}
repeating_potions_$12_potion: @{selected|repeating_potions_$12_potion}
repeating_potions_$13_potion: @{selected|repeating_potions_$13_potion}
repeating_potions_$14_potion: @{selected|repeating_potions_$14_potion}
repeating_potions_$15_potion: @{selected|repeating_potions_$15_potion}
repeating_potions_$16_potion: @{selected|repeating_potions_$16_potion}
repeating_potions_$17_potion: @{selected|repeating_potions_$17_potion}
repeating_potions_$18_potion: @{selected|repeating_potions_$18_potion}
repeating_potions_$19_potion: @{selected|repeating_potions_$19_potion}
repeating_potions_$20_potion: @{selected|repeating_potions_$20_potion}
repeating_potions_$21_potion: @{selected|repeating_potions_$21_potion}
repeating_potions_$22_potion: @{selected|repeating_potions_$22_potion}
repeating_potions_$23_potion: @{selected|repeating_potions_$23_potion}}}
I get the following result in the chat window:
test |
---|
repeating_potions_$0_potion: - repeating_potions_$1_potion: - repeating_potions_$2_potion: Cube-of-Force repeating_potions_$3_potion: - repeating_potions_$4_potion: - repeating_potions_$5_potion: - repeating_potions_$6_potion: Magical-Sword repeating_potions_$7_potion: - repeating_potions_$8_potion: - repeating_potions_$9_potion: - repeating_potions_$10_potion: - repeating_potions_$11_potion: - repeating_potions_$12_potion: - repeating_potions_$13_potion: - repeating_potions_$14_potion: - repeating_potions_$15_potion: - repeating_potions_$16_potion: - repeating_potions_$17_potion: - repeating_potions_$18_potion: - repeating_potions_$19_potion: - repeating_potions_$20_potion: - repeating_potions_$21_potion: - repeating_potions_$22_potion: - repeating_potions_$23_potion: - |
Why is e.g the Cube of Force at row $15 when recalled from the repeating_potions_$ repeating section via the getAttrByName, and at row $2 when recalled in a macro via @{selected|repeating_potions_$2_potion} from the same character sheet? I've checked the id and they are definitely the same...
Help!