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 Writing Dice Macros

So I want to run a sci-fi game using the Traveller 4th Edition method of doing rolls. The way it does it is that each difficulty is a different die code - that way, once you have your skill total you don't have to mess with it (until you get more skill or more/less attribute, or both). It also means that a player cannot roll ahead of time because they need to know the Difficulty so they know what dice to roll. It is a roll under skill total mechanic, where the average skill will be ~9. The dice work like so (Difficulty Level | Die/Dice Code): Easy = 1d6 Average = 2d6 Hard = 2d6+1d3 Difficult = 3d6 Very Hard = 3d6+1d3 Staggeringly Difficult = 4d6 Nigh Impossible: 4d6+1d3 What the Hell do you think you are doing?!? = 5d6 Can someone show me the formula needed for a macro of this? Nothing fancy needed, though will like to see the individual dice results along with a total.
1626698167
Finderski
Pro
Sheet Author
Compendium Curator
A quick and easy way would be: /r [[?{Number of Dice to roll|1|2|3|4|5}]]d6+?{Modifier|0|1d3}
1626698910

Edited 1626699002
OK. Excellent. Thanks. That will work great. I am assuming that with that method they could actually roll 5d6+1d3, couldn't they? Oh well, I guess I need to make another difficulty level. I think I will call it, "You just wanna die now, don't you?"
1626699415
timmaugh
Pro
API Scripter
If you don't want to have to type the number of d6 and d3, you could use Muler and store your table as a Mule. You could use it as is with a deferred inline roll, or include the roll brackets in the Mule to make it more straightforward: Easy=[[1d6]] Average=[[2d6]] Hard=[[2d6+1d3]] Difficult=[[3d6]] Very Hard=[[3d6+1d3]] Staggeringly Difficult=[[4d6]] Nigh Impossible=[[4d6+1d3]] What the hell=[[5d6]] Then you could just ask for the difficulty level and the correct dice would be chosen. !get.?{What difficulty is this action?|Easy|Average|Hard|Difficult|Very Hard|Staggeringly Difficult|Nigh Impossible|What the hell}/get {& simple} {&mule DifficultyTable} Scripts required: Muler , ZeroFrame
Wow. OK, I will check that out. Thanks. Will it walk me through how to set up that code? I am a serious noob when it comes to this.
1626703886
timmaugh
Pro
API Scripter
There are instructions on the threads for those scripts, but it might help to cut to the chase of what you need to know: Create a character, and give control rights to everyone who will need to access the mule table. Create an ability called "DifficultyTable" and paste in the table from my previous post. Save/close the ability To make a mule available to a roll, use the {& mule...} syntax {& mule DifficultyTable} => loads the first ability found called DifficultyTable (from all characters you control) {& mule TableMule.DifficultyTable} => loads the DifficultyTable mule from a character named "TableMule" {& mule DifficultyTable, Chronos.TimeModifier} => loads first "DifficultyTable" and the "TimeModifier" mule from character "Chronos" Then to get a value from it, you use the get syntax get.variable/get => if the variable is uniquely named among all LOADED mules (for this call), you can just reference the variable get.mule.variable/get => if multiple loaded mules might contain the same variable name, you can get it from a specific mule If you want to add a new variable to the mule, just add a new line setting the variable name equal to the inline roll that should result. For instance, here are two more variables: You just wanna die now?=[[8d6]] Caskets don't fill themselves=[[9d6]] Add these to the roll query by using the variable name. For roll queries, pipe characters separate options, commas separate label vs returned value... so it might be easier to name your variables something like "wannadie" and "caskets", and then reference them in the roll query by using your full text as the value the player would see (i.e., "You just wanna die now?") and returning the "wannadie". I say "return" because that's how you should think of it. Roll20 parses the line to remove the roll query and leave the result in that place in the command line. For us, that means putting the result of the query into the variable position of a get statement: get.<roll query result>/get These metascripts (like Muler) are working on (and changing) your command line. This can happen before it is sent to another script, or before your message is sent to the chat interface. In your case, you need the finished command line to be processed through the chat, so we include the {&simple} construct. So although we start with an exclamation point (to initiate the API processing the message), when all of that work is done, we want to dump the finished line out to the chat. In the example from my previous post, that was just a roll result... but it could be a part of a roll template, too: !&{template:default}{{name=Difficulty Check}}{{Result=get.?{What difficulty is this action?|Easy|Average|Hard|Difficult|Very Hard|Staggeringly Difficult|Nigh Impossible|What the hell}/get}} {& simple} {& mule DifficultyTable}
1626704961
Finderski
Pro
Sheet Author
Compendium Curator
Randall T. said: OK. Excellent. Thanks. That will work great. I am assuming that with that method they could actually roll 5d6+1d3, couldn't they? Oh well, I guess I need to make another difficulty level. I think I will call it, "You just wanna die now, don't you?" It would, but you could also do it differently...like this: /r ?{Difficulty|Easy,1d6|Average,2d6|Hard,2d6+1d3|Difficult,3d6|Very Hard,3d6+1d3|Staggeringly Difficult,4d6|Nigh Impossible,4d6+1d3|What the Hell do you think you are doing,5d6}
1626714343

Edited 1626714439
GiGs
Pro
Sheet Author
API Scripter
Yeah, Muler's a bit overkill for this when a simple query works fine. I was just about to post that but Finderski beat me to it :) That said, Tim, it would be a great idea to compile your many responses demonstrating how to use your meta scripts, maybe in a subsection of the wiki or even a documentation pdf, so people have easy access to worked examples on how to use them.
1626714888
timmaugh
Pro
API Scripter
GiGs said: Yeah, Muler's a bit overkill for this when a simple query works fine. I was just about to post that but Finderski beat me to it :) That said, Tim, it would be a great idea to compile your many responses demonstrating how to use your meta scripts, maybe in a subsection of the wiki or even a documentation pdf, so people have easy access to worked examples on how to use them. I agree on both counts! It was a forehead-slapping moment when Finderski posted. Sometimes you don't remember the obvious things when you're down in the weeds! And I agree that the wiki might be the best place to collate all of my examples... I will see if I can put that together.
Thanks for all the help everyone! Now just to make a character sheet. 😱😱😱 With that in mind: is it possible to make a form fillable pdf and upload it with the fields able to be used normally? Because, I can make a form fillable pdf.
1626718836

Edited 1626719101
GiGs
Pro
Sheet Author
API Scripter
No, unfortunately thats not possible at all. Roll20 sheets are HTML, css, and sometimes javascript, and have to be custom built for roll20. You can even use HTML pages built for other sites. Note that with a form-fillable pdf, the data in the forms is stored inside the pdf, and would only be visible to its single user. With roll20 sheets, the data (attribute values, etc) is not stored in the character sheet - it's stored on roll20's servers, somewhere else in the world. And when someone else views a sheet, the data is loaded from their servers into the sheet, so everyone can see it. Roll20 sheets can handle this process seamlessly, that's what they are built for, and you the user or sheet creator rarely have to think about it..
1626718998

Edited 1626719011
That's what I thought. Oh well. Thanks for the quick response.