PDA

Click to See Complete Forum and Search --> : Not sure if this is possible


Randomen
May 1st, 2001, 11:36 PM
I run several forum based RPG's on my board. Many of them are in the style of the old AD&D type of play, rolling dice to determine if your action is successful. What I am looking for is a dice roller for my board. I dont know if it is possible, but here is what I would like it to do.

You enter a particular forum. in this forum is the dice roller. You decide what you want to roll, a 20 sided die, a 10 sided die, or anything in between. you decide how many times you want it to roll that die. You hit roll, and it rolls the die with the paramaeters you have set. Once it is done rolling, it actually posts the rolls in the forum. These posts can not be edited or deleted.

If this is possible, please let me know. I have no programming skill or scripting skill, so I dont know what would need to ne done. if you have any ideas, please contact me at my email, or over ICQ. Thanks.

Randomen
May 3rd, 2001, 12:57 PM
someone should be at least able to say if this is possible or not.

JoshT
May 3rd, 2001, 02:12 PM
I think you could implement it with some kind of random number generation with a server-side script. I wouldn't do it client side as there would be the possibility of users faking dice rolls.

Randomen
May 3rd, 2001, 11:26 PM
ok, how would I go about doing this?

Sastraxi
May 5th, 2001, 10:40 AM
You can take the source from the usermade die roll section to implement it yourself in ASP, I wouldn't mind. I also do die rolling, altough it is only 6-sided.

Here it is, MDICE!!! (part of the MSuite AD&D program set, by Sastraxi)

Sastraxi
May 5th, 2001, 10:58 AM
I can also provide some code:


<%
Function RollDie(A,B)
Dim TempRoll
Dim RollTot
Dim AAA

For AAA = 1 to B
TempRoll = Int(Rnd * A) + 1
If TempRoll > A Then TempRoll = A
RollTot=RollTot+TempRoll
Next AAA

RollDie = RollTot
End Function
%>


To add a database, I can only give you some tips:
Make sure to open it with Optimistic Lock and OpenStatic.
Next use this code to add a new record (make sure to use MDB and 3 fields, "Sided", "HowMany", "Result"...


<%
Function ExtendedRollDie(A,B)
Dim TempRoll
Dim RollTot
Dim AAA

For AAA = 1 to B
TempRoll = Int(Rnd * A) + 1
If TempRoll > A Then TempRoll = A
RollTot=RollTot+TempRoll
Next AAA

ExtendedRollDie = RollTot

'make sure oRec is a valid ADODB.Recordset
oRec.AddNew
oRec("Sided") = A
oRec("HowMany") = B
oRec("Result") = RollTot
End Function
%>


Hope I helped!

Sastraxi
May 5th, 2001, 10:59 AM
whoops!

After oRec("Result") = RollTot, add this line:


oRec.Update