I need some help with a macro
I am trying to create a macro that will roll 2 dice then take the highest one, if it is ten roll and extra die and then if that die is 10 reroll and add it to the total. plus add 12 to the total.
[h: var1 = 0]
[h: var2 = 2d10k1]
[h: var3 = 12]
[h: var4 = 1d10]
[h: var5=0]
[h, while (var1 == 0), code: {
[h, if(var2 == 10): var5=var2+var4+var3; var1 =1]
}]
[r: var5]
right now no math is working, and when a 10 is rolled i get this:
Too many loop iterations (possible infinite loop?) Statement options (if any): h, while (var1 == 0), code Statement Body : { [h, if(var2 == 10): var5=var2+var4+var3; var1 =1] }
help with macro
Moderators: dorpond, trevor, Azhrei, Gamerdude
Re: help with macro
nvm i have figured it out here is what we came up with
[h: var1 = 0]
Damage [r: var2 = 2d10k1] + 12 =
[r: var3 = var2 + 12]<br>
[r, if(var2==10), code:{
[while(var2==10), code:{
[r: if(var3==22, "Rightous Fury!!!!!<br>Bonus Roll ", "")]
[r: var4=1d10]
[h: var3=var3+var4]
[h: var2=var4] }] };{
}]
<br>Total Damage [r: var3] pen 5
[h: var1 = 0]
Damage [r: var2 = 2d10k1] + 12 =
[r: var3 = var2 + 12]<br>
[r, if(var2==10), code:{
[while(var2==10), code:{
[r: if(var3==22, "Rightous Fury!!!!!<br>Bonus Roll ", "")]
[r: var4=1d10]
[h: var3=var3+var4]
[h: var2=var4] }] };{
}]
<br>Total Damage [r: var3] pen 5
Re: help with macro
you could of course also check my code in the framework that also uses the words 'righteous fury'. For one, for the second reroll of the RF you can simply use 1d10e instead of the whole while loop. the first you need to check as only 1 10 get rerolled and if you roll more then 1 you need some check. I don't know what you're using this for but you might also want to consider to make this code scalable (e.g. also allows for 3d10 or more). By the way don't you need to confirm the RF with another succesfull attack roll?
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: help with macro
not against aliens, but this is for someone else campaign. i am trying to convince them to use your framwork.
Re: help with macro
ah, well as I said, use exploding dice instead of the while looplavabeast wrote:not against aliens, but this is for someone else campaign. i am trying to convince them to use your framwork.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: help with macro
hmm i can't get it to work the way i need it to work
i need it to roll 2 get the highest and see if that rolled a 10 then roll again and see if that rolled a 10 and so on.
i tried
2d10k1s10 and all i get is 2
i need it to roll 2 get the highest and see if that rolled a 10 then roll again and see if that rolled a 10 and so on.
i tried
2d10k1s10 and all i get is 2
Re: help with macro
No in pseudo code
Code: Select all
result = 0
rf = 0
numdie=2
count(numdie),code:{
roll = 1d10
result = result + roll
if(roll == 10): rf = 1
}
If(rf):result = result + 1d10e
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: help with macro
Code: Select all
[h: result = 0]
[h: mod = 12]
[h: sides = 10]
[h: reroll = 10]
[h: ro = keep(2, sides, 1)]
[h: result = ro]
[r,while(ro == reroll), code:
{
[h: ro = roll(1, sides)]
[h: result = result + ro]
}]
[h: result = result + mod]
[r: "result is " + result]
mod is the number added to the result
sides is the number side of the type of dice you want to use
reroll this is the number that the die will be rerolled
ro is the current roll
You can change the starting result before it started to even something like 2d10.
If you want to use 6 side dice instead just change [h: sides = 10] to [h: sides = 6]
Changing reroll will change what number the die will be rerolled on. In the code, the die will be rerolled on a 10, but you can change it to another number.
You can change the starting ro value. If you just want to have a single roll then change:
[h: ro = keep(2, sides, 1)] to [h: ro = roll(1, sides)]