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

Looking for someone good with API that can help me out.

So, I'm trying to find someone who can answer if not help create an API script to help total rolls from a template macro. If it's not possible, thanks anyways, if this is a dumb request, sorry I wasted your time :) For example, in the below macro, something that would total anything from said macro that is the result of the dice roll for the damage bracket and the critdamage bracket if applicable. Something along the lines of being able to add the line {{total=attackresult+critdamageresult}}. In most casts, the math is simple, but in some games the macros become complex because the items become very powerful. It would be useful also if there was a way to label damage types with some kind of icon/indicator vs having to add radiant, necrotic, or fire to the end of each roll. &{template:5eDefault} {{title=Mundane Crappy Longsword}} {{subheader=}} {{attack=[[1d20+8]]}} {{attackadv=[[1d20+8]]}} {{damage=[[1d8]] Piercing | [[1d8]] Radiant}} {{critdamage=[[1d8]] Slashing | [[1d8]] Radiant}}
1475668972
The Aaron
Pro
API Scripter
I'm happy to help with your questions.  What you're asking for is certainly possible. You could probably adjust the RollTemplate in the character sheet to add a field with all the damage totaled almost as easily, but here's the basic breakdown on how you'd do it in a script: Detect if the chat message is the right type (msg.type is 'general' or 'whisper') and has a RollTemplate (msg.rolltemplate is non-empty). Parse the RollTemplate into a useful form, something like: let parsed = _.reduce(msg.content.replace(/^{{/,'').replace(/}}$/,'').split(/}}\s*{{/),(memo,row) => {let parts=row.split(/=/);memo[parts.shift()]=parts.join('=');return memo;},{}); Find all the keys with damage to total... Here where that gets complicated... there are usually many damage fields and only some apply (no crit if there isn't a crit, some templates have a secondary damage for advantage hits, etc). Collect the list of damage types, uniq() them and turn them into icons Output the result.
Good to now. Honestly I was hoping someone might be up to the task of creating it with as much help as I'm able to render. My knowledge of coding is VERY rudimentary and I haven't messed around with it in over 10 years. If that isn't an option, are there any good guides on creating API that you can link me to?
1475704655
The Aaron
Pro
API Scripter
There aren't any serious step-by-step type guides on Roll20.  I can give you some recommended reading if you'd like to learn and I'm happy to answer questions all day every day (I'm live on  Gitter almost all the time). The idea might be generally useful to many people, so let's discuss the nitty gritty details of what you need.  The above 4 bullets are a good outline, but the last two are very fuzzy.  Can you speak to how you would want to handle: Determining which keys to total up I don't see any way around explicit knowledge of the template and the state of the attack (normal/advantage/disadvantage), etc. Output the result Mainly a question of formatting, but also a question of what information to display, something like [ 23 damage (15 slashing, 8 poison) ]
Would it be possible to use the prompt ?{} as a calculator, or just make a new window? So, basically, maybe something that allows the DM to make a character sheet that's linked to the tokens (see below). When the player designates said token as the subject of his attack, the DM enters the command which launches the calculator for said token. The players setup their macro to have their "to hit" input into the calculator, to see if the attack is a hit or miss, on a hit, the macro inputs damage based on damage types into their own fields and totals (accounting for crits). So if a fighter swings 4 times from extra attack, and action surges for another four, it auto calculates hits/misses and inputs damage from all 8 hits. After damage is totaled, subtracted from tokens health, then maybe have the turn order refresh the calculator for next person/npc in the list when the DM changes it. The NPC/token character sheet would be overly simple, just an AC, spell save, resistance/immunity, total health. No real need to make it too complex, unless you wanted to. Though there might need to be a bonus field or two to account for external effects that can change the outcome of an attack. • Create a command which links to the calculator (if possible), like @() links to the character sheet. If command is use, then input data as is designated. • The icon idea isn't as important, just thought it would be interesting to see it and also shorten the length of each display field from a macro. That part seems like it would be mildly easy though, just requiring an texture pack and a way to link the texture to the chat with some command. I've no clue on the last two bullets lol, I'm just here spitting thoughts. If you think of something better or if the ideas aren't possible/dumb, let me know :)
1475721990
The Aaron
Pro
API Scripter
Most of what you're suggesting is possible in some form or another, but what you're describing is a quite complicated script.  It's not something I'd have the time to work on anytime soon, if I even get around to it.  I'd certainly help point you in the right direction, but you might want to try and pare it down a bit to something more manageable.  =D
Well, that's just a basic idea lol, best case scenario. a light version would be useful by itself..  Based on the dream, can it be cut down into something simplified to make it doable in the short term? My issue is that, adding up totals isn't that hard, and unless this can total up multiple macros from a player for the benefit of the DM. But it would need to be able to tell a hit vs a miss so it wouldn't add in all listed damage. Maybe if the roll for hit was in a macro by itself, damage using it's own macro..
1475755769
The Aaron
Pro
API Scripter
What might be far easier would be to whisper to the gm a small message with a button which would add the damage to a running total.  That would eliminate the need for the script to determine what hit.  There could be a couple of buttons to allow pooling into multiple damage counters in case the player split their attacks across multiple foes. # attack doing 10 piercing [New Pool] ------Press [New Pool]------ { 10 piercing } # attack missing [10 piercing][+] [New Pool] # attack doing 7 slashing {10 piercing}[+] [New Pool] ------Press [+]------ {17 :: 10 piercing, 7 slashing} # attack doing 8 slashing {17 :: 10 piercing, 7 slashing}[+] [New Pool] ------Press [New Pool]------ {17 :: 10 piercing, 7 slashing} {8 slashing} # attack doing 5 slashing, 3 fire {17 :: 10 piercing, 7 slashing}[+] {8 slashing}[+] [New Pool] ------Press 2nd [+]------ {17 :: 10 piercing, 7 slashing} {16 :: 13 slashing, 3 fire} There might be some further interactions to deal with area effects, etc. That gets rid of the hard problem of "who got hit", and leaves only the rather difficult problem of "how much damage". Thoughts?
Sounds interesting. The easier it is to use the better imo
1475777024
The Aaron
Pro
API Scripter
So that just leaves the question of "how much damage".  Are you intending to pair this with an existing character sheet and its Roll Templates?
If i'm understanding your question correctly, yes. Yes, we're using 5e character sheets and the 5eDefault template
1475788003
The Aaron
Pro
API Scripter
This is a common question for me today, but which one of the 3 5e character sheets?
I honestly don't know the name of it, but it's the one displayed here on this wiki link under Character Sheet Basics. <a href="https://wiki.roll20.net/Character_Sheets" rel="nofollow">https://wiki.roll20.net/Character_Sheets</a>
1475789596
The Aaron
Pro
API Scripter
Common answer! &nbsp;That's the 5th Edition (Community Contributed) sheet.
Any new info?
1476380667
The Aaron
Pro
API Scripter
I like where this idea is going, but it will be a while before I have time to devote to pursuing it. =/ &nbsp;The hardest part is determining from the Roll Template what should be applied, particularly if additional effects are added to an action (say flurry of blows, hunter's quarry, sneak attack, etc). &nbsp;Even critical hits are problematic to deal with (Crit damage is always rolled, twice, and visible if the attack was a crit). I'll have to explore this more at a later point.
:( Alright. I had hoped it might be something simple based on what you were saying before. Oh well, maybe you'll get to it or figure something out later. Thanks anyways.