Advertisement Create a free account

Macro for set variables and calculating end result

1555188218
First off, the people I'm DMing for stop reading, you know who you are. Now, I am trying to set up a macro to determine how much rainfall happened in a time period. To do this i am first trying to get it to roll 1d3(level of rain) and 1d8 (number of hours of rain) and set those as specified variables. So then,i can use Ifelse/then statements to have it do another roll for the total inches of rain per hour multiplied by the number of hours.  I cannot seem to find a way to define a variable to the result of a roll. I haven't even touched how to do the if statements yet because I can't figure out the first part. I am using this for ToA stuff, if anyone has a similar macro they used or suggestions, its much appreciated. 
1555189515
GiGs
Pro
Sheet Author
Are you trying to do this is an API script or a macro? Macros dont support conditional logic - there's no way to do if/then expressions.  I'm not sure what if/then statement you need though. Cant you just do 1d3 x 1d8 ?
1555330560
I have been trying to do this in a marco. I am new to Pro, a couple weeks, and not sure how to use the API just yet. If this can't be done in a macro it seems its time i bite that bullet and start reading up on the API.
1555342782

Edited 1555342832
GiGs
Pro
Sheet Author
I am not confident I'm understanding what you need properly, because what you've asked for doesn't seems to need the the API. You can combine rolls in a single macro, like /roll 1d?{rain|3} * 1d?{hours|8} and it will roll them both. If you need the rolls stored as variables, you can use a character sheet for that. Create a character sheet, call it GM, and add two attributes (on the Attributes and Abilities tab - ignore all the other attributes on there). Give them these values: Rain: 1d3 Hours: 1d8 Then you can create a macro to roll them: /roll @{GM|Rain} * @{GM|Hours} You can pretty these up by using the default roll template: &{template:default} {{name=Precipitation}} {{Rain/Hour=@{GM|Rain}}} {{Hours=@{GM|Hours}}} {{Total Rain=[[@{GM|Rain} * @{GM|Hours} ]] }} You can find more about macros on the roll20 wiki.