Needs review
Project:
Dice Roller
Version:
7.x-1.10
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Apr 2019 at 05:47 UTC
Updated:
9 Apr 2019 at 05:47 UTC
Jump to comment: Most recent
The module includes code for calculating _dice_roller_required_addition after a takehighest or takelowest roll, however, since the command_parameters never get set, this never occurs. If you want to do something like 3d6.takehighest(1)+1, the following code may be inserted into the module at line 144 (just before "// Ok, let's do this.")
$plus_pos = strpos($this_command, '+');
$minus_pos = strpos($this_command, '-');
if ($plus_pos || $minus_pos) {
$plus = strpos($this_command, '+');
$minus = strpos($this_command, '-');
if ($plus || $minus) {
$this_command = str_replace('+', '|+', $this_command);
$this_command = str_replace('-', '|-', $this_command);
$split2 = explode('|', $this_command);
$this_command = array_shift($split2);
$total = 0;
foreach ($split2 as $this_split) {
if (is_numeric($this_split)) {
$total = $total + $this_split;
}
}
if ($total != 0) {
$command_set['dice_roller_addition'] = array($total);
}
}
}
Comments
Comment #2
As If commented