Hello,
I made a sort of simple dieroller just out of boredom as an alias. It works fine if I do a simple #d# roll, but if I try to add a bonus or penalty, it doesn't work.
mydice *d* <--original alias
if I did: 1d10
My output would be:
1d10 rolled 5 (or some other number besides 5)
But with:
mydice *d* + * <---'upgraded' alias
If I do my output as 1d10 + 3
My output is:
1d13 rolled 5 (or some other number between 1->13)
What I want is for it to literally do 1d10, then add 3. But that isn't happening.
Below is the body of my alias, can you tell me what is wrong? I think it has to do with me using the '+' in the actual alias command, so maybe I need a way for Lua to ignore that + somehow, so it doesn't add %2 and %3 together?
--body of alias below--
math.randomseed(os.time())
math.random()
numberOfDice = %1
dieSides = %2
result = (math.floor (MtRand () * dieSides) +1)
sum = 0
for i = 1, numberOfDice, 1 do
roll = (math.floor (MtRand () * dieSides) +1)
sum = roll + sum
end
bonus = %3
sum = sum + bonus
Note(numberOfDice .. "d" .. dieSides .. " rolled " .. sum)
--end body of alias--
I made a sort of simple dieroller just out of boredom as an alias. It works fine if I do a simple #d# roll, but if I try to add a bonus or penalty, it doesn't work.
mydice *d* <--original alias
if I did: 1d10
My output would be:
1d10 rolled 5 (or some other number besides 5)
But with:
mydice *d* + * <---'upgraded' alias
If I do my output as 1d10 + 3
My output is:
1d13 rolled 5 (or some other number between 1->13)
What I want is for it to literally do 1d10, then add 3. But that isn't happening.
Below is the body of my alias, can you tell me what is wrong? I think it has to do with me using the '+' in the actual alias command, so maybe I need a way for Lua to ignore that + somehow, so it doesn't add %2 and %3 together?
--body of alias below--
math.randomseed(os.time())
math.random()
numberOfDice = %1
dieSides = %2
result = (math.floor (MtRand () * dieSides) +1)
sum = 0
for i = 1, numberOfDice, 1 do
roll = (math.floor (MtRand () * dieSides) +1)
sum = roll + sum
end
bonus = %3
sum = sum + bonus
Note(numberOfDice .. "d" .. dieSides .. " rolled " .. sum)
--end body of alias--