Roll20APIScripts
Roll20APIScripts copied to clipboard
[BeyondImporter] Spell attack bonus missing proficiency
I imported the spell "Guiding Bolt" and the attack bonus was set to +3 (WIS) instead of +3 (WIS) +5 (PROF)
And interestingly enough, this is happening despite the fact that "proficiency" is checked. Toggling the checkbox will fix it, but will continue looking for a solution.
I assume that the checkbox just populates one of the formula fields? Could check OGL html to see what it does on checkbox value change maybe?
Exporting the JSON before and after toggling the checkbox shows that the following attribute was missing before doing so:
{
"name": "repeating_attack_-LOiXRnW0FILQcKhCP4l_atkprofflag",
"current": "(@{pb})",
"max": "",
"id": "-LOiZA9dHjzkJo6BynRs"
}
We don't actually set any of the attack values ourselves. This attribute be set when the sheet creates the attack after this attribute was set:
{
"name": "repeating_spell-cantrip_-LOiXFnDgHOLmqHE-dmv_spelloutput",
"current": "ATTACK",
"max": "",
"id": "-LOiXRmzKt1noBAfyGt7"
}
what is repeating_spell….._spellattack? It is being set directly from the Beyond value to the number 2 (in this case.) Have you looked into what that is?
I wonder if maybe we still have some trouble with triggers where it might not have written this value yet when the ATTACK update trigger runs.
[edit: according to the HTML this value should be None, Melee, or Ranged. And I think we set it to '2']
unrelated: what are you using for JSON export? that seems very helpful
unrelated: what are you using for JSON export? that seems very helpful
https://chrome.google.com/webstore/detail/roll20-enhancement-suite/fadcomaehamhdhekodcpiglabcjkepff
what is repeating_spell….._spellattack? It is being set directly from the Beyond value to the number 2 (in this case.) Have you looked into what that is?
none, melee, ranged
ok I was wrong. there is code in there to MODIFY the input json from the value '2' to 'ranged' which basically fooled me during code inspection because I was looking at the unmodified input JSON. I still think modifying the input JSON is not a good idea, because it becomes hard to debug sometimes
I would replace this section with a substitution table to convert the integers in the input to the enums that roll20 needs on write
Just additional info... apparently the compendium version of the spell is also missing that attribute, yet it works fine.
I found the difference. The spell attacks inherit the code from the weapon attacks, so atkattr_base is set to "@(wisdom_mod}" instead of "spell" as it is in the compendium
edit: nope that's just another attack attribute. going back to searching
ok I wrote the tool I mentioned earlier today, which flattens the exported JSON into something that is sorted and can be diffed.
Then I ran the current development version of our code to import my character (without your temp fix) and exported the JSON.
Then I deleted the Spell "Guiding Bolt" and put it back from the Compendium and exported again.
The diff shows no smoking guns other than spell_ability which we already tried.
Here is the total diff of the two character states (left is our version, right is the compendium one.) 44a45,48 > drop_category = > drop_content = > drop_data = > drop_name = 146a151 > tab = core 384,386c389,391 < attack[Guiding Bolt].atk_desc = ranged Spell Attack. < attack[Guiding Bolt].atkattr_base = @{wisdom_mod} < attack[Guiding Bolt].atkbonus = +3 --- > attack[Guiding Bolt].atk_desc = > attack[Guiding Bolt].atkattr_base = spell > attack[Guiding Bolt].atkbonus = +8 390c395 < attack[Guiding Bolt].atkrange = 120ft. --- > attack[Guiding Bolt].atkrange = 120 feet 401c406 < attack[Guiding Bolt].rollbase = @{wtype}&{template:atkdmg} {{mod=@{atkbonus}}} {{rname=@{atkname}}} {{r1=[[@{d20}cs>@{atkcritrange} + 3[WIS]]]}} @{rtype}cs>@{atkcritrange} + 3[WIS]]]}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[4d6]]}} {{dmg1type=Radiant }} @{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[4d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{hldmgcrit=[[(1*?{Cast at what level?|Level 1,0|Level 2,1|Level 3,2|Level 4,3|Level 5,4|Level 6,5|Level 7,6|Level 8,7|Level 9,8})d6]]}} {{spelllevel=@{spelllevel}}} {{innate=@{spell_innate}}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{global_damage_mod_type}}} ammo=@{ammo} @{charname_output} --- > attack[Guiding Bolt].rollbase = @{wtype}&{template:atkdmg} {{mod=@{atkbonus}}} {{rname=@{atkname}}} {{r1=[[@{d20}cs>@{atkcritrange} + 3[WIS] + 5[PROF]]]}} @{rtype}cs>@{atkcritrange} + 3[WIS] + 5[PROF]]]}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[4d6]]}} {{dmg1type=Radiant }} @{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[4d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{hldmgcrit=[[(1*?{Cast at what level?|Level 1,0|Level 2,1|Level 3,2|Level 4,3|Level 5,4|Level 6,5|Level 7,6|Level 8,7|Level 9,8})d6]]}} {{spelllevel=@{spelllevel}}} {{innate=@{spell_innate}}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{global_damage_mod_type}}} ammo=@{ammo} @{charname_output} 404c409 < attack[Guiding Bolt].savedc = (@{wisdom_mod}+8+@{spell_dc_mod}+@{pb}) --- > attack[Guiding Bolt].savedc = (@{spell_save_dc}) 1285c1290 < spell-1[Guiding Bolt].spell_ability = @{wisdom_mod}+ --- > spell-1[Guiding Bolt].spell_ability = spell 1287,1288c1292,1293 < spell-1[Guiding Bolt].spellattack = ranged < spell-1[Guiding Bolt].spellcastingtime = 1 Action --- > spell-1[Guiding Bolt].spellattack = Ranged > spell-1[Guiding Bolt].spellcastingtime = 1 action 1290,1293d1294 < spell-1[Guiding Bolt].spellcomp_materials = < spell-1[Guiding Bolt].spellcomp_s = {{s=1}} < spell-1[Guiding Bolt].spellcomp_v = {{v=1}} < spell-1[Guiding Bolt].spellconcentration = 0 1297c1298 < spell-1[Guiding Bolt].spellduration = 1 Round --- > spell-1[Guiding Bolt].spellduration = 1 round 1303,1306c1304 < spell-1[Guiding Bolt].spellprepared = 1 < spell-1[Guiding Bolt].spellrange = 120ft. < spell-1[Guiding Bolt].spellritual = 0 < spell-1[Guiding Bolt].spellsave = --- > spell-1[Guiding Bolt].spellrange = 120 feet 1307a1306 > spell-1[Guiding Bolt].spelltarget = A creature of your choice within range
the tool I wrote is now at https://github.com/derammo/roll20-char-flatten
here is another test result. This time I imported it, exported the JSON, opened the attack macro and unclicked/reclicked the Proficient checkbox and it fixed it (like we already knew.) Then I exported JSON again. I was curious if editing the attack fixed any of the other attributes where we have case differences or populated anything else, so here is the diff:
386c386
< attack[Guiding Bolt].atkbonus = +3
---
> attack[Guiding Bolt].atkbonus = +8
389a390
> attack[Guiding Bolt].atkprofflag = (@{pb})
401c402
< attack[Guiding Bolt].rollbase = @{wtype}&{template:atkdmg} {{mod=@{atkbonus}}} {{rname=@{atkname}}} {{r1=[[@{d20}cs>@{atkcritrange} + 3[WIS]]]}} @{rtype}cs>@{atkcritrange} + 3[WIS]]]}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[4d6]]}} {{dmg1type=Radiant }} @{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[4d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{hldmgcrit=[[(1*?{Cast at what level?|Level 1,0|Level 2,1|Level 3,2|Level 4,3|Level 5,4|Level 6,5|Level 7,6|Level 8,7|Level 9,8})d6]]}} {{spelllevel=@{spelllevel}}} {{innate=@{spell_innate}}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{global_damage_mod_type}}} ammo=@{ammo} @{charname_output}
---
> attack[Guiding Bolt].rollbase = @{wtype}&{template:atkdmg} {{mod=@{atkbonus}}} {{rname=@{atkname}}} {{r1=[[@{d20}cs>@{atkcritrange} + 3[WIS] + 5[PROF]]]}} @{rtype}cs>@{atkcritrange} + 3[WIS] + 5[PROF]]]}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[4d6]]}} {{dmg1type=Radiant }} @{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[4d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{hldmgcrit=[[(1*?{Cast at what level?|Level 1,0|Level 2,1|Level 3,2|Level 4,3|Level 5,4|Level 6,5|Level 7,6|Level 8,7|Level 9,8})d6]]}} {{spelllevel=@{spelllevel}}} {{innate=@{spell_innate}}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{global_damage_mod_type}}} ammo=@{ammo} @{charname_output}
1294a1296
> spell-1[Guiding Bolt].spelldamage2 =
1295a1298
> spell-1[Guiding Bolt].spelldamagetype2 =
1306a1310
> spell-1[Guiding Bolt].spellsavesuccess =