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

Powercards and other API

Hello, I am having trouble getting certain APIs to work as conditionals. Torch, Summon, and others. Any suggestions?
1602565733

Edited 1602565756
I've hardly incorporated !ammo and !alterbar. Didn't even knew you could mix others.  I'll follow to see the suggestions.
1602585817
Kurt J.
Pro
API Scripter
Peacekeeper B said: Hello, I am having trouble getting certain APIs to work as conditionals. Torch, Summon, and others. Any suggestions? There isn't enough information here to provide any kind of helpful response other than to point at the Wiki documentation for the --api_ tag. What are you specifically  having trouble with? What are the results vs. the expected results?
Last line of the powercard is a conditional that should turn the torch on. But I don't think I am writing the torch API correction for a powercard. And I can't find an example in the Wiki documentation (whcih are often less than helpful for those of us who are not computer wizards). If ther was just a place (or Wiki documentation) that showed the most basic APIs in powercard format that would be great. !power {{ --bgcolor|#1c4587 --erowbg|F1F1D4 --orowbg|#b6d7a8 --name|Light --tokenid|@{selected|token_image} --emote|** Lunitari's Idish, SHIRAK, Damen Du!** --leftsub|**R:** 150 Feet **CT:** 1 **D:** (@{selected|Level}*10) Minutes **C:** VSM --?? @{selected|numspells_0} > 0 ?? --Effect:| This spell causes an object to shed light, clearly illuminating the area around it as much as a torch, albeit with clear, white light. Although the effect is immobile, it can be cast on a movable object. Light taken into an area of magical darkness does not function. The caster needs a piece of clear quartz crystal, natural, cut or polished worth 5 gp. --?? @{selected|numspells_0} > 0 ?? soundfx|_audio,play,nomenu|shirak --?? @{selected|numspells_0} > 0 ?? api_setattr|_name @{selected|token_name} _mod _numspells_0|-1 _silent --?? @{selected|numspells_0} > 0 ?? vfx_opt|@{selected|token_id} nova-holy --?? @{selected|numspells_0} < 1 ?? Spell Failure:| You are out of 1st Level spells. --?? @{selected|numspells_1} > 0 ?? api_torch|40 20 }} Another one I am having issues with is GM King's Summon. Normally it is !summon Name cust # # Where name is the name of the character sheet the image is coming from and the # are size. For example? !summon Color-Spray cust 420 280 which works outside of powercards but when I make it api_summon|Color-Spray cust 420 280 it doesn't work at all. I also couldn't use the work around of token-mod to change the light emitting from the caster's token.
1602607522
Kurt J.
Pro
API Scripter
Peacekeeper B said: Last line of the powercard is a conditional that should turn the torch on. But I don't think I am writing the torch API correction for a powercard. And I can't find an example in the Wiki documentation (whcih are often less than helpful for those of us who are not computer wizards). If ther was just a place (or Wiki documentation) that showed the most basic APIs in powercard format that would be great. !power {{ --bgcolor|#1c4587 --erowbg|F1F1D4 --orowbg|#b6d7a8 --name|Light --tokenid|@{selected|token_image} --emote|** Lunitari's Idish, SHIRAK, Damen Du!** --leftsub|**R:** 150 Feet **CT:** 1 **D:** (@{selected|Level}*10) Minutes **C:** VSM --?? @{selected|numspells_0} > 0 ?? --Effect:| This spell causes an object to shed light, clearly illuminating the area around it as much as a torch, albeit with clear, white light. Although the effect is immobile, it can be cast on a movable object. Light taken into an area of magical darkness does not function. The caster needs a piece of clear quartz crystal, natural, cut or polished worth 5 gp. --?? @{selected|numspells_0} > 0 ?? soundfx|_audio,play,nomenu|shirak --?? @{selected|numspells_0} > 0 ?? api_setattr|_name @{selected|token_name} _mod _numspells_0|-1 _silent --?? @{selected|numspells_0} > 0 ?? vfx_opt|@{selected|token_id} nova-holy --?? @{selected|numspells_0} < 1 ?? Spell Failure:| You are out of 1st Level spells. --?? @{selected|numspells_1} > 0 ?? api_torch|40 20 }} Another one I am having issues with is GM King's Summon. Normally it is !summon Name cust # # Where name is the name of the character sheet the image is coming from and the # are size. For example? !summon Color-Spray cust 420 280 which works outside of powercards but when I make it api_summon|Color-Spray cust 420 280 it doesn't work at all. I also couldn't use the work around of token-mod to change the light emitting from the caster's token. Likely what you are running into is that !torch defaults to using the selected token as its location, but there is no way for the PowerCards API to pass that information to Torch. The Torch API accepts a token id as the 4th argument, so: --?? @{selected|numspells_1} > 0 ??  api_torch|40 20 yes @{selected|token_id} Will probably do what you are looking for. Looking at King's Summon, it looks like the same issue, except that I don't see a method for specifying a token ID, so it won't be successfully callable from PowerCards. Note that the limitation of not being able to pass selected information from one API script to another is baked into the API, and not something that can be "fixed" by modifying PowerCards.
Thanks for the information and code. But it didn't do the job.
It does work as an independent function but not as a conditional.
1602676259
Kurt J.
Pro
API Scripter
Peacekeeper B said: It does work as an independent function but not as a conditional. Are you certain the condition is correct? In all of the other conditions you are checking against numspells_0, but in the last one you are checking numspells_1.
Yeah I caught that and corrected it and yeah still doesn't work.