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 .
×
Create a free account

Requesting some help with a Power Cards API I'm trying to create for a custom item.

First of all, hello everyone!  This is my first post here as I'm very much an amateur at API script writing. For the most part my experience stems from watching Nick Olivo's videos and customizing the scripts by piecing different ones together.  I also wanted to say how much I appreciate the API community here.  This may be my first post but I have been lurking and snatching scripts for some time.  :-) Ok, so here's my problem.  I'm trying to use PowerCards and the ChatSetAttr API's to make a macro for a custom weapon.  Basically the weapon is a spear that has charges and can cast a number of spells.  I have the majority of the macro working.  It was working exactly as I wanted until I tried to add a level selection dropdown for the Cure Wounds spell.  Unfortunately now no matter which spell I choose, the level selection dropdown pops up and the macro doesn't seem to do anything most of the time... occasionally it sends the correct spell card to chat but not often.  Where did I screw it up? !power {{ --name|Suor'Shal --leftsub|"Holy Spear" in Elvish --inlinereplace|SpearCharges|@{repeating_resource_$2_resource_right} --?? ?{What spell?|Conjure Flame - 1 charge,ConjureFlame|Cure Wounds - 1-4 charges,CureWounds|Lesser Restoration - 2 charges,LesserRestoration|Mass Healing Word - 4 charges,MassHealingWord|Recharge,Recharge} == ConjureFlame ?? skipTo *1|ConjureFlame --?? ?{What spell?|Conjure Flame - 1 charge,ConjureFlame|Cure Wounds - 1-4 charges,CureWounds|Lesser Restoration - 2 charges,LesserRestoration|Mass Healing Word - 4 charges,MassHealingWord|Recharge,Recharge} == LesserRestoration ?? skipTo *2|LesserRestoration --?? ?{What spell?|Conjure Flame - 1 charge,ConjureFlame|Cure Wounds - 1-4 charges,CureWounds|Lesser Restoration - 2 charges,LesserRestoration|Mass Healing Word - 4 charges,MassHealingWord|Recharge,Recharge} == CureWounds ?? skipTo *3|CureWoundsCharges --?? ?{What spell?|Conjure Flame - 1 charge,ConjureFlame|Cure Wounds - 1-4 charges,CureWounds|Lesser Restoration - 2 charges,LesserRestoration|Mass Healing Word - 4 charges,MassHealingWord|Recharge,Recharge} == MassHealingWord ?? skipTo *4|MassHealingWord --?? ?{What spell?|Conjure Flame - 1 charge,ConjureFlame|Cure Wounds - 1-4 charges,CureWounds|Lesser Restoration - 2 charges,LesserRestoration|Mass Healing Word - 4 charges,MassHealingWord|Recharge,Recharge} == Recharge ?? skipTo *5|Recharge --:CureWoundsCharges| --?? ?{How many charges?|1,CureWounds1|2,CureWounds2|3,CureWounds3|4,CureWounds4} == CureWounds1 ?? skipTo *21|CureWounds1 --?? ?{How many charges?|1,CureWounds1|2,CureWounds2|3,CureWounds3|4,CureWounds4} == CureWounds2 ?? skipTo *22|CureWounds2 --?? ?{How many charges?|1,CureWounds1|2,CureWounds2|3,CureWounds3|4,CureWounds4} == CureWounds3 ?? skipTo *23|CureWounds3 --?? ?{How many charges?|1,CureWounds1|2,CureWounds2|3,CureWounds3|4,CureWounds4} == CureWounds4 ?? skipTo *24|CureWounds4 --:ConjureFlame| --?? ~SpearCharges$ < 1 ?? skipTo *6|NotEnoughCharges --Spell: *1|Conjure Flame --Description: *1|An innocuous, flickering flame appears on the head of the spear which sheds light and warms creatures. --Range: *1|Bright light in a 10-foot radius and dim light for an additional 10 feet, & warms any creature in the light radius. --Duration: *1|1 hour --Cost: *1|1 charge --api_modattr *1|_silent _charid @{character_id} _repeating_resource_$2_resource_right|-1 --?? ~SpearCharges$ == 0 ?? skipTo *7|DestructionCheck --skipTo *8|EndOfCard --:CureWounds1| --?? ~SpearCharges$ < 1 ?? skipTo *9|NotEnoughCharges --Spell: *2|Cure Wounds --Description: *2|Heal a creature for 1d8 + @{wisdom_mod}. --Range: *2|Touch --Healing: *1|[[ [$CWHeal] 1d8 + @{wisdom_mod} ]] --Cost: *2|1 charge --api_modattr *2|_silent _charid @{character_id} _repeating_resource_$2_resource_right|-1 --?? ~SpearCharges$ == 0 ?? skipTo *10|DestructionCheck --skipTo *11|EndOfCard --:CureWounds2| --?? ~SpearCharges$ < 2 ?? skipTo *25|NotEnoughCharges --Spell: *5|Cure Wounds --Description: *5|Heal a creature for 2d8 + @{wisdom_mod}. --Range: *5|Touch --Healing: *3|[[ [$CWHeal] 2d8 + @{wisdom_mod} ]] --Cost: *5|2 charge --api_modattr *5|_silent _charid @{character_id} _repeating_resource_$2_resource_right|-2 --?? ~SpearCharges$ == 0 ?? skipTo *26|DestructionCheck --skipTo *27|EndOfCard --:CureWounds3| --?? ~SpearCharges$ < 3 ?? skipTo *28|NotEnoughCharges --Spell: *6|Cure Wounds --Description: *6|Heal a creature for 3d8 + @{wisdom_mod}. --Range: *6|Touch --Healing: *4|[[ [$CWHeal] 3d8 + @{wisdom_mod} ]] --Cost: *6|3 charge --api_modattr *6|_silent _charid @{character_id} _repeating_resource_$2_resource_right|-3 --?? ~SpearCharges$ == 0 ?? skipTo *29|DestructionCheck --skipTo *30|EndOfCard --:CureWounds4| --?? ~SpearCharges$ < 4 ?? skipTo *31|NotEnoughCharges --Spell: *7|Cure Wounds --Description: *7|Heal a creature for 4d8 + @{wisdom_mod}. --Range: *7|Touch --Healing: *5|[[ [$CWHeal] 4d8 + @{wisdom_mod} ]] --Cost: *7|4 charge --api_modattr *7|_silent _charid @{character_id} _repeating_resource_$2_resource_right|-4 --?? ~SpearCharges$ == 0 ?? skipTo *32|DestructionCheck --skipTo *33|EndOfCard --:LesserRestoration| --?? ~SpearCharges$ < 2 ?? skipTo *12|NotEnoughCharges --Spell: *3|Lesser Resoration --Description: *3|End one disease or one condition afflicting a creature, such as blinded, deafened, intoxicated, paralyzed, or poisoned. --Range: *3|Touch --Cost: *3|2 charges --api_modattr *3|_silent _charid @{character_id} _repeating_resource_$2_resource_right|-2 --?? ~SpearCharges$ == 0 ?? skipTo *13|DestructionCheck --skipTo *14|EndOfCard --:MassHealingWord| --?? ~SpearCharges$ < 2 ?? skipTo *15|NotEnoughCharges --Spell: *4|Mass Healing Word --Description: *4|Heal up to 6 creatures in range for 1d4 + @{wisdom_mod}. --Range: *4|60 feet --Healing: *2|[[ [$MHWHeal] 1d4 + @{wisdom_mod} ]] --Cost: *4|4 charges --api_modattr *4|_silent _charid @{character_id} _repeating_resource_$2_resource_right|-4 --?? ~SpearCharges$ == 0 ?? skipTo *16|DestructionCheck --skipTo *17|EndOfCard --:Recharge| --Description: *5|The spear regains 1d8 + 4 expended Charges when you wake up from a long rest. --Charge Recovery|[[ [XPND] [$RegainedCharges] 1d8+4 + @{repeating_resource_$2_resource_right}]] --?? $RegainedCharges >= 15 ?? api_setattr|_silent _charid @{character_id} _repeating_resource_$2_resource_right|15 --?? $RegainedCharges < 15 ?? api_setattr|_silent _charid @{character_id} _repeating_resource_$2_resource_right|[^RegainedCharges] --skipTo *18|EndOfCard --:NotEnoughCharges| --Failure|Spear low on charges --skipTo *19|EndOfCard --:DestructionCheck| --Warning|Spear charges depleted!! --DestructionCheck|[[ [$Dest] 1d20 ]] --?? $Dest > 1 ?? Safe|Spear charges depleted, take a rest to recharge. --?? $Dest == 1 ?? Destroyed|Spear bursts into a shower of stardust and is no more. --skipTo *20|EndOfCard --:EndOfCard| }}
1658278286
Andrew R.
Pro
Sheet Author
My first suggestion is that if you are just starting, use ScriptCards instead of PowerCards. It’s actively developed, not just in maintenance. I’ve converted to it entirely now. 
1658315403
GiGs
Pro
Sheet Author
API Scripter
And its better to find the dedicated thread for one you use, and post your query there. They each require specialised syntax, and you are most likely to find people who use the programs and know how to write for them in their deciated threads.