PDA

View Full Version : BBCode DICE


jerudc
04-22-2005, 07:50 PM
I'm adding a DICE block in BBCode Manager to handle dice rolls for a role playing site.

Format is d20+7, outputs 'Roll attack, X' where X equals 1d20+7.

I can't seem to pass parameters from HTML to vbscript. Any idea why?


-------------------------------

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

Marco van Herwaarden
04-22-2005, 07:59 PM
Moved to correct section.

Holidazed
04-29-2005, 07:15 PM
I saw this in place at http://www.dndonlinegames.com/showthread.php?p=555192#post555192 and it works sweet. I don't know how they did it tho. Did you get your problem solved?

jerudc
05-10-2005, 12:23 PM
That is what I'm looking for, but that site has not published their dice rolling mod. But thank you for pointing it out.

Holidazed
10-05-2005, 07:38 PM
Does anybody have an answer making this work in v3.5?