help with macro

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
lavabeast
Cave Troll
Posts: 28
Joined: Sun Mar 20, 2011 10:57 pm

help with macro

Post by lavabeast »

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] }

lavabeast
Cave Troll
Posts: 28
Joined: Sun Mar 20, 2011 10:57 pm

Re: help with macro

Post by lavabeast »

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

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: help with macro

Post by wolph42 »

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?

lavabeast
Cave Troll
Posts: 28
Joined: Sun Mar 20, 2011 10:57 pm

Re: help with macro

Post by lavabeast »

not against aliens, but this is for someone else campaign. i am trying to convince them to use your framwork.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: help with macro

Post by wolph42 »

lavabeast wrote:not against aliens, but this is for someone else campaign. i am trying to convince them to use your framwork.
ah, well as I said, use exploding dice instead of the while loop

lavabeast
Cave Troll
Posts: 28
Joined: Sun Mar 20, 2011 10:57 pm

Re: help with macro

Post by lavabeast »

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

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: help with macro

Post by wolph42 »

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

Wiouds
Kobold
Posts: 1
Joined: Fri Nov 23, 2012 4:47 pm

Re: help with macro

Post by Wiouds »

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]
result is the total number of all the dice rolls
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)]

Post Reply

Return to “User Creations”