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

Trying to do a bunch of complicated thing with one macro but not sure it can be done

I'm trying to make a macro to build an army's composition without having to roll a bunch of time. Those include rolling: 1-The number of people in every squad depending of the number of squad roll 2-The level of a NPC depending if a % is high enough 3-A % dice that determine what of monster and how many (ei on a d100 [1-10] = d4 red dragon, [11-20] = d3 green dragon, [21-100] = nothing) As an example, if I try to make a macro to generate a bunch of Ogre from AD&D 2e the rules are -Roll 2d10 for number of ogre (4d8+1 HP) -If more than 11 add Ogre Leader (30-33 HP) -If 16 or more add Ogre Chieftain (34-37 HP) + 2 Patrol leaders (Same HP as Ogre Leader) In java would give me this int numberOgres = roll("2d10");         for(int i = 1; i <= numberOgres; i++){             System.out.println("HP of Ogre " + i + " is " + roll("4d8+1"));         }         if(numberOgres >= 16){             System.out.println("HP of Ogre Chieftain is " + roll("1d4+33"));             System.out.println("HP of Ogre Leader 1 is " + roll("1d4+29"));             System.out.println("HP of Ogre Leader 2 is " + roll("1d4+29"));         }         else if(numberOgres > 11){             System.out.println("HP of Ogre Leader is " + roll("1d4+29"));         } I'm not finding anything ATM nor seeing how I can do this without a character sheet to store temporary variables. TL:DR, how do you make loops and if else statement in Roll20
1451764486
Gen Kitty
Forum Champion
The short answer is, "You don't without access to API, which is a Pro level subscription perk."  Your macro could easily be crafted in Powercards , or a custom-written API could be written by one of our Scriptomancers. The base diceroller just is not that sophisticated.  I suspect, however, some of our more inventive macro-crafters will be by to offer their help on how to approximate what you're after without access to API.
1451764923

Edited 1451764956
Ziechael
Forum Champion
Sheet Author
API Scripter
With a free account this won't really be possible, the API (a pro subscriber perk) could handle it as it utilises javascript. You could however set up a series of rollable tables with the information in and generate random results that way, while you couldn't nest other tables conditionally you could easily use the tables to tell you when another table result is required. Check out the  wiki  for more info. [edit] i should really refresh before posting an answer if i've had the page open a while lol
Was expecting that to be the case when I found out how much of a nightmare if/else looked like in macros, thanks you. Also I'm sure somebody is able to come up with something but at that point I'll just generate the maximum and remove the unnecessary stuff, it'll be way simpler and faster.