Jump to content

Recommended Posts

Alrighty, I worked on this code for hours yesterday to get this game working. (I'm a newb, it was my first success with something this complicated). My problem is however, getting the result to display as I want it to. I used NVU to make what I wanted the end result to be, but when I pasted the code into the "echo" line it didn't work. Should I change the php game code, or can I code it so that each outcome automatically sends to the corresponding pages I made in nvu? Here's the code for the game:

 

<html>

<body>

 

<title>Random Chance Hat Game</title>

 

<?php

//take their 10 gold.

//if they don't have 10 gold, ignore the next section of code

 

//generate a random number

mt_srand ((double) microtime( )*1000000);

$num = mt_rand (1,200);

 

if ($num==1)

echo " JACKPOT <br><br><img src= 'http://rpgsaga.com/games/jackpot.png'align=center>";

//add the jackpot

 

 

elseif ($num>=2 and $num<=21)

echo "You win 25 gold <br><br><br> <img src= 'http://rpgsaga.com/games/bigwin.png'>";

 

//add 25 gold

 

 

 

elseif ($num>=22 and $num<=82)

echo "You win 15 gold<br><br><br> <img src= 'http://rpgsaga.com/games/mediumwin.png'>";

//add 15 gold

 

 

 

elseif ($num>=83 and $num<=153)

echo "You win 10 gold <br><br><br> <img src= 'http://rpgsaga.com/games/smallwin.png'>";

 

//add 10 gold

 

 

elseif ($num>=154 and $num<=184)

echo "You win only 5 gold back. <br><br><br><img src= 'http://rpgsaga.com/games/blank.png'>";

//add 5 gold

 

 

elseif ($num>=185 and $num<=200)

echo "You lost your entire 10 gold <br><br><br><img src= 'http://rpgsaga.com/games/death.png'>";

 

else

echo "You got nothin!";

 

?>

 

 

 

</body>

</html>

 

Here's the code for what I want the "jackpot" to look like:

 

<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">

  <title>10gold</title>

</head>

<body>

<div style="text-align: center;"><big><big><big><big>Small win<br>

<small><small>You win 10 gold!<br >

< br>

<b r>

<br >

<br >

<br >

<br >

<br >

<br >

<br >

Again?</small></small></big></big></big></big></div>

<img style="width: 190px; height: 192px; position: absolute; top: 120px; left: 278px;" alt="10gold" src="http://rpgsaga.com/games/jackpot.png">

 

 

Link to comment
https://forums.phpfreaks.com/topic/66014-solved-how-should-i-display-images/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.