I've not tested it, but I believe that this should work for your first query:
Find
function Post()
Add before:
function roll($rolls,$bm)
{
$successes=0;
$temp = 'Results = ';
if (rolls>40) {return 'Sorry, too many rolls!';}
if ($rolls>1)
{
for ($i=0; $i<($rolls-1); $i++)
{
$result=rand(1,10);
$temp.=$result.', ';
if ($result>=$bm) $successes=$successes+1;
}
}
$result=rand(1,10);
$temp.=$result;
if ($result>=$bm) $successes=$successes+1;
return 'Rolling '.$rolls.'d10<br><div style="background-color: #919191;">'.$temp.'<br>'.'<b>Successes at or over ',$bm,' = '.$successes.'</b></div>';
}
In post.php, find:
preparsecode($_POST['message']);
Add after:
$_POST['message'] = preg_replace('~:roll (\d+),(\d+):~ei', "roll('\$1','\$2')", $_POST['message']);
To use this roller to get successes for x amount of rolls against a success benchmark of y, enter:
:roll x,y:
ie, to roll 4 dice and count a 7 or above as successes enter:
:roll 4,7:
And with regards to your second query, I don't think that it is possible for the roller to return successes less than 0... If I'm wrong and you've encountered such an occurance then let me know and I'll include code for that eventuality as well.