The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Still waiting: DICE HACK
There have been requests made for this one, but no brave coder has taken up the call.
There is a dice hack available for 3.5 but it is far too limited. I, along with some other people, were hoping for a dice hack that could roll up to (perhaps beyond) a 20-sided die. For example: [DICE]2d20[/DICE] ------> Two 20-sided dice (e.g. first die = 16; second die = 12) [DICE]4d6[/DICE] -------> Four 6-sided dice (e.g., first die = 2; second die = 1; third die = 6; fourth die = 4) This would be an excellent tool for games and for contests (random drawings, etc.) If conditions need to be made, I'm willing to hear them out (PM me). Come on, let's get this thing going --- there's a demand for it. ************************************************** ******* Here's the dice code portion of the functions_bbcodeparse file that was originally in my Vbulletin 3.0.3, now no longer working for 3.5.4. Someone should be able to convert this into 3.5.4 format Code:
// [DICE] $bbcodes['custom']['find']['[dice]'] = '#\[dice\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/dice\]#esiU'; $bbcodes['custom']['replace']['[dice]'] = "handle_bbcode_dice('\\2')"; $bbcodes['custom']['recurse']['dice'][0] = array('handler' => 'handle_bbcode_dice'); // fastjack function handle_bbcode_dice($msg){ global $_SERVER; $d = explode(" ",$msg); foreach($d as $e){ $r .= "<b>Request</b>: $e<br>"; $r .= "<b>Result</b>: "; $e = strtolower($e); $e = trim($e); $e = str_replace("(","",$e); $e = str_replace(")","",$e); $e = str_replace("[","",$e); $e = str_replace("]","",$e); $e = str_replace("/","",$e); $e = str_replace("*","",$e); $e = explode("d",$e); unset($add); if(strpos($e[1],'+') !== false ){ list($e[1], $e[2]) = explode("+",$e[1]); $add = 1; } if(strpos($e[1],'-') !== false ){ list($e[1], $e[2]) = explode("-",$e[1]); $add = 2; } $f = 0; unset($error); if($e[1] != 2 && $e[1] != 3 && $e[1] != 4 && $e[1] != 6 && $e[1] != 8 && $e[1] != 10 && $e[1] != 12 && $e[1] != 20 && $e[1] != 100 && $e[1] != 1000 ){ $r .= "You may only roll a 2, 4, 6, 8, 10, 12, 20, 100, or 1000-sided die. Please roll again"; $e[1] = 100; $error = 1; } if(($e[0] > 100 || strlen($e[0]) > 3) && $error != 1){ $r .= "We just support 100 dices each time. "; $e[0] = 1; $error =1; } if($add && (!is_numeric($e[2]) || $e[2] > 1000)){ $r .= "You can just add or subtract numbers smaller than 1000."; $e[2] = 1; $error =1; } unset($g); if($error !=1){ while($f != $e[0]){ $g[] = rand(1,$e[1]); $r .= $g[$f].". "; $f++; } $r .= "<b>Total</b>: ".array_sum($g); if($add == 1){ $t = (array_sum($g) + $e[2]); $r .= "+ ".$e[2]." = $t"; } if($add == 2){ $t = array_sum($g) - $e[2]; $r .= "- ".$e[2]." = $t"; } } $r .="<br>"; } // $msg = $m[0].strstr($msg,'[/dice]'); // $msg = str_replace('[/dice]','',$msg); $result[] = $msg; $result[] = $r; if($_SERVER['SCRIPT_NAME'] == "/forum/newreply.php") $r = "You cant have dice Preview"; if($_SERVER['SCRIPT_NAME'] == "/forum/newthread.php") $r = "You cant have dice preview"; $return = '<br><div class="smallfont" style="margin-bottom:2px"><img src=dice.gif> Diceroll:</div> <table cellpadding="2" cellspacing="0" border="0"> <tr> <td class="alt2" style="border:1px inset"> <div style="font-style:italic">'.$r.'</div> </td> </tr> </table><br>'; return $return; |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|