hi, I am trying to make a simple craps game. and would appreciate some help
#index.html#<html> <center> <img src=./pix/submit.jpg> <hr> <form action=/cgi-bin/dice.cgi method=post> <input type=submit value ="roll the dice" > <a href= cgi-bin/dice.cgi> </center> </html>
this next piece I would like to add an animated .gif that simulates the dice rolling then show the numbers if you would like to see them the url is http://s1215.photobucket.com/albums/cc505/troylolson/ all the .gif's are renamed correctly for this script
dice.cgi
#! /usr/bin/perl use CGI ':standard'; print "Content-type:html\n\n"; $dice1= int (rand(6)+1); $dice2= int (rand(6)+1); $rolla = param('rolla'); $rollb = param('rollb'); print "<img src=http://localhost/pix/dice$dice1.gif>"; print "<img src=http://localhost/pix/dice$dice2.gif>"; $total= $dice1+$dice2; print "your first roll was" ; print "<img src=http://localhost/pix/dice$rolla.gif>"; #rollb won't show up# print "<img src=http://localhost/pix/dice$rollb.gif>"; if (($total ==7)or($total ==11)){ print "you win!!!"; exit() } elsif (($total ==2) or ($total ==12)){ print "loser"; exit() } #I believe the problem with rollb is on this line# print "<a href= dice.cgi?rolla=$dice1 & rollb=$dice2>roll again</a>"
I also need to add some kind of counter so it remembers the first roll only. the counter and a few tweaks for the rules I am not worried about as much as a way to swap the animated .gif with the correct die face after the .gif has played through. thank you for your time
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |