View Full Version : Simple Craps Game
12-03-2009, 05:13 AM
Im looking to make a simple craps game and i need some help on it this is what the final outcome should look like
if you want the code and my site that i have as of right now and you think you can help me a little at a time i'd appreciate it.
12-03-2009, 02:21 PM
It doesn't appear that you've followed the suggestions that you were given in your cross posts on devshed.com and bytes.com and wherever else you've posted this question.
You need to show us your full script and ask specific questions on the part(s) that is giving you trouble. However, keep in mind that we are not going to do your homework for you, but we can give you a little guidance.
12-03-2009, 03:19 PM
Theres my code and here's my site
use CGI ':standard';
use CGI::Carp "fatalsToBrowser";
<form method=post action=craps.pl>
<input type=hidden name=dice1 value=dice1>
<input type=hidden name=dice2 value=dice2>
<input type=hidden name=total1 value=total1>
<input type=hidden name=ctrl value=ctrl>
<input type=submit value='Throw Again'>
<img src=images/1.gif><img src=images/3.gif>
<img src=images/blank.gif><img src=images/blank.gif>
12-03-2009, 05:42 PM
You haven't implemented the suggestions I gave you on devshed.com and you haven't asked a specific question so how can you expect me or anyone else to assist you. We are not going to write your homework script for you.
12-03-2009, 06:23 PM
I want to know how to switch images everytime i hit the submit button so it picks random pictures. My images are called 1.gif 2.gif ect.. to 6.
Once i get that than i can use conditions to say when the two dice add up to 7 or 11 on the first roll then it says i win.
If i roll the number ect... then i lose and if i roll a "point" then the two images below it change and until i match the number i win but if i get a 7 or 11 on the second role i lose.
12-03-2009, 06:49 PM
There are several ways to select a random image.
This should get you started.
12-03-2009, 10:35 PM
doesnt help me too much
12-03-2009, 11:15 PM
doesnt help me too much
That response doesn't tell me what you don't understand, so it's hard for me to help you.
The module I pointed you to has several clear examples on how to select a random image file. From there you just need to use that var in your img tags.
12-04-2009, 01:45 AM
You can't give me an idea what im supposed to do with these images?
Like an example or something? I know you gave me a sight and stuff but i can't relate it to what im doing.
print "<img src=\"dice" . $dice_side . "\.jpg\" \/>\n";
will that work?
better to use print qq( html in here ); instead of having to escape everything with a \.
12-04-2009, 02:03 AM
print qq? never heard of that
where you put your output between the brackets
print qq( <img src='filename' alt='' title='' /> );
12-04-2009, 02:32 AM
So say i have two images on my screen and i hit the submit button and i want those images to go randomly through 6 images because in this case there are six sides to a dice and i have 6 pictures saved.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.