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

BECMI Thaco roll

Classic D&D, also known as BECMI uses a ToHitArmorClass0 to determine AC hit. I need a macro that does the following: (1)ask for the Thaco number for the player/creature (2)roll 1d20 (3)subtract the 1d20 roll from the Thaco. I know how to add but not subtract.
<a href="https://app.roll20.net/forum/post/734108/help-with-simple-macro-for-2nd-edition-d-and-d" rel="nofollow">https://app.roll20.net/forum/post/734108/help-with-simple-macro-for-2nd-edition-d-and-d</a> <a href="https://app.roll20.net/forum/post/2327787/is-there-an-api-slash-macro-i-can-use-a-single-roll-for-3-calculations/?pageforid=2327923#post-2327923" rel="nofollow">https://app.roll20.net/forum/post/2327787/is-there-an-api-slash-macro-i-can-use-a-single-roll-for-3-calculations/?pageforid=2327923#post-2327923</a>
Thank you for the links, but I can't get any of them to work. I can do the roll using BASIC :&nbsp; &nbsp;a=int(rnd(1)*20) + 1 &nbsp;print"Thaco roll for encounters" &nbsp;input"Thaco number? ";d &nbsp;print"add modifiers" &nbsp;input m &nbsp;n=d+m &nbsp;tr=n-a &nbsp;if tr&gt;10 then tr=10 &nbsp;if tr&lt;-10 then tr=-10 &nbsp;print &nbsp;print"AC hit=";tr So how do I convert this into a macro? Jarren said: <a href="https://app.roll20.net/forum/post/734108/help-with-simple-macro-for-2nd-edition-d-and-d" rel="nofollow">https://app.roll20.net/forum/post/734108/help-with-simple-macro-for-2nd-edition-d-and-d</a> <a href="https://app.roll20.net/forum/post/2327787/is-there-an-api-slash-macro-i-can-use-a-single-roll-for-3-calculations/?pageforid=2327923#post-2327923" rel="nofollow">https://app.roll20.net/forum/post/2327787/is-there-an-api-slash-macro-i-can-use-a-single-roll-for-3-calculations/?pageforid=2327923#post-2327923</a>
1640037590
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I think this will work: [[{[[{[[?{Input Thaco} + ?{Input Modifiers}+0d0]]-[[1d20]],10}dh1]],-10}dl1]] Basically it figures your roll and drops the higher of the result or 10, then drops the lower of that result or -10.
1640047156
GiGs
Pro
Sheet Author
API Scripter
One nifty thing you can do with Keith's approach is put it in a template and show the roll and result separately, like &amp;{template:default} {{name=NAME HERE}} [[{[[{?{THAC0|10} - [[1d20]],10}dh1]],-10}dl1]] {{THAC0=[[?{THAC0}]] }}{{d20 roll=$[[0]]}} {{AC Hit=$[[2]]}} This will give you a result that looks like Just change the NAME HERE part to the text you want, or remove it entirely if you don't want a title.
1640050875

Edited 1640050954
This seems to work great but I tested it and the THACO was 18, the d20 roll was 6, so that should have given me a 12 but it showed 10 instead. I love the idea but I also need a modifier check. GiGs said: One nifty thing you can do with Keith's approach is put it in a template and show the roll and result separately, like &amp;{template:default} {{name=NAME HERE}} [[{[[{?{THAC0|10} - [[1d20]],10}dh1]],-10}dl1]] {{THAC0=[[?{THAC0}]] }}{{d20 roll=$[[0]]}} {{AC Hit=$[[2]]}} This will give you a result that looks like Just change the NAME HERE part to the text you want, or remove it entirely if you don't want a title.
1640088611

Edited 1640088937
GiGs
Pro
Sheet Author
API Scripter
Isnt there a maximum of 10, and minimum or -10? Thats what the basic code suggests above. I forgot to include the modifier (weird, I thought it was there), for that: &amp;{template:default} {{name=NAME HERE}} [[{[[{?{THAC0|10} + ?{Modifier?|0} - [[1d20]],10}dh1]],-10}dl1]] {{THAC0=[[?{THAC0}]] }}{{d20 roll=$[[0]]}} {{AC Hit=$[[2]]}} and if you want to show it on the printout &amp;{template:default} {{name=NAME HERE}} [[{[[{?{THAC0|10} + ?{Modifier?|0} - [[1d20]],10}dh1]],-10}dl1]] {{THAC0=[[?{THAC0}]] }}{{Modifier=[[?{Modifier?}]] }} {{d20 roll=$[[0]]}} {{AC Hit=$[[2]]}} I;m not sure how the modifier works, you might want to change it to a - instead of a +.
1640088914
GiGs
Pro
Sheet Author
API Scripter
If you want to remove the max of 10 and min of -10 that simplifies the code a bit. &amp;{template:default} {{name=NAME HERE}} [[?{THAC0|10} +?{Modifier|0} - [[1d20]] ]] {{THAC0=[[?{THAC0}]] }} {{Modifier=[[?{Modifier|0}]] }} {{d20 roll=$[[0]]}} {{AC Hit=$[[1]]}} With the same provisor about the modifier.
This one works great. Thank you so much! GiGs said: If you want to remove the max of 10 and min of -10 that simplifies the code a bit. &amp;{template:default} {{name=NAME HERE}} [[?{THAC0|10} +?{Modifier|0} - [[1d20]] ]] {{THAC0=[[?{THAC0}]] }} {{Modifier=[[?{Modifier|0}]] }} {{d20 roll=$[[0]]}} {{AC Hit=$[[1]]}} With the same provisor about the modifier.
1640106246
GiGs
Pro
Sheet Author
API Scripter
That's great! I just remembered, if you do switch the modifier to a nagtive you should bracket the modifier, like so: [[?{THAC0|10} -(?{Modifier|0}) - [[1d20]] ]] This is to avoid a problem with entering a negative modifier, when you have, say - -3. Roll20 doesnt like two negative signs, but if your put the -3 in brackets it works properly, so -(-3) is fine.
1640106732
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
GiGs said: Isnt there a maximum of 10, and minimum or -10? Thats what the basic code suggests above. Yeah, that's what I gleaned from the code block. It's a lot simpler without those constraints.
Hmmm. I used a Thaco of 18 with a -2 modifier and rolled a 20 on the d20. The result should be -4 [(18-2)-20] but it comes up 0. If I use the macro without the min/max 10s it works perfectly. I've tried making my own macros but I'm so used to writing BASIC programs, the formatting confuses me.
1640114791
GiGs
Pro
Sheet Author
API Scripter
Applying both a minimum of -10 and a max of 10 on this roll requires complex syntax. There's likely a mistake in my code. Does Keith's work okay? Also do you need those constraints?
Keith's works great. The 10's restraints are optional I guess. There are ACs higher/lower than 10/-10 but they're rarely used.
1640122930

Edited 1640122978
GiGs
Pro
Sheet Author
API Scripter
If Keith's works fine, you can just swap it into the template I posted, with a few tweaks, like so: /w gm &amp;{template:default} {{name=NAME HERE}} [[{[[{[[?{THAC0|0} + ?{Modifier|0}+0d0]]-[[1d20]],10}dh1]],-10}dl1]] {{THAC0=[[?{THAC0}]] }} {{Modifier=[[?{Modifier|0}]] }} {{d20 roll=$[[1]]}} {{AC Hit=$[[2]]}} But if you need to account for the occasional above 10 or below -10 AC, it's probably best top use the simpler version that allows exceeding the ends.
Thank you GiGs, it's greatly appreciated.