krappleby025
Programmer
HI guys,
im having a bit of a problem with a function to roll a die..
here is the code i have created
********************
function Roll_Dice($die)
{
$die_roll = rand(1,$die);
return $die_roll;
}
#### testing function
$num_rolls = "0";
$die_rolls = "0";
while ($num_rolls <> "6")
{
while ($die_rolls <> "3")
{
Roll_Dice("6");
$roll . $die_rolls = $die_roll;
$die_rolls = $die_rolls + 1;
}
$num_rolls = $num_rolls + 1;
echo "Roll " . $num_rolls . " = " . $roll1 . " + " . $roll2 . " + " . $roll3 . " = " . $roll1+$roll2+$roll3 . "<br>";
}
*************
if any of you know about RPG you will understand what i am trying to do.. Create 6 rolls containing 3 dice each..
however. for some reason the function is not returning a valid number.. when running the script.. all i get is
exceeded 30 seconds..
if i remove most of the info to just leave the main programming i get a 0 only..
appreciate your help
im having a bit of a problem with a function to roll a die..
here is the code i have created
********************
function Roll_Dice($die)
{
$die_roll = rand(1,$die);
return $die_roll;
}
#### testing function
$num_rolls = "0";
$die_rolls = "0";
while ($num_rolls <> "6")
{
while ($die_rolls <> "3")
{
Roll_Dice("6");
$roll . $die_rolls = $die_roll;
$die_rolls = $die_rolls + 1;
}
$num_rolls = $num_rolls + 1;
echo "Roll " . $num_rolls . " = " . $roll1 . " + " . $roll2 . " + " . $roll3 . " = " . $roll1+$roll2+$roll3 . "<br>";
}
*************
if any of you know about RPG you will understand what i am trying to do.. Create 6 rolls containing 3 dice each..
however. for some reason the function is not returning a valid number.. when running the script.. all i get is
exceeded 30 seconds..
if i remove most of the info to just leave the main programming i get a 0 only..
appreciate your help