Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Pre-order D&D 2024 now and get an exclusive bonus, only on Roll20!
Create a free account

[5e OGL] Adding spells to the attack list using CSA not working for non-SRD spells

So for very complicated and convoluted reasons I'm trying to add spells from the spells tab into the attacks list using ChatSetAttr by changing the spelloutput of the spells I want to add to ATTACK instead of SPELLCARD. This works fine for SRD drag and dropped spells like Ray of Frost or Burning Hands and does exactly what I need it to. However, with non-SRD spells, e.g. Ice Knife from Elemental Evil, a row is added to the attack list for the spell but the attributes are all blank and the attack is not linked to the spell in the spell tab at all. To further confuse things when I check the spell in the spells tab the output is set to ATTACK as CSA was supposed to do but rolling the spell outputs it as a spellcard and the only way to change it to an attack is to change the output to SPELLCARD and then back to ATTACK which makes a new attack row anyway, again the SRD spells don't have this problem. My best guess so far as to why this is happening is something to do with drag and drop attributes used for compendium entries but I don't know how or why that would make a difference here. As always, thanks in advance for any help anyone can provide.
Most likely you are missing the _spelllevel attribute for the spell. This is a value that is set when dragging from the compendium but users do not have direct access to this value. This would also cause the blank entry in the attacks section because spells follow the nomenclature repeating_spell-LEVEL_INDEX. If no level is set this results in repeating_spell-null_level, which does not exist, so there are no values.
1511543711

Edited 1511545452
Kyle G. said: Most likely you are missing the _spelllevel attribute for the spell. Thank you! This fixed the problem straight away. Can I ask how you found out that was the problem, in case something like this comes up again? EDIT: Apparently it hasn't fixed the problem entirely, it fixed it for all but one cantrip, Green-Flame Blade. I changed the spell level attribute to cantrip as I did for the other non-SRD cantrips which now work but the issue persists for GFB. Also, I'm now getting a second issue where all the first levels spells are being added to the attack list before the spells I have 'selected' are added to the attack list. These attacks have blank _spelllevel and _spellid attributes so I don't think they're properly connected to the spells they originate from but I can't seem to work out why they appear. I imagine it is something to do with my coding so this is probably quite hard to fix without seeing it for yourself but I'm at a loss here.
Kyle said: Kyle G. said: Most likely you are missing the _spelllevel attribute for the spell. Thank you! This fixed the problem straight away. Can I ask how you found out that was the problem, in case something like this comes up again? Trial and error unfortunately, but when I encountered this I inspected the row for the attack and saw that the spell id attribute for the attack had null  in the value. Kyle said: EDIT: Apparently it hasn't fixed the problem entirely, it fixed it for all but one cantrip, Green-Flame Blade. I changed the spell level attribute to cantrip as I did for the other non-SRD cantrips which now work but the issue persists for GFB. I would inspect the html to see if there are any strange values for the attack and/or spell. Also, I'm now getting a second issue where all the first levels spells are being added to the attack list before the spells I have 'selected' are added to the attack list. These attacks have blank _spelllevel and _spellid attributes so I don't think they're properly connected to the spells they originate from but I can't seem to work out why they appear. I imagine it is something to do with my coding so this is probably quite hard to fix without seeing it for yourself but I'm at a loss here. I have never seen that before. Are you using a ROW ID for the attacks, or are you using an index ($X)?
Kyle G. said: Kyle said: EDIT: Apparently it hasn't fixed the problem entirely, it fixed it for all but one cantrip, Green-Flame Blade. I changed the spell level attribute to cantrip as I did for the other non-SRD cantrips which now work but the issue persists for GFB. I would inspect the html to see if there are any strange values for the attack and/or spell. So the blank attack has no spelllevel attribute as before but it does have a spellid attribute which matches the ID of GFB in the spell list. GFB in the spell list has a _spelllevel as I set before and it does have an attackid attribute, *however*, the ID doesn't match up to any attack which explains the spellcard output when I 'roll' the spell. I don't understand why this is happening though especially as it works for the other cantrips. Other than those attributes I don't know where to even look for "strange values". I have never seen that before. Are you using a ROW ID for the attacks, or are you using an index ($X)? I'm currently using row indices for changing the spelloutput attribute in the spells list but I imagine I could change to row ID without a problem. As for the attacks lists I don't *think* I'm using either as I don't have to reference the attacks at all to add an entry to the list, just change to the _spelloutput to ATTACK. The only time I reference the attacks list is earlier in the macro when I delete the spell attacks from the list for when the new ones are added and I use row indices for this. I don't believe this is the issue as when I run the macro I can see all the spells are deleted from the attacks list properly before the new 'selected' ones are added. Thanks again for helping with this I feel like I'm getting a headache from all these problems haha.