Using the text parameter version of roll(example roll("1d6") can cause DS to freeze when using large values for number of sides and number of dice. When using the separate parameter version of roll(example roll(1,6) DS will not freeze and simply return 0 when using large values for number of sides and number of dice.
Code Snippet (if applicable) to Reproduce Problem:
mob/verb/roll_bad()
//Text string version of roll()
//This verb will freeze DS
world << roll("2323232132d56567655")
mob/verb/roll_okay()
//"Expanded" form of roll with separate params for num_sides and num_dice
//This verb will not lock up DS, and will output simply 0
world << roll(2323232132,56567655)
Expected Results:
Both formats of roll to process the input and not cause DS to freeze.
Actual Results:
Text format roll() freezes DS and separate parameter roll() does not freeze DS and returns a value.
Does the problem occur:
Every time? Or how often?
This issue always happens.
When does the problem NOT occur?
The text format of roll() does not freeze DS and returns a value when given smaller values to process. An example would be roll("1d6"). That will not freeze DS and will return a value.
Workarounds:
Taking a string such as "2323232132d56567655" and parsing it so that you can do roll(2323232132,56567655) and not freeze DS. Or use smaller values.
The numerical format returning 0 is occurring because the number of reps is being interpreted as a negative number, again simply because it is so high.