Firstly, hi there. Sorry to register just to ask a question, but I seem to have run out of resources for solving this problem. I'd appreciate any help you guys can offer.
Yesterday I started writing a script to generate random information which I could use to create NPCs for my Dungeons and Dragons games. I decided that if I was going to be unattractive to women, I may as well not hold back, ya know?
Anyway, I've never actually coded in PHP before, so this has been a bit of a struggle. But things are coming along at a decent pace. I've managed to complete all but one of the tasks I set out to complete in version 2 of the script.
I want the user to be able to "re-roll" one of the variables if they don't like the result, or if the result is incompatible with one of the other results. But I've been trying to solve this problem off and on for the last six hours or so, without any significant breakthroughs.
Here's the page in its present incarnation:
http://www.linkskywalker.com/PHP_STUFF/Random_Character_Info/Phase2/
And here's the basic structure of each of the items:
<?php
//BEGIN RANDOM ALIGNMENT
function align_rand($align){
$g = $align[mt_rand(1, 3)];
$l = $align[mt_rand(4, 6)];
if($g=="Neutral" && $l=="Neutral"){
$ment = "True Neutral";
}
else{
$ment = $g." ".$l;
}
return $ment;
}
//END RANDOM ALIGNMENT
?>
<br /><br /><b>Alignment is: </b>
<?php echo align_rand($align); ?>
If possible I'd like for the "re-roll" button to take the form of a hyperlink rather than a button, but whatever gets the job done at this point is fine with me.
Again, any help would be greatly appreciated. Thank you in advance, and I eagerly await your response.