The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
BBCode DICE
I'm adding a DICE block in BBCode Manager to handle dice rolls for a role playing site.
Format is [dice="attack"]d20+7[/dice], outputs 'Roll attack, X' where X equals 1d20+7. I can't seem to pass parameters from HTML to vbscript. Any idea why? ------------------------------- Code:
<html> <head> <script type="text/vbscript"> function rolldice(by Val inDice) 'Init Variables Dim numDice, typeDice, bonusDice, rollDice Dim tmpDice, diceRoll 'Parse dice string numDice = mid(inDice, 1, (len(InDice)-inStr(inDice,"d"))) typeDice = mid(inDice, inStr(inDice, "d"), (inStr(inDice,"+")-inStr(inDice,"d")) bonusDice = mid(inDice, inStr(inDice, "+"), (len(InDice)-inStr(inDice,"+"))) Randomize 'Roll the die For i = 1 to numDice tmpDice = Int((typeDice * Rnd) + 1) diceRoll = diceRoll + tmpDice Next 'Give the function a value to return rollDice = diceRoll + bonusDice end function </script> </head> <body> var_Option = {option} var_Param = {param} <script type="text/vbscript"> document.write(Roll " var_Option ", " rolldice(var_Param)) </script> </body> </html> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|