The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
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>
|
|
#2
|
|||
|
|||
|
Moved to correct section.
|
|
#3
|
||||
|
||||
|
I saw this in place at http://www.dndonlinegames.com/showth...192#post555192 and it works sweet. I don't know how they did it tho. Did you get your problem solved?
|
|
#4
|
|||
|
|||
|
That is what I'm looking for, but that site has not published their dice rolling mod. But thank you for pointing it out.
|
|
#5
|
||||
|
||||
|
Does anybody have an answer making this work in v3.5?
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|