Log in

View Full Version : BBCode Issue


jerudc
05-10-2005, 12:07 PM
Can anyone tell me why this BBCode will not work? It's not passing parameters to the vbscript. (sub-Question: Is vbscript supported?)

BBCode Example: d20+13

Desired HTML Output: Roll Climb Check 22

*****************
<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>
*****************