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

Help with a Macro

Hey all, been doing Roll20 for a long time, but have relied on outstanding character sheets until recently.  Had fun running a Boot Hill game during Roll20 Con, and the group would like to start an ongoing campaign.  Long story short; the game was fun, but the process was long.  I've gotten some Macros already down- but this one has me stumped.   Here is what I need- a character has an attribute (Coordination), and depending on what type of shot they want to fire (Careful, Hip Shot, etc), that value is halved, quartered, etc.  I think the easiest way to do that is have the player figure this out on their character sheet- so I came up with a separate attribute for it.  So if my Coordination is 16, my Careful Shot is 16, Steady Shot is 8, Hip Shot is 4.  In addition, the players add their Pistol or Rifle ranks to this number- this result never changes.  So if my Rifle skill is 2, and I have Coordination 16, my Careful Shot with any Rifle will always be 18.  I share all of this because if someone has an easier way to tackle this, I'm all ears.  But for now- this seems like a workable compromise.  After that, though, it gets a little trickier.  There are Range modifiers, Movement modifiers, etc- these numbers vary quite a bit- and rather than asking a bunch of questions, I figure we can tally real quick, and add them in as one total modifier.  This Careful Shot (sticking with the same example) plus my total modifiers, is what I need to roll under on a d20.  CShP is the attribute we are using to represent a character's Careful Shot with a Pistol.  I feel like this is a simple solution, but I'm stumped.  Thanks in advance! Here is what I have: ?{Total Accuracy Modifiers|0} /em @{selected|token_name} aims the pistol and pulls the trigger! /r 1d20 <= {@{selected|CShP}+?}
1529960096
The Aaron
Pro
API Scripter
What do you do with rounding, say you have a value of 13 for Coordination, what are the results for Steady Shot and Hip Shot?
The steady shot gets rounded up, the hip shot gets rounded down
1529960212
The Aaron
Pro
API Scripter
Something like: /em @{selected|token_name} aims the pistol and pulls the trigger! /r 1d20<[[ (@{selected|Coordination}/?{Shot type|Careful,1|Steady,.5|Hip,.25})+@{rifle}+?{Modifiers|0}]] Would be my first order approximation. =D
1529960545
The Aaron
Pro
API Scripter
So: 0: 0, 0, 0 1: 1, 1, 0 2: 2, 1, 0 3: 3, 2, 0 4: 4, 2, 1 5: 5, 3, 1 6: 6, 3, 1 7: 7, 4, 1 8: 8, 4, 2 9: 9, 5, 2 10: 10, 5, 2 11: 11, 6, 2 12: 12, 6, 3 13: 13, 7, 3 14: 14, 7, 3 15: 15, 8, 3 16: 16, 8, 4 17: 17, 9, 4 18: 18, 9, 4 19: 19, 10, 4 20: 20, 10, 5
Oh this is fantastic- off to plug and play, I will be back and let you know how it went!... So this looks ideal if we can swing it.  Drops me down to two Macros.  Initially, I am getting this error message when using your Macro copy and pasted: TypeError: Cannot read property 'substring' of undefined
So, if I am reading your script correctly- this is going to factor in coordination, query the type of shot and divide coordination by that result- and from there, add the Rifle skill rank and finally the queried result for modifiers?  If so, that is precisely what I was requesting- so bravo!
1529960738
The Aaron
Pro
API Scripter
Probably the @{rifle} or @{selected|Coordination} is wrong. Depending on if that chart I posted is right, there might be some adjustments necessary to get it to work out.  What is the possible range of Coordination?
Coordination as an initial stat would start out as 7 to 20, but could theoretically go beyond 20 over time
1529961152
The Aaron
Pro
API Scripter
Yup, that's what the above does.  Probably best to call it a Command.  Script will make people think of the API, and Macro is kind of overloaded.  =D
Command it is!  So, my Rifle attribute is capitalized, but other than that- the text appears right.  In front of the {@selected|Coordination} there is an open paretheses, and no parentheses at the end of the line.  This is all over my head, but- is that a possible issue?
1529961550
The Aaron
Pro
API Scripter
The close is before the +@{rifle} Probably @{rifle} should be @{selected|Rifle}: /em @{selected|token_name} aims the pistol and pulls the trigger! /r 1d20<[[ (@{selected|Coordination}/?{Shot type|Careful,1|Steady,.5|Hip,.25})+@{selected|Rifle}+?{Modifiers|0}]]
That did it!  Thank you so much- this will make this old vintage game a lot more workable.  
1529962177
The Aaron
Pro
API Scripter
Cool.  You might check that the math is right at each level from 7 to 20. If it isn't, some adjustment will be needed. The formula in that Command is probably going to produce, which isn't quite what you said: 0: 0, 0, 0 1: 1, 1, 0 2: 2, 1, 1 3: 3, 2, 1 4: 4, 2, 1 5: 5, 3, 1 6: 6, 3, 2 7: 7, 4, 2 8: 8, 4, 2 9: 9, 5, 2 10: 10, 5, 3 11: 11, 6, 3 12: 12, 6, 3 13: 13, 7, 3 14: 14, 7, 4 15: 15, 8, 4 16: 16, 8, 4 17: 17, 9, 4 18: 18, 9, 5 19: 19, 10, 5 20: 20, 10, 5