ID:2730522
 
(See the best response by Lummox JR.)
Code:
src.dmg_dice += O.dmg_dice


Problem description:
I had hoped that I could get away with doing something like this and the roll function would just roll all total dice, but it doesn't look like that's the case.

Suggestions?

Best response
You haven't shown us how you're calling roll().
roll( ndice= 6, 6 )
*should* give you the total sum of 6, 6-sided dye being rolled.
In response to Lummox JR
Lummox JR wrote:
You haven't shown us how you're calling roll().

Uh, sorry.

            var/damage = roll(src.dmg_dice) + src.str - M.def
if(damage <= 0)
damage = 0
F_damage(M,damage,"#EF9B84")
else
F_damage(M,damage,"#EF9B84")
M.hp_min -= damage

In response to Lummox JR
Oh I guess, the dice are being used as "1d3", stuff like that.
Uh, no, what I mean is that like, things in the game can add extra damage dice, and they are like, "1d2", "2d6", as bonus damage.

I was hoping I could just add the dice like that to the player's damage dice, but when it is added, it comes out like "1d61d42d6" and just causes a bunch of error.

In response to HartWing
I'm not sure why you wouldn't just do roll(1) + roll(2)?
You're adding strings together, is the problem. "1d6" + "1d4" will always be "1d61d4" which the roll() proc can't make sense of.

roll() is actually rather limited in that even if you added a + between them, it can't understand that format. The only formats roll() can understand are:

sides
"d[sides]"
"[count]d[sides]"
"[count]d[sides]+[bonus]"

The last one can take a - as well.
Understood. In case anyone is wonder, something like "+3" will work.