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 (Thread 2)

And those look great GK.
1432151465
Gen Kitty
Forum Champion
They make me a little itchy, because what I really want is Damage: 10 (3 shock) , but I know we'll get there in the end :>
Should be able to do that... I may have messed something up. Will work on it tomorrow morning.
1432154308
Gen Kitty
Forum Champion
Hm, went and looked at the new additions to roll templates. Nice enough, if you're into that sort of thing. Which I'm not. As nice as it would be to have 'only show this if I hit!', there's way too much human error. But I've ranted on that before, so I won't again :> I *think* the issue is that you can't have two variables assigned in the same dice roll. Doing: [[ [$GunDMG]1d8 + 4 + 2 + [$ShockDMG]1d6]] and then trying to use $ShockDMG later got me the whole total. Delimiters may be in order, though you'll get people like me who'd want to be able to nest delimiters: for this example, I need to be able to access the whole total of the roll (to later add to the crit-portion), and then just the shock and flaming portions to be called out. Though, something such as: [[ %[$GunDMG]1d8 + 4 + 2% + %[$ShockDMG]1d6%]] and then adding $GunDMG plus $ShockDMG would work fine too. Are you planning to do conditionals on a text level rather than tag level? In this example, it would be /nice/ if I could hide the flaming portion when it's zero. (I just about told my husband he couldn't have Divine Bond for his paladin when I realized how much extra work it was going to add to his macros) While I'm musing and wishing... is there any chance of being able to change font size within a tag, like we can font colors? :> Or have bold/italic affect the dice results? Yes, yes, I know, I'm a demanding thing. :>
1432186154
vÍnce
Pro
Sheet Author
GenKitty said: While I'm musing and wishing... is there any chance of being able to change font size within a tag, like we can font colors? :> Or have bold/italic affect the dice results? Yes, yes, I know, I'm a demanding thing. :> Yes. Please.
So much of what I'm trying to accomplish would be very much easier if I didn't have to work around the inline roll limitations and the errors it throws before the information is even sent to the api server. It's rather tempting to throw out everything (so to speak) and start from scratch with a basic parser for dice rolls and go from there. Maybe that's something I'll consider doing when I get bored with PowerCards 3. Anyway... this macro works and shows up as: !power {{ --charid|@{character_id} --emote|//Nameless strides forward and strikes with a spectral blade.// --title|HoneyBadger --name|Long Sword --leftsub|Melee Attack --rightsub|Reach 5 ft --Attack:|[[ [$Atk1] 1d20 + 3 [Strength Mod] + 3 [Proficiency] ]] | [[ [$Atk2] 1d20 + 3 [Strength Mod] + 3 [Proficiency] ]] vs AC --Damage:|[[ [$Dmg] 1d8 + 3 [Strength Mod] + [$FireDmg] 1d6 ]] ([^FireDmg^] fire) }} If you'll notice, I'm changing the roll.id reference to [^Roll.id^] instead of [^$Roll.id] or [^Roll.id]. This is to keep it inline with the other formatting options like bold and italics. This is not in the most recent gist update of powercards 3 yet though. Trying to get some other stuff working before updating it.
And yes, I do intend to add conditionals inside the content of a tag, but I want to get basic conditionals working first. I will also look into adding inline text sizing as well.
1432238951
Gen Kitty
Forum Champion
HoneyBadger said: So much of what I'm trying to accomplish would be very much easier if I didn't have to work around the inline roll limitations and the errors it throws before the information is even sent to the api server. It's rather tempting to throw out everything (so to speak) and start from scratch with a basic parser for dice rolls and go from there. Maybe that's something I'll consider doing when I get bored with PowerCards 3. I do admit, when I was showing some others my work in Powercards, a few people asked why we weren't using Lua or Python. Apparently this would be a bazillion times easier if we could use one of them. I was treated to some amusing rants about building languages from scratch and re-inventing the wheel needlessly. I look forward to resuming beta-testing next week with PC3.0b3 (or are we at b4 now? Also, we need a PC3.0b thread :>)
I might pull out the referencing variables tomorrow and do a thorough bug testing session to try and catch all the biggest script crashing errors and stop them from crashing the script (finally). And then release that as 3.0. Variable referencing is a bigger task than I thought it would be.
GenKitty said: I do admit, when I was showing some others my work in Powercards, a few people asked why we weren't using Lua or Python. Apparently this would be a bazillion times easier if we could use one of them. I was treated to some amusing rants about building languages from scratch and re-inventing the wheel needlessly. I look forward to resuming beta-testing next week with PC3.0b3 (or are we at b4 now? Also, we need a PC3.0b thread :>) Like I said, working around the limitations of Roll20's inline rolls is the biggest headache. It's why it keeps getting more tempting to write a full on parser for dice rolls and just cut out the Roll20 inline rolls altogether.
1432310634
The Aaron
Pro
API Scripter
Is now a good time for me to mention another breaking change I noticed on Dev this week regarding Inline rolls? It looks like the order of sendChat's inlinerolls is no longer guaranteed: "$[[0]]$[[1]] $[[4]] $[[2]] $[[6]] $[[3]]$[[5]]", I'm using this code in my GroupInitiative script to sort it out: var turnEntries=_.chain(msg[0].content.match(/\d+/g)) .map(function(idx){ return msg[0].inlinerolls[idx]; }) /* ... */ That assumes there are only rolls in the message, which is the case for me. An extra step with /\$\[\[\d+\]\]/ would be necessary in a real message...
GenKitty said: Hm, went and looked at the new additions to roll templates. Nice enough, if you're into that sort of thing. Which I'm not. As nice as it would be to have 'only show this if I hit!', there's way too much human error. But I've ranted on that before, so I won't again :> I *think* the issue is that you can't have two variables assigned in the same dice roll. Doing: [[ [$GunDMG]1d8 + 4 + 2 + [$ShockDMG]1d6]] and then trying to use $ShockDMG later got me the whole total. Delimiters may be in order, though you'll get people like me who'd want to be able to nest delimiters: for this example, I need to be able to access the whole total of the roll (to later add to the crit-portion), and then just the shock and flaming portions to be called out. Though, something such as: [[ %[$GunDMG]1d8 + 4 + 2% + %[$ShockDMG]1d6%]] and then adding $GunDMG plus $ShockDMG would work fine too. Are you planning to do conditionals on a text level rather than tag level? In this example, it would be /nice/ if I could hide the flaming portion when it's zero. (I just about told my husband he couldn't have Divine Bond for his paladin when I realized how much extra work it was going to add to his macros) While I'm musing and wishing... is there any chance of being able to change font size within a tag, like we can font colors? :> Or have bold/italic affect the dice results? Yes, yes, I know, I'm a demanding thing. :> You could add the following to the inline formatting section: .replace(/\~\$([0-9]{1}|[0-9]{2})\|(.*?)\~\$/g, "<span style='font-size: $1pt;'>$2</span>" I didn't come up with a creative combination of things for the tag call, but it will allow you to set the font size within a ~$8|This would be 8pt font~$ format. What it doesn't do, is change the size of the div cell if your font size change is huge in comparison. There's probably an even simpler and/or elegant way of this, but I'm getting over a nasty sickness and can barely concentrate.
1432326519
Gen Kitty
Forum Champion
HoneyBadger said: Like I said, working around the limitations of Roll20's inline rolls is the biggest headache. It's why it keeps getting more tempting to write a full on parser for dice rolls and just cut out the Roll20 inline rolls altogether. Hey, I'm all for it if it makes writing and maintaining the code easier for you, and guarantees variables. Though I cry a little at the idea of multiple rewrites of my 4e macros ;_;
1432333167

Edited 1432334019
I have taken a look at PC3.0b and the first thing I noticed is that it is not possible to use repeating tags without having a target_list. This does seem to fix it though: if (Tag.indexOf("#") !== -1) { TagRepeat = parseInt(Tag.substring(Tag.indexOf("#") + 1)); TagCount = 1; Tag = Tag.substring(0, Tag.indexOf("#")); while (TagCount <= TagRepeat) { var NewContent = Content;//Insert this line var NewTag = Tag;//Insert this line if (PowerCard.target_list !== undefined) { if (Tag.indexOf("%%") !== -1 || Content.indexOf("%%") !== -1) { //var NewTag = getTargetInfo(Tag, PowerCard.target_list);//Remove this line NewTag = getTargetInfo(Tag, PowerCard.target_list);//Insert this line var NewContent = getTargetInfo(Content, PowerCard.target_list);//remove this line NewContent = getTargetInfo(Content, PowerCard.target_list);//Insert this line PowerCard.target_list.shift(); } } PowerCard[NewTag + " #" + TagCount] = NewContent; TagCount += 1; } }
Durr... I'm dumb. Thanks.
PowerCard 3.0 beta (5-21 11:50 am) bugfixes... Using an undefined Roll ID will not crash the script. For example, if you assign $Atk1 to a roll and then use $Atk later in your macro instead of $Atk1, it won't crash. It will just mark that test as false and continue testing against any other rolls you may have used. Fixed repeating tags and target_list issue ( found by Janick H. ) Referencing variables outside of conditionals has been removed until I can sort out a better method for including them in text and inline rolls. Going to bed now. Stupid overtime.
1432453136
Gen Kitty
Forum Champion
I thought up a new use for conditionals: Monster knowledge lore checks! Hee. Also, this is not meant as a nag: What is the current status of the reroll coloring bug? 2.4.12 is listed as fixing it, but mine is still broken :/
GenKitty said: I thought up a new use for conditionals: Monster knowledge lore checks! Hee. Also, this is not meant as a nag: What is the current status of the reroll coloring bug? 2.4.12 is listed as fixing it, but mine is still broken :/ Ooo that is a nice use case. Can you write up an example of a Monster Lore check with conditionals please? And I am waiting on fixing the crit/fail roll highlighting until after Riley is done making changes to the structure of the msg.inlinerolls object. I am working on totally re-writing the dice parser to be more robust and less of a steaming pile of spaghetti code.
I was wondering, if it could be possible to implement an option to use the --whisper tag to whisper to multiple people? I have an idea of how it could be done, but I am unsure if it is the best way to do it: // WHISPER if (PowerCard.whisper !== undefined) { if (PowerCard.emote !== undefined) { if (PowerCard.charid !== undefined || PowerCard.tokenid !== undefined) { sendChat(TimeStamp, Spacer); sendChat(TimeStamp, "/direct " + PowerCard.emote) } else { sendChat(TimeStamp, "/emas " + PowerCard.emote); } } //sendChat(msg.who, "/w " + PowerCard.whisper + " " + Display);//Removed //Then this bolded part below is added var whisperRec = PowerCard.whisper.split(","); for(var i = 0; i < whisperRec.length; i++){ var receiver = whisperRec[i].trim().replace(/ [a-z0-9()]+/ig,""); sendChat(msg.who, "/w " + receiver + " " + Display); log(receiver) } } This method does require that you seperate all recepients with a "," in the --whisper tag, it removes all leading and trailing whitespaces, and if a recepient consists of more than one word it removes all but the first word, but the regex used should probably be expanded a bit. This is still working with only a single recepient, and it does not crash the script if no recpient is found.
1432491066
Gen Kitty
Forum Champion
HoneyBadger said: GenKitty said: I thought up a new use for conditionals: Monster knowledge lore checks! Hee. Ooo that is a nice use case. Can you write up an example of a Monster Lore check with conditionals please? And I am waiting on fixing the crit/fail roll highlighting until after Riley is done making changes to the structure of the msg.inlinerolls object. I am working on totally re-writing the dice parser to be more robust and less of a steaming pile of spaghetti code. This is TOTALLY not tested AT ALL. Nor does it have most of the pretty pretty I usually shove into my cards. My game starts in less than an hour and I'm still waking up. But this is how *I* would do it, using one of today's game's monsters: !power {{ --name|Monster Knowledge Check --Best Result:|[[ [$Result]0d0+?{Best Result|0} ]] --??$Result total <= 7??!Fail|**No Idea** --??$$Result total >= 8??!L1|Burning Devil --??$$Result total >= 16??!L2|Small, immortal humanoid; Manic temperament; Keywords: Devil, Fire, Immortal, Minion --??$$Result total >= 23??!L3|Particularly tormented mortals become either whitefire burning devils or blackfire burning devils, lit aflame for all eternity. Whitefire devils are a torment saved for corrupt priests and hypocrites, while black fire devils are former necromancers and mass murderers. --??$$Result total >= 24??!L4|Resist Fire 10; Fortitude weakest defense; Powers: Burning Claws(Ow), Fire Burst(Area Ow), Fire Alacrity(Teleportation when missed) }} This version is one I would use, diplaying the results to everyone and the version I am the most likely to use because I tend to tell everyone everything the best roll is entitled to know. But that's mainly because I've been having to manually copy and paste from a notepad file and well, I'm lazy. Here's a different version, making everyone do their own rolls, invoked via API Roll Button, and having to organically figure out who knows what. I'd kill for the ability to do a roll in a hidden tag, the roll happens but the roll isn't seen by anyone, it's just used later for comparisons. I'd use it here. !power {{ --name|Monster Knowledge Check --whisper|%%who%% --Your Result:|[[ [$Result]1d20+@{selected|Religion} ]] --??$Result total <= 7??!Fail|**No Idea** --??$$Result total >= 8??!L1|Burning Devil --??$$Result total >= 16??!L2|Small, immortal humanoid; Manic temperament; Keywords: Devil, Fire, Immortal, Minion --??$$Result total >= 23??!L3|Particularly tormented mortals become either whitefire burning devils or blackfire burning devils, lit aflame for all eternity. Whitefire devils are a torment saved for corrupt priests and hypocrites, while black fire devils are former necromancers and mass murderers. --??$$Result total >= 24??!L4|Resist Fire 10; Fortitude weakest defense; Powers: Burning Claws(Ow), Fire Burst(Area Ow), Fire Alacrity(Teleportation when missed) }}
Once I figure out a way to add roll ID's and have them work with the NH and XPND tags, adding a hidden option should be easy enough.
GenKitty said: Also, this is not meant as a nag: What is the current status of the reroll coloring bug? 2.4.12 is listed as fixing it, but mine is still broken :/ I think I finally cracked it... and it may fix all the options from penetrating to re-roll. Gotta go to the store to pick up groceries and such, but I should be releasing the initial version of PowerCards 3 (with conditionals only, no variables) in the morning. Going to spend time tonight smacking the script around and trying to break it and fix the crash errors.
1432618486
Gen Kitty
Forum Champion
Woohoo! I look forward to trying to break your release!
Sean G. said: Different folks, different strokes. I dislike needing to look anything up. I prefer everything right there so I don't have to locate any information. And, as I also pointed out, the PowerCard itself, was 80% the length because of the 5 attacks. Since we use the voice chat for everything, I never care about chat spam. I cut down on length, by organizing data, and once I finish table mark-up, I'll be cutting down even more: I hide extra information about spells in the --title| tag. It's useful for things like spell components and such.
1432634406

Edited 1432636452
GenKitty said: Woohoo! I look forward to trying to break your release! Might have to wait until afternoon. Something broke with highlighting in group rolls. >_< And since I didn't write this part of the script originally, I have to go through step by step to see what each thing does and how it interacts with the other parts of the dice roll processor. Edit - Ok, got it figured out and figured out a way to use Roll ID's with NH and XPND flags inside dice roll labels. Will end up being like something below, but nh and xpnd can easily be mashed together as nhxpnd. I will also be looking at adding a hdn option as well to totally hide that die roll, but still allow it to be used for conditionals (and later variables). Going to bed now. Will write up the new thread this afternoon. [[ [$Atk|nh|xpnd] 1d20 + 0]]
1432636875

Edited 1432636929
And here's proof GenKitty! That the crit/fail roll colors are finally fixed. :D Still thinking about making re-rolls a different color though and purple is sounding good. That or orange.
1432641236
Gen Kitty
Forum Champion
Yellow and green make... yellow-green? :>
Ok, awake now and working on error testing and updating the massive wall of text on how to use PowerCards.
1432669300
The Aaron
Pro
API Scripter
Documentation usually takes me longer than writing the scripts.. =/
The Aaron said: Documentation usually takes me longer than writing the scripts.. =/ Other way around for me. I spend hours just tinkering with something trying to sort out the best way to do it... and it's usually not, but it works. Mostly.
I'll be working the components into the title probably this weekend. I haven't had time to work on the table mark-up to make my cards more condensed and organized (damn school, getting burned out), but I'm going to eventually finish that up. I like the option...
Sean G. said: I'll be working the components into the title probably this weekend. I haven't had time to work on the table mark-up to make my cards more condensed and organized (damn school, getting burned out), but I'm going to eventually finish that up. I like the option... I've been considering it. Just want to get variables added next.
No worries. You take care of the important stuff... I'll keep hacking away. I mean, I have it working fine, it's just not very pretty right now in a macro, and there is little in customization of it.
1432805994

Edited 1432806072
Sean G. said: No worries. You take care of the important stuff... I'll keep hacking away. I mean, I have it working fine, it's just not very pretty right now in a macro, and there is little in customization of it. Starting to run out of symbols to use. :D
So was I. Without committing to symbols which are not readily available without knowing Alt-Keystroke/Option-Keystroke, it's coming down to ~T ~O ~DL ~DC ~DR for a table.
So there's an issue with adding rolls to the initiative tracker. PowerCard will work just fine in chat. The roll calculates just fine. However, in the initiative tracker, a different number is added. All flat modifiers remain however any "rolling" is done again for the tracker. For example, let's say I have an initiative bonus of +4. I roll a 2, my initiative is 6.04 (.04 is for sorting purposes). PowerCards will display that correctly in chat. However, in my turn order, my initiative is 12, because it rolled an 8.04 (notice how the decimal stayed the same). Any time you try and add a result to the initiative tracker, it'll roll twice. One for the tracker, one for the chat. Dubz check'em.
1433378177
Gen Kitty
Forum Champion
Which version of Powercards are you using?
Yeah, I know. Which is why I replaced &{tracker} with my own version. Add [trkr] as a roll option instead. Like this: [[ [trkr] 1d20 + 4]]
Yeah, GK has a good question too... since this thread is no longer the most up to date thread. Here's a link to the most current thread: <a href="https://app.roll20.net/forum/post/2029824/powercards-3-thread-2" rel="nofollow">https://app.roll20.net/forum/post/2029824/powercards-3-thread-2</a>