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 .
×

Possible to pull a number from a temporary variable?

1430400910

Edited 1430401059
So, what I'm trying to do is streamline how many macros my players have on their screens instead of having 5 different macros for all their different weapons. Right now all 5 macros individually pull from weapon1damage, weapon2damage, etc...I tried to concoct a formula using a temporary variable, then placing it in the spot of the number. The number ENTRY works fine, but then the hard variable gets broken, because it doesn't have that kind of support. Is there ANY way for me to input a number variable at the start that the macro can keep pulling until it's finished?
1430401943
Ziechael
Forum Champion
Sheet Author
API Scripter
Not currently due to the order of operations (<<<see the dice reference in the wiki for more info). There is work being done on nested inline rolls which might allow this in the future though (i am speculating having not played around with the nested inline rolls yet...).
1430435733

Edited 1430436227
if the macro only had 2 weapon#damage attributes to function from then you could use some variables operating off the property of inversion to switch between them... basically (1-?{weapon Number?|1}-1)*(@{weapon1damage}) + (?{weapon Number?}-1)*(@{weapon2damage}) However the addition of a 3rd option makes inversion not work anymore... I'm currently working on figuring out something with nested inline rolls... I'll post back later if I figure it out I figured it out like 5 seconds after posting.... here you go... [[ [[{d0+?{weapon number?|1}}=1]]*(@{weapon1damage}) +[[{d0+?{weapon number?|1}}=2]]*(@{weapon2damage}) +[[{d0+?{weapon number?|1}}=3]]*(@{weapon3damage}) +[[{d0+?{weapon number?|1}}=4]]*(@{weapon4damage}) +[[{d0+?{weapon number?|1}}=5]]*(@{weapon5damage}) ]] How this works is they input the weapon number when prompted... it will compare that number with each of the 5 operations and will return a 0 on all of them except for the one that matches. The one that matches will return 1*(@{weapon#damage})
Christine B. said: So, what I'm trying to do is streamline how many macros my players have on their screens instead of having 5 different macros for all their different weapons. Right now all 5 macros individually pull from weapon1damage, weapon2damage, etc...I tried to concoct a formula using a temporary variable, then placing it in the spot of the number. The number ENTRY works fine, but then the hard variable gets broken, because it doesn't have that kind of support. Is there ANY way for me to input a number variable at the start that the macro can keep pulling until it's finished? Yup! The ?{} function acts as a variable, so after you input it once, you can reuse that same variable in multiple places as long as the name is the same. [[?{Number|0} + ?{Number|0} + ?{Number|0}]] If you input 1, the result you would get is 3.
I have discovered that you don't need the extra |0 in your statement Benson: [[?{Number|0} + ?{Number} + ?{Number}]] Still comes up with 3, as an FYI. :D
1430461126
Gen Kitty
Forum Champion
Amanda, when copying and pasting it is nice to not have to be finicky and remove the extra |0 from the rollquery :>
1431787351

Edited 1431787766
Chell said: if the macro only had 2 weapon#damage attributes to function from then you could use some variables operating off the property of inversion to switch between them... basically (1-?{weapon Number?|1}-1)*(@{weapon1damage}) + (?{weapon Number?}-1)*(@{weapon2damage}) However the addition of a 3rd option makes inversion not work anymore... I'm currently working on figuring out something with nested inline rolls... I'll post back later if I figure it out I figured it out like 5 seconds after posting.... here you go... [[ [[{d0+?{weapon number?|1}}=1]]*(@{weapon1damage}) +[[{d0+?{weapon number?|1}}=2]]*(@{weapon2damage}) +[[{d0+?{weapon number?|1}}=3]]*(@{weapon3damage}) +[[{d0+?{weapon number?|1}}=4]]*(@{weapon4damage}) +[[{d0+?{weapon number?|1}}=5]]*(@{weapon5damage}) ]] How this works is they input the weapon number when prompted... it will compare that number with each of the 5 operations and will return a 0 on all of them except for the one that matches. The one that matches will return 1*(@{weapon#damage}) This would be wonderful, except that I'm trying to do it as a token action, and I...can't seem to make the system understand how to do that, AND pull those attributes from a specific character. When I try to nest it within the macro I made, it never returns anything. I'm not trying to be a jerk and make the community do everything for me - if I figure this out I'll post what I have here.
1431793039
Lithl
Pro
Sheet Author
API Scripter
In order to pull an attribute from a specific character, you use @{Character Name|Attribute Name}. Getting the value of weapon1damage for the character Christine would thus be @{Christine|weapon1damage}