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

Cthulhutech Dice API

June 17 (9 years ago)
Hi I want to run a game of Cthulhutech but the dice are weird. it uses d10's and you can use the highest single die, double or stright.
June 17 (9 years ago)

Edited June 17 (9 years ago)
The Aaron
Pro
API Scripter
Can you give some examples of how this mechanic works?

  • 1 3 6 9 = uses 9 as the number?
  • 2 2 4 4 8 = uses 8 or uses 4 4 ?
  • 1 2 3 5 5 10 = uses 10 or 5 5 or 1 2 3 ?
June 17 (9 years ago)

Edited June 17 (9 years ago)
esampson
Pro
Sheet Author
Those probably aren't great examples, but the answers for them are 9, 8, and 10. 8 and 10 could be either because of the highest number or because of the doubled 4 and doubled 5.

It is sort of a 'poker' system. It isn't just doubles but any identical numbers. If we modify your last example to 1 2 3 4 5 6 6 6 10 then the total would be 21 (the sum of 1 through 6). If we were missing one of the 1-5 numbers (e.g. our dice are 1 2 4 5 6 6 6 10) then the total would be 18 because of the 3 6's. If we were also missing one of the 6's (i.e. 1 2 4 5 6 6 10) then our total would be 15 because of the straight of 4 5 6. A straight can be as small as two numbers so if we lose another 6 and the 4 (i.e. 1 2 5 6 10) then our total is 11 because of the 5 and 6.

It really doesn't matter which method you use for getting a total. A straight and a single die are equal if they both produce the same total so in the last two examples you gave it would make no difference how you total 8 or 10. The numbers are all that matter.

Make sense?
June 17 (9 years ago)
The Aaron
Pro
API Scripter
Ah, definitely!

How about the number of dice being rolled? Would it be sufficient to have an API script that you ran like this:
!cd 7
Which would roll 7 d10s and then output something like:
1 4 5 6 6 6 10 = 18
(but probably with better formatting)

Also, would you want to whisper the roll to the GM at any point, or have the roll only shown to the person running the macro and the GM, that sort of thing?
June 17 (9 years ago)
esampson
Pro
Sheet Author
Yeah, the number of dice that can be rolled is variable. All the rest (whispering, formatting, etc.) I'll leave up to you and the original poster. :)
June 20 (9 years ago)
The Aaron
Pro
API Scripter

CthulhuTechDice v0.1.1


Here it is! I styled it to match their website. =D

There are two commands:
  • !ct [[#d10]] -- Takes an inline dice expression and figures out the best result from the rolled dice.
  • !wct [[#d10]] -- The same as !ct, except the result is whispered to the GM.

Here are a few examples for !ct [[6d10]]:


Here are a few examples for !ct [[3d10]]:


Here are a few examples for !wct [[10d10]]:


Enjoy! =D

Git: https://github.com/shdwjk/Roll20API/blob/master/Ct...
June 20 (9 years ago)
Thank you so much this is great!!!
June 20 (9 years ago)
I'm such a goof I should have mentioned that you add one of your attributes to the rolls total. Aaron What you did is still awesome and i really like the look :D
June 20 (9 years ago)

Edited June 20 (9 years ago)
The Aaron
Pro
API Scripter
No worries, I can add an attribute to the result. I'll add a 2nd parameter tomorrow that gets added to the result. It will look like !ct [[6d10]] 7 and I'll also add a place for it in the output. :).

Edit: !ct [[6d10]] @{attrname} will also work.
June 20 (9 years ago)
your the best thank you
June 20 (9 years ago)
the only other thing I've found is that it is doing runs of 2 dice, it has to be three dice.
June 20 (9 years ago)
The Aaron
Pro
API Scripter
Not a problem, I can fix that as well! =D
June 20 (9 years ago)
The Aaron
Pro
API Scripter
Update v0.1.6 -- Runs are only considered for 3 or more:

Now Supports a bonus:
  • !ct [[6d10]] 6
  • !ct [[7d10]] @{attr_that_is_a_number}}
  • !wct [[3d10]] [[@{attr_with_complex_logic_}]]

Anything that isn't an integer is ignored.

Let me know if there are any other issues! =D

GIT: https://github.com/shdwjk/Roll20API/blob/master/Ct...
June 20 (9 years ago)
wow your quick, thank you.
June 20 (9 years ago)
The Aaron
Pro
API Scripter
No worries! One more feather in my API cap. =D Alternate dice mechanics are a great use of the API, and also fun smaller scope problems to solve.
June 21 (9 years ago)
I'm glad you like what you do :D
June 21 (9 years ago)
Mister Sinister
Sheet Author
I don't know much about Cthulhu Tech but the script/display looks superb.
June 21 (9 years ago)
The Aaron
Pro
API Scripter
Thanks! The formatting took 4 times as long as the mechanics. =D
June 23 (9 years ago)
Yeah my players really like the look of it
June 23 (9 years ago)
Oh is there any way for it to let you know when you botch. It happens when half of the dice you roll come up 1s
June 23 (9 years ago)
The Aaron
Pro
API Scripter
I can add that. What other details would you want to know at that point?
June 23 (9 years ago)
i think that's it, just the botch thing

June 24 (9 years ago)
The Aaron
Pro
API Scripter
Botch added! See what you think!

If half or more dice come up as 1s, it will show Botch. It still shows the dice rolled and what would have been the result, just in case you need it. (but you'll have to figure out for yourself if it was sets/runs/high num).



GIT: https://github.com/shdwjk/Roll20API/blob/master/Ct...
June 24 (9 years ago)
Awesome as always lol
June 24 (9 years ago)
The Aaron
Pro
API Scripter
=D Glad you like it!
July 19 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
I was just about to start a thread asking for this exact mechanic, and here it is. So, I'm three weeks late, but...awesome work The Aaron. Thanks!
July 20 (9 years ago)
The Aaron
Pro
API Scripter
Cool! I always love to hear back when some of these more obscure scripts are getting used. Glad you like it! Let me know if it needs anything added to it.

This script was particularly fun to write, as I was trying to match the style of the game as much as possible (and using some more advanced CSS whatnots. =D ). Happy rolling!
July 25 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
Okay, got a couple some of questions:  

Can I pull just the result and use it some where else, such as a roll template?

Can I put the API output into a roll template?

Is there a way to add some emote lines after/before the API output?

Thanks for you time! 
July 26 (9 years ago)
The Aaron
Pro
API Scripter
No, there isn't a way to use the output in a roll template, result or otherwise. 

You on can certainly as emote lines around it in a macro:
/em does something
!ct [[6d10]] 6
/em did something

THe API can output Roll Templates, so what have you got in mind, I might be able to suggest a solution?
July 28 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
Not exactly sure yet.  Right now the beautiful script you wrote does the roll, but not who is rolling it (other than the chat box), what they are rolling (which skill, attribute, weapon, etc), and I'm not absolutely positive on how to add that information.

If I can line break after/before (or both) I am pretty sure I can put a template above and/or below the API output to cover that requirement.  I do know I can style API (cuz, ya know, power cards) but I'm not quite ready to jump into that pool.
July 28 (9 years ago)
The Aaron
Pro
API Scripter
Ah, I could certainly include the speaking as in the output or take it as a parameter, could take the skill as well.
August 26 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
I know you are up to your gills with real life and other folks stuff, but you could add a "parameter" (I think) for the character name and the skill or weapon used, it would make me very pleased.  To be clear, I want to hit the API button, and the acting character's name and the skill/weapon used appears with the die results.

Thank you for the work you've done already.
August 26 (9 years ago)
The Aaron
Pro
API Scripter
I will see about doing this over the weekend.  Should be a pretty simple change. =D
August 31 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author

The Aaron said:

I will see about doing this over the weekend.  Should be a pretty simple change. =D

Just staring, not asking, implying, or making any inquires of any kind.  Just staring...
August 31 (9 years ago)
The Aaron
Pro
API Scripter
hahahaha, yeah, I get that a lot...  not yet.  I'll put a bug report in github just to be sure I follow up on it...  =D
September 05 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
Yep.  Just staring.  Staring at that over there...for while.  Now looking over here.  Maybe a little looking over there...
September 06 (9 years ago)
The Aaron
Pro
API Scripter
Updated 1.8 -- Added optional labels/text.  You can append as many arguments of the form --<RED>|<WHITE> as you like and have the prepended to the roll:
!ct [[8d10]] 6 --Name|Bob the Hero --Weapon|Plasma Rifle


You can omit either side as well, if you'd like to choose a line or red or white:
!ct [[8d10]] 6 --|Bob the Hero --Plasma Rifle


Inline Rolls are expanded:
!ct [[8d10]] 6 --Additional Help|[[1d6]] Drones


Let me know how it goes!

https://github.com/shdwjk/Roll20API/blob/master/CthulhuTechDice/CthulhuTechDice.js
September 07 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
I was showing off a character sheet I made, and then showed them the cool dice script.  They said that was neat, and asked "How do you do API scripts?"

I answered "I go to the API forums and hope like mad that The Aaron is bored..."

Thank you for your work.
September 07 (9 years ago)
The Aaron
Pro
API Scripter
Hahaha. You're welcome!  Hope it works works you. 
September 07 (9 years ago)

Edited September 07 (9 years ago)
vÍnce
Pro
Sheet Author
He's on a roll the last 24hr. Aaron's "Moby Dick", Char-mod still eludes capture.
September 07 (9 years ago)
The Aaron
Pro
API Scripter
Man, you're hitting that one pretty hard!  :). It's next on my list, I swear!
September 21 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
Just to be sure, when you said "anything not an integer is ignored", I cannot use (floor(@{x}/2))d10 in the script, correct?
September 22 (9 years ago)
The Aaron
Pro
API Scripter
You're talking about for the bonus?  You should be able to use an inline roll there, you'd just need to put the [[ ]] around it. If that doesn't work, let me know and I'll fix it. :)
September 22 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
I meant the place where you put the dice.  Using this example, I mean the 8d10.  
!ct [[8d10]] 6 --Name|Bob the Hero --Weapon|Plasma Rifle

In my game, I am using: 

!ct [[ (@{skill} + @{skill_bonus}) ]] @{static_bonus} --Name|Bob the Hero --Weapon|Plasma Rifle

I would like to be able to use 

!ct [[ floor(@{skill} /2) ]] @{static_bonus} --Name|Bob the Hero --Weapon|Plasma Rifle

But its not that important. I was wondering if I was messing up the html/math part, or if the script doesn't play well with rounding.
September 22 (9 years ago)
The Aaron
Pro
API Scripter
The script expects the first part to be an inline role of the dice to examine for sets and runs and such. You could do something like this:
!ct [[ [[ floor(@{skill} /2) ]]d10 ]] @{static_bonus} --Name|Bob the Hero --Weapon|Plasma Rifle
and everything would be copacetic.
September 22 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
You get extra points for using the word "copacetic"
September 22 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
...however....its not working.
September 22 (9 years ago)
The Aaron
Pro
API Scripter
WEIRD!!   Just looked into it.  Apparently they changed the way the inline rolls are represented, specifically they now give us all the nested inline rolls along with the inline rolls (that didn't used to happen).  I've adjusted the script to account for that.

Update 0.1.9 - Respect offsets for inline roll position.  
https://github.com/shdwjk/Roll20API/blob/master/Ct...
September 22 (9 years ago)
Coal Powered Puppet
Pro
Sheet Author
...already?  That is not possible...

Wait, did you write a script to see the future and know I was going to ask for that, made the script, and simply waited until I asked?  
September 22 (9 years ago)
The Aaron
Pro
API Scripter
=D  Nah, was an easy fix. 3 line change.  =D