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 .
×
May your rolls be chill this holiday season!
Create a free account

Math in Macro Names

My friends and I are playing Pokémon Tabletop United, a system where damage is broken up into 28 distinct hit dice sets called Damage Bases, or DB for short. To give you a frame of reference, db4 is equivalent to 1d8+5, whereas db6 is equivalent to 2d6+8, and the hit dice get larger as you go up. I've incorporated all 28 damage bases as macros in my game, but like in many other RPGs, I would like to be able to provide modifiers to damage base totals. For example, the move Tackle (also a macro since it is a very common move) has a Damage Base of 4, and I want to provide a bonus that increases its damage base to 6. Tackle runs #db4 as a macro, so I thought that something along the lines of #db[[4+Bonus]] would work so that I could change the called macro to a higher value. Does anyone know how to make these modifications?
1388119140

Edited 1388119202
Gauss
Forum Champion
You could put query ( ?{Modifier|0} ) in the macro. Example: 1d8+5 +?{Modifier|0} The format for a query is ?{Query name|Default Value} Alternately, if you type #db4 into the chat log you can manually add something to the end of it and it will be added to the last line of the macro. Example: #db4 +5 will add +5 to the last line of the macro.
That's what I've settled for as of now. But here's what I'd like to do: Say for example that there is a bonus that temporarily increases Damage Base by 2. I would like to be able to apply some kind of modification to the #db4 macro (which rolls 1d8+5) that increases it by 2 to the #db6 macro (which rolls 2d6+8) Does this make sense?
perhaps you could do something with calculated die rolls? Syntax: (N+Y)dX or Nd(X+Y) Example: 1d( 6 + @?{Sides Bonus|0} ) (I haven't tested this yet, but I believe that should default to 1d6, but ask you if you want to add a bonus to the 6. If you were to enter a 2 that would become 1d8.)
Yeah, but if you look closely, db6 and db4 don't even roll the same kinds of dice. My intention is to mathematically change the name of a macro in order to call a different kind of die roll. I understand that this is unusual, sorry.
Being a mentor you have access to the API. Using the API you can create a custom function that can be called from chat that will take in the current damage base and a modifier and then make the appropriate roll. Here is a link to a topic in the script forum that can show you how to create and call a custom function. What you need to do is a lot less complicated than what they have done. I can probably help get you reasonably close to the script you need, but only if you want to go that route.
I definitely saw a few things in there that look like they'll help, but this API stuff is still pretty much Greek to me...