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
This post has been closed. You can still view previous posts, but you can't post any new replies.

[Script] PowerCards 2

1426694282
The Aaron
Forum Champion
API Scripter
You can actually simplify the logic for the main charms function ( doTargetInfo() ) quite a bit with a regular expression and the knowledge that .replace() can take a function as the second argument: function doTargetInfo(content, TargetList) { // PARSE FOR TARGET INFO REPLACEMENT CHARMS var Token = getObj("graphic", TargetList[0]); if (Token === undefined) return content; var Character = getObj("character", Token.get("represents")); // TOKEN CHARMS return content.replace(/%%(.*?)%%/g,function(m,charm){ var attr; switch(charm){ case 'token_name': return Token.get('name'); case 'bar1': case 'bar2': case 'bar3': return Token.get(charm+'_value'); case 'bar1_max': case 'bar2_max': case 'bar3_max': return Token.get(charm); default: return (Character && (attr=getAttrByName(Character.id, charm)) && '[['+attr+']]') || 'ERROR'; } }); }
could some one point out what the difference between powercards v2 and v3 will be? i am in the process of fixing a lot of monsters that got broken with the Update of Holding. before i start loading them up with powercards, i was wondering if v3 will support v2 formatted cards.
1426712636
Gen Kitty
Forum Champion
Thank you, HoneyBadger. *^_^* I'll leave you in peace now so you can work on PC3.x ^_^
1426726805
Iskoaya said: could some one point out what the difference between powercards v2 and v3 will be? i am in the process of fixing a lot of monsters that got broken with the Update of Holding. before i start loading them up with powercards, i was wondering if v3 will support v2 formatted cards. In game, PowerCards 3 will look just like PowerCards 2 and there should be no issues upgrading. Under the hood though, it's going to be quite different. I'm trying to find a better way of processing tags and adding all the css/html required and to add hit, miss, crit hit, crit miss helpers to show/shide tags and their content based on other rolls. I could probably add the helpers to PC2, but it would be hacky and the code is already convoluted enough as is.
1426781740
Just have to note here: this is awesome. O_O The [XPND] dice roll thing is exactly what I needed for my game...and the fact that it's added on to a whole heck of a lot of awesome formatting options that will drastically help with organizing and cleaning up the chat window output is great. :-)
1426793660

Edited 1426793866
Ok scratching my head. Figured you guys probably know the details way better than I.. I did search to see if anyone else was looking for something similar. The situation is this: I created a default monster sheet and loaded it with Token Macros (DM) using ( /em @{selected|token_name} makes an attack [[1d20 +@{selected|ToHit2}]] Vs. AC and if the hit is successful I'll launch a second Macro. /em @{selected|token_name} hits for [[@{selected|Damage1}]] DAMAGE! or if its a crit: /em @{selected|token_name} CRITS for [[@{selected|Critical1}]] DAMAGE! Power Cards seem awesome and rather than going back and changing the TXT for each one of my macros and filling out all the new variables and attribs I was hoping to customize what I currently have using ToHit1 - 4, Damage1-4 and Critical1-4 and combining it all into a single power card. {Edit: I Wasn't super clear, I don't want 1 macro to do everything but 1 Power Card Macro to Read the values for ToHit1 launch the attacks, Roll Damage1, and/or if its a Crit to launch Critical1, then the same for 2, 3, and 4.} Not sure if I would have to change the script to be able to do this or if the parameters i'm trying to pass could be passed to it. Any help is greatly appreciated and just wanted to say GREAT work.
1426799877
Gen Kitty
Forum Champion
Greg B. , I keep reading your request and then your edit and it's making my head hurt because I can't figure out what it is you actually want to do. If you're asking "Can I have a single powercard that I can use for all my macros?", the answer is 99.99% no. The .01% yes involves a lot of math to do simulated logic that isn't available natively. If you described how you saw yourself using the new macros, that might explain some things.
1426800659
The Aaron
Forum Champion
API Scripter
I think Greg is suggesting he'd have something like: !power --name|attack --hit|[[@{ToHit1}]] --damage|[[@{Damage1}]] .... Repeat for 2,3,4,etc Then set the attributes on the creatures: ToHit1: 1d20+5 Damage: 2d6+3 ...etc to which the answer is "I think so"
1426804360
Greg B. said: Power Cards seem awesome and rather than going back and changing the TXT for each one of my macros and filling out all the new variables and attribs I was hoping to customize what I currently have using ToHit1 - 4, Damage1-4 and Critical1-4 and combining it all into a single power card. {Edit: I Wasn't super clear, I don't want 1 macro to do everything but 1 Power Card Macro to Read the values for ToHit1 launch the attacks, Roll Damage1, and/or if its a Crit to launch Critical1, then the same for 2, 3, and 4.} No. It cannot do that, yet. As of right now, there is no automation. However, due to Roll Templates having the crit helpers, I am reluctantly working on a third version of PowerCards that will include a way to do simple logic inside powercards. The implementation may look something like this: !power --name|Fireball Example --Attack:|[[ [id1] 1d20]] vs Reflex @{target||Reflex} --[if(id1 > @{target||Reflex})]Hit:|[[ [id2] 1d6]] fire damage --[if(id1 > @{Crit})]Crit:|[[1d6]] additional damage --[if(id1 < (@{target||Reflex-1}))]Miss:| ([*id2*]/2) fire damage This is NOT part of powercards yet . This is not how the final implementation will work. It is just how I am looking at doing things. I am trying to figure out how to deal with multiple attacks in the same powercard.
Thanks for the quick reply guys, Aaron is fairly close to what i'm looking for. This is what I get when using his formula. (I changed ToHit1 to (1d20+4) where my original formula had the 1d20 inline roll built in. (which is irrelevant) So what i'm trying to do GenKitty is replace these 3 macros with a single power card that offers advantage / disadvantage and determines if its a crib and rolls the crit result for my existing monsters. Think I might have gotten close. !power --emote|@{selected|token_name} --format|atwill --name|Attack --Attack|[[@{ToHit1}]] [[@{ToHit1}]] --leftsub|Action --rightsub|Reach 5 ft. vs AC --Hit|[[@{Damage1}]] --Crit[[@{Critical1}]]
OPPS, had the AC in the wrong location.. Thats better, now if I could only get it to read the --name as the descriptor of the macro. Like in this example "Bite-Attack" but I could change that. :)
1426882244
Hey, all--resolved (i.e. it stopped happening for uncertain reasons), but thought I should still post re: some odd behavior I encountered. Went through last night and made a lot of token actions using Powercards, and all worked great. Went back in today, though, and clicked on one again, and something odd happened: the result came up twice each time I clicked on the action. Seemed to be happening with all the actions I'd made. O_O Not a major deal since it came up identically both times--i.e. the rolls were only being made once, but displayed twice (see below). But it was a bit odd and I wondered if anyone had experienced that or knew if there was something stupid I might have done to make it happen. Basically it looked like this: (Neglected to save an image while it was happening, so that's actually one image pasted in here twice, but it's how it looked, anyway.) I thought maybe it was just a loading error or something, so I exited the game, re-saved the API scripts, and returned--and now things seem to be working properly again. O_O So, if this is something that's an actual concern, please let me know--otherwise, it seems resolved on my end so I'm not going to pay it further mind. :-P
1426883310
This is an issue with the API. Not the script... at least not as far as I know. I've had other scripts double up as well.
1426886088
Gen Kitty
Forum Champion
Yeah, it's A Thing(TM). The usual workaround is to re-save a script, which kicks the API sandbox and usually fixes the issue.
1426890734

Edited 1426890822
fixing stuff 101, "when in doubt, kick it out(TM) (R) (C)"
I noticed an unusual problem, I generally don't use 3d dice but it seems that now when 3d dice are enabled, they no longer fire off when using Powercards. Is this expected? I thought I remember using 3d dice before with Powercards, so wondering if this is something new or I am mistaken and this has never worked.
1427042517

Edited 1427042597
vÍnce
Pro
Sheet Author
They used to roll with powercards... I think Riley made a change last week that might have something to do with it. EDIT: might just be the current issue. <a href="https://app.roll20.net/forum/post/1744000/slash-roll-not-showing#post-1744785" rel="nofollow">https://app.roll20.net/forum/post/1744000/slash-roll-not-showing#post-1744785</a>
1427048373
If I click the Roll20 basic dice, roller the dice roll, but if use powercards, it does not....
1427507278
The Aaron
Forum Champion
API Scripter
Man, I sure wish I could format my powercard macros like this: !power --name|♖Rook♖ --leftsub|Charisma --rightsub|CHR --Roll|[[1d20+@{basic_charisma_check_mod}]]|[[1d20+@{basic_charisma_check_mod}]] (G or R [[1d4]]) --Save|**+**[[@{global_saving_bonus}+@{charisma_save_prof}]] --^1Deception|**+**[[@{PB}]] Adv. --^1Intimidation|**+**[[@{PB}]] --^1Performance|**+**[[@{PB}]] Adv. --^1Persuasion|**+**[[@{PB}]] ... =D With this line inserted between lines 19 and 20, I pretty much can! /* 19 */ var player_obj = getObj("player", msg.playerid); /* ++ */ msg.content = msg.content.replace(/&lt;br\/&gt;\n/g, ' ').replace(/({{(.*?)}})/g," $2 "); /* 20 */ PowerCard.Process(msg, player_obj); This makes use of the fix Riley put in for rollable templates. Any line breaks between {{ and }} will not cause the command to be ended. So now I just wrap all the arguments in {{ and }} and everything is nicely formatted! !power {{ --name|♖Rook♖ --leftsub|Charisma --rightsub|CHR --Roll|[[1d20+@{basic_charisma_check_mod}]]|[[1d20+@{basic_charisma_check_mod}]] (G or R [[1d4]]) --Save|**+**[[@{global_saving_bonus}+@{charisma_save_prof}]] --^1Deception|**+**[[@{PB}]] Adv. --^1Intimidation|**+**[[@{PB}]] --^1Performance|**+**[[@{PB}]] Adv. --^1Persuasion|**+**[[@{PB}]] }} Enjoy! =D
1427508886
Holy shit.
Totally awesome... I'm feeling a bromance brewing.
1427515347
The Aaron
Forum Champion
API Scripter
Hehehehe. =D
1427516433

Edited 1427516834
wait... what da fek?!?!? dood... did you like, just show us how to break up the powercards in our macros so that each tag can be on a separate line in in the macro text on the abilities and attributes page? instead of it all being on a single mind-breaking line??? damn i wish i had your address, i would ship you every female in my family so future generations could inherit your superior Scriptomancy! all hail the Lord of Ay-Pei-Aeh, bow before his Gloriousness! if this was Interstellar, i bet more than 12% of the "Plan B" had your seeds! Srs mode on: using that lone of code and your example macro will work as far as having each tag on a separate line? HoneyBadger said: Holy shit. can this be, like a major part of Powercards3? please.... pretty please EDIT: Will this work with the !pcpp script-fu too?
1427516727
You can add that to your copy of the script right now Iskoaya. I'll be updating this one later tonight/today. Gotta pay bills and clean house first.
i am, i was just hoping it would be added for P3 as an actual feature tho!
1427517232

Edited 1427517299
also, on mine the line is between 18-19? using ver. 246 /* 14 */ // API COMMAND HANDLER /* 15 */ on("chat:message", function(msg) { /* 16 */ if (msg.type !== "api") return; /* 17 */ if (msg.content.split(" ", 1)[0] === "!power") { /* 18 */ var player_obj = getObj("player", msg.playerid); /* insert here right? */ msg.content = msg.content.replace(/&lt;br\/&gt;\n/g, ' ').replace(/({{(.*?)}})/g," $2 "); /* 19 */ PowerCard.Process(msg, player_obj); /* 20 */ } /* 21 */ if (msg.content.split(" ", 1)[0] === "!power_version") sendChat("HoneyBadger", "/w " + msg.who + " You are using version " + PowerCards_Version + " of PowerCards, authored by " + PowerCards_Author + ", which was last updated on: " + PowerCards_LastUpdated + "."); /* 22 */ });
1427517305
Gen Kitty
Forum Champion
Oh my. Aaron, thank you so much .
GenKitty said: Oh my. Aaron, thank you so much . we should start a fan club?
1427518456
The Aaron
Forum Champion
API Scripter
hehehe.. Yeah, right before the PowerCard.Process() call. It should work find for !PCPP, though I haven't tried it. Really, you can take that line of code and put it before msg.content is used in any script and support line wrapping parts of the command with {{ and }} . =D
And that {{ }} works freaking awesome, I tell you what. I don't have to write a 10-mile long macro for PowerCards now... when I can make it 2-miles tall instead. BUT , it'll be organized...
1427519779
vÍnce
Pro
Sheet Author
{{Aaron Rules}}
1427520704
The Aaron
Forum Champion
API Scripter
Vince Brian HoneyBadger HoneyBadger The Aaron GenKitty The Aaron HoneyBadger Brian The Dragon GenKitty GenKitty HoneyBadger GenKitty HoneyBadger HoneyBadger GenKitty Samuel Penn HoneyBadger GenKitty Samuel Penn HoneyBadger HoneyBadger Ziechael HoneyBadger HoneyBadger Vince Vince HoneyBadger HoneyBadger GenKitty Samuel Penn HoneyBadger Iskoaya GenKitty HoneyBadger HoneyBadger GenKitty GenKitty GenKitty Iskoaya GenKitty The Aaron The Aaron The Aaron HoneyBadger HoneyBadger HoneyBadger HoneyBadger GenKitty HoneyBadger GenKitty Iskoaya GenKitty Iskoaya Sean G. Lukas HoneyBadger Lukas The Aaron HoneyBadger Lukas HoneyBadger HoneyBadger The Aaron Iskoaya GenKitty HoneyBadger Robert M. Greg B. GenKitty The Aaron HoneyBadger Greg B. Greg B. Robert M. HoneyBadger GenKitty Iskoaya Kevin Vince Den G. The Aaron HoneyBadger Sean G. The Aaron Iskoaya HoneyBadger Iskoaya Iskoaya GenKitty Iskoaya The Aaron Sean G. said: {{Aaron Rules}} Whoa... Weird quote bug? Anyway, I was going to say that now I feel like I need to write a bunch of "Thou shalt not" rules...
The Aaron has spoken!!! Sean G. said: And that {{ }} works freaking awesome, I tell you what. I don't have to write a 10-mile long macro for PowerCards now... when I can make it 2-miles tall instead. BUT , it'll be organized... and let there be light!
1427526013

Edited 1427541345
Update: March 28th, 2015 ~ 2:50 am eastern Version: 2.4.11 Script Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c Update: Replaced target_info parsing logic with TheAaron's replacement. No change to macros needed. Update: Thanks to TheAaron, you can now format powercard macros on separate lines instead of as one long line, as shown below: !power --tokenid|@{selected|token_id} --emote|Pikkle unleashes a blast of eldritch energy. --format|atwill --name|Eldritch Blast --title|Components: V, S ^^ Duration: Instantaneous ^^ Eldritch Blast creates additional beams at 5th, 11th, and 17th level. You can direct all the beams on the same target or at different ones. Make a separate attack roll for each beam. --leftsub|Standard Action --rightsub|Range 120 ft. --Attack:|[[ 1d20cs&gt;2 + 4 [Cha Mod] + 2 [Proficiency] ]] | [[ 1d20 + 4 [Cha Mod] + 2 [Proficiency] ]] vs AC --Hit:|[[ [NH] 1d10 ]] force damage and the target is pushed up to 10 ft away --?{Hit delete to show hex damage|$}Hex:|[[1d6]] necrotic damage --Critical Hit:| --!Crit1|^* **+** [[1d10]] force damage --?{Hit delete to show hex damage|$}!HexCrit|^* **+** [[1d6]] necrotic damage ... becomes ... !power {{ --tokenid|@{selected|token_id} --emote|Pikkle unleashes a blast of eldritch energy. --format|atwill --name|Eldritch Blast --title|Components: V, S ^^ Duration: Instantaneous ^^ Eldritch Blast creates additional beams at 5th, 11th, and 17th level. You can direct all the beams on the same target or at different ones. Make a separate attack roll for each beam. --leftsub|Standard Action --rightsub|Range 120 ft. --Attack:|[[ 1d20cs&gt;2 + 4 [Cha Mod] + 2 [Proficiency] ]] | [[ 1d20 + 4 [Cha Mod] + 2 [Proficiency] ]] vs AC --Hit:|[[ [NH] 1d10 ]] force damage and the target is pushed up to 10 ft away --?{Hit delete to show hex damage|$}Hex:|[[1d6]] necrotic damage --Critical Hit:| --!Crit1|^* **+** [[1d10]] force damage --?{Hit delete to show hex damage|$}!HexCrit|^* **+** [[1d6]] necrotic damage }}
HoneyBadger said: Holy shit. no other words... just...
1427534097
Michael H. said: HoneyBadger said: Holy shit. no other words... just... Pretty much. I hadn't really been paying attention to issues surrounding roll templates or their features. The connection just wasn't there for me to make, lol. Glad Aaron did though.
Scriptomancy is brokenly OP!
1427557737
The Aaron
Forum Champion
API Scripter
HoneyBadger said: Pretty much. I hadn't really been paying attention to issues surrounding roll templates or their features. The connection just wasn't there for me to make, lol. Glad Aaron did though. It turns out that the greatest power of Arcane Scriptomancy is asking the right questions.... =D
1427596427

Edited 1427596458
Gen Kitty
Forum Champion
Sidenote: Timestamps got turned back on by default :&gt; I'm working on macros for tomorrow's game, and I think Aaron needs to add some tinsel to his halo because my word , this is exponentially easier to work on now.
i know right, i posted a different template guide for spells, melee, ranged, Misc info, feats, class actions on handouts, and for once my players can actually fill it out properly themselves!!! even the complete r20 rookie in my oneshot managed it!!! now if only there was an easier way for my players to get handout links. then i wouldnt have to mess with their macros at all.
1427608734
The Aaron
Forum Champion
API Scripter
Iskoaya said: now if only there was an easier way for my players to get handout links. then i wouldnt have to mess with their macros at all. Eh?
1427622247
I think he meant handout ID/URL, so they can link to them in their macros.
= HoneyBadger said: I think he meant handout ID/URL, so they can link to them in their macros. this! other than making a handout index and listing every handout in [Handout Name] i dont know how to grab the ID/URL
1427626408
Help Please, My power card used to work but now it doesn't output anything. Roll20 asks for targets and total number of targets, but it doesn't roll any dice or output to chat. I have gone through line by line and I can't find what I am missing. !power {{ --tokenid|@{selected|token_id} --emote|A globe of orange flame coalesces in your hand and you hurl it at your enemies, where it explodes on impact. --format|atwill --name|Fireball --Level:| //3rd-level Evocation// --Casting Time:| 1 Action --Range:| 150 ft. --Components:| V, S, M (a tiny ball of bat guano and sulfur) --Duration:| Instantaneous --Effect:| A bright streak flashes from your pointing finger to a point you choose within range and then blossoms with a low roar into an explosion of flame. Each creature in a 20-foot- radius sphere centered on that point must make a Dexterity saving throw. A target takes **8d6** fire damage on a failed save, or half as much damage on a successful one. --!Effect2:| The fire spreads around corners. It ignites flammable objects in the area that aren't being worn or carried. --At Higher Levels:| When you cast this spell using a spell slot of 4th level or higher, the damage increases by **1d6** for each slot level above 3rd. --target_list| @{target|Enemy 1|token_id} | @{target|Enemy 2|token_id} | @{target|Enemy 3|token_id} | @{target|Enemy 4|token_id} | @{target|Enemy 5|token_id} | @{target|Enemy 6|token_id} --Attack#?{Number of targets|1}:| %%token_name%% [[ 1d20 +3 [Intelligence Mod] +2 [Proficiency] ]] | [[ 1d20 +3 [Intelligence Mod] + 2 [Proficiency] ]] vs AC --Hit:| [[ [NH] 8d6 ]] fire damage. }} Thanks in advance,
1427627728
I just checked on the dev server and live server, and the power card showed up using that macro. Try disabling, re-enabling, saving, etc.
also ensure your using the latest version of powercards, and that the super awesome edit Aaron blessed us with are inputted correctly... because your macro worked for me too
Rob, I wonder if you are having the same issue that I had in one of my campaigns (and that I know exists for another members campaign in the same way). The details are here: <a href="https://app.roll20.net/forum/post/1769037/api-serv" rel="nofollow">https://app.roll20.net/forum/post/1769037/api-serv</a>... In my case I was able to disable and re-enable scripts and it seemed to work, in this other campaign nothing seems to help it. Any command that is passed through sendChat() outputs nothing... It looks like it should work, there are no errors nothing. In my case our group had been playing for a couple of hours before this bug hit us with no error in API logs or anything. As HoneyBadger stated, you can try to disable and re-enable things, hopefully that will free it up, but that only helped 1 of 2 instances where I saw this problem.
1427634128
The Aaron
Forum Champion
API Scripter
I had that same issue and Riley had to jump into the campaign to fix it.
I had this problem happen again this morning on a new campaign that I am setting up. I don't know what I did again to cause this issue, however I am starting to suspect that if you clear the chat archive it may resolve the issue.
1427640570
PrincessFairy
Plus
Marketplace Creator
These new updates are pro or dev server? Don't see a tag next to the script link To which server.