TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 22, 2024, 10:30:10 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,197
  • Total Topics: 21,221
  • Online today: 121
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 143
  • Total: 143

Simple Dice Roller block

Started by pjr, March 15, 2006, 02:34:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

akulion

well well lookie here found another one....

Its a flash dice roller game

Screenshot


download it here

i hope u know how to embed flash files properly

if not then ask down at kirupa.com

URPG

I'd like one that can be configured a bit more...
Type of Dice and Number of dice (maybe even different dice at once)
Add dice/substract dice or take each dice as single result
Check Result(s) against target number (above or below)

That should be able to deal with almost any Game in existance that uses dice.

Maybe calculator style? You select dice / number of them, then you can click * or / or + or - and add another dice/number of dice item, click again.... until you hit = and a re-roll button that does the last input again?

pjr

I actually have added a second die roller to my site one that works with the White wolf rule system. You can see it at www.ourplacetoplay.com

URPG

Jup, i've seen it, it's a step towards what would be universal...

Will try to look into it in the middle of next week when i got more time, maybe i can copy+paste somethign together...

Syndel

Any codes to roll and have results between 1-300?

URPG

I had the time to do something as universal as possible... want to have a look at the syntax, then I will post it here...

Syndel

I have manouvered to find a very simple java script for the dice I needed:

Quote<script LANGUAGE="JavaScript"><!-- Begin
var die = 6;
var dice = 3;
function dice_roll(die, dice) {
var roll = 0;
for (loop=0; loop < dice; loop++) {
// random number fix by George Johnston (cali_scripter@yahoo.com)
roll = roll + Math.round(Math.random() * die) % die + 1;
}
document.form.text.value = roll;
}
// End -->
</script>
<!-- STEP TWO: Add the last coding into the BODY of your HTML document  --></p>
<center>
<form name="form">
  <table border="2" cellpadding="5" height="147">
    <tr>
      <td height="49" align="center">What dice type?</td>
      <td height="49" align="center">How many dice to roll?</td>
    </tr>
    <tr>
      <td height="49" align="center">
      <input type="radio" name="sides" onclick="die = 300">300 Sided </td>
      <td height="49" align="center">
      <input type="radio" name="number" onclick="dice = 1">1 </td>
    </tr>
    <tr>
      <td colspan="2" height="49">
      <p align="center">
      <input type="button" value="Roll Dice" name="button" onclick="dice_roll(die, dice)">
      <input type="text" size="10" name="text"> </td>
    </tr>
  </table>
</form>
</center>
<p></p>

But I am interested, yes! :)

alecoddly

#17
sorry but how to you add a java block, cant see it as an option ?

worked it out  :-X

how did you get the separate numbers to output on your ww die roller pjr?

URPG

#18
Here is a copy+paste of a project that died because the programming guy was not ... interested enough. It's an attemp to make a universal dice roller, not only for boards but for character generators, etc. once it would be done it could be used anywhere and - as i am sure - do anything that you can do with real dice... besides building a stack of them  :uglystupid2:

It's basically 3 parts:


  • Reading and interpreting the input string
  • doing all the random numbers of the dice and executing the commands
  • output in a string that can further be modified by whatever send the request




Because it's stupid to have a different dice module for every application and every game system and every plattform i'd like to try and unify a dice rolling syntax working for most, if not all dice based systems. Here are my thoughts:




Goal:
Universal, short and easy to use Snytax that can be used to formulate any dice roll needed without special commands for each kind of roll. There are bots out there that use another command for each roll - that's unnessecary and starts to make a universal bot bloated and complicated to use! It's also stupid to re-programm a dice bot for every application and computer plattform...
This idea should finally lead to a dice rolling module with an input and output syntax that can be used by any application on any plattform: PHP or Java based Chat for online Sessions, character generators of all kind, rolling dice in a bulletin board if playing in a board...

Input Syntax:
(a)d(b) [A(c)] [O(+/-/0)] [S] [E(+/- and d)] [M(+/- and e)] [K(+/- and f)] [I] X(g) B

a = # of Dice
b = sides of dice (1-b)
A(c) = If parameter A is existant every dice is adjusted by c
O = if there is an O it's open rolls +: maximal rolls are rerolled and added or -: minimal rolls are rerolled and substracted 0: both of the above...
S = if there is an S all dice are summed up
E = if there is an E each dice (or if there is an S existant the end result) is compared to d. the + or - indicates if the dice has to be over or under d to be successful.
M = the same as E but for numbers that indicate a failure to be counted after comparing to e.
K = Indicates critical numbers + for critical or automatical success or - for critical or automatic failure.
I = if I is existant any dice showing the same number(s) as I is ignored and rerolled
X(f) = if there is an X each dice, each success (if there is an E specified) or the total sum (if there is an S) is multiplied with f.
B = a simpel string as description of the action intended to be simulated with the roll, is output unchanged together with the result.

In addition to those parameters the module should be able to understand the 4 basic caclulation signs.

Output Syntax:
Name of the one rolling + description of the full roll depending on the parameters + number each dice showed + total outcome + description inputted under B.


Examples:
5d6
Yazee (or whatever dice game variant) player rolls 5 dice and does look what he does get.

d100 K+01+11+22+33+44+55+66-77-88-99-100 E-70
Space Gothic Player tries to roll 1d100 trying to stay under his skill of 70 and checking if he got any doubles (criticals in SG)

8d6 O E+9
Shadowrunner (1-3rd Ed.) rolls 8 dice skill checking if he got any 9 or above that would count as success (re-rolling on a 6).

3d6 S K-17-18 E-14
Gurps Player rolls 3d6 that are added together. he is successful if the sum stays below his skill of 14 and a roll of 17 or 18 indicates critical failure.

3dd6 X10
Warhammer FRP player rolls 3d6 *100 for starting cash.

6d10 A-3 K-1+10 E5 X5
URPG player rolls 6w10, each -3 and compares to the TIT of 5. Each dice that is a success does count as 5 points.  A roll of 1 does indicate automatic failure and a roll of 10 automatic success for the roll.

8d10 E8 M1
The oWoD Player rolls 8d against a success number of 8, each 1 is counted as failure.

(3w6 S I-5) *6
The D&D player does roll 3d6 (ignoring any total that is 5 or less) a total of 6 times to generate stats for a new Char.

d20 E-12 and d10 E-14 and d20 E-12
The DSA player rolls his 3d20, each ahs to be under a certan number to be successful.

(d20 O) + (d10 O) + (d4 O) E+16 M3
The EarthDawn player rolls his d20+d10+d4 (each open rolls) to see if he can reach the target number of 16 (with critical failure on a 3).

Probleme:
The dice themself should be no problem at all (random number of  von 1-size of dice), E is just a query if the result is dice size and a reroll. M and S and I are similar easy operators. A real problem could be caused by the Pharser needed to understand complext calculations like 5d6 + 1d4 O -3.
Another difficulty is that we need good random numbers...

Realisation:
I'd sugest java or PHP so it can be used on- or offline and on most plattforms?