Browser MMO Video #20
- RogueTomboy
- Posts: 61
- Joined: Sun May 22, 2011 3:42 pm
Re: Video #20
That's fine but it still does what my original problem was.
http://www.otenba-files.com/images/error.jpg
http://www.otenba-files.com/images/error.jpg
Need art? Commissions are always open!
http://www.ladytankstudios.com
Currently addicted to:

Collect & Explore for pets
http://www.ladytankstudios.com
Currently addicted to:

Collect & Explore for pets
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video #20
isnt that what it is suppose to do. Ugh had family issues today so been drinking whiskey so may not be all here but this is the code you have and that is what I see being printed out.
Code: Select all
if(isset($_GET['map']))
{
$bypass=1;
echo "<a href='index.php?mapchange=1&mapname=Crocania'>Crocania</a><br>";
echo "<a href='index.php?mapchange=1&mapname=Fordale Woods'>Fordale Woods</a><br>";
echo "<a href='index.php?mapchange=1&mapname=Mintus Mountains'>Mintus Mountains</a><br>";
}
- RogueTomboy
- Posts: 61
- Joined: Sun May 22, 2011 3:42 pm
Re: Video #20
Sorry you had a bad day 
In your video for this it doesn't look like my image when you travel to other places - it doesn't double up with where you can pick to go AND the area your in with all the areas options. It's supposed to ONLY show where you can travel.

In your video for this it doesn't look like my image when you travel to other places - it doesn't double up with where you can pick to go AND the area your in with all the areas options. It's supposed to ONLY show where you can travel.
Need art? Commissions are always open!
http://www.ladytankstudios.com
Currently addicted to:

Collect & Explore for pets
http://www.ladytankstudios.com
Currently addicted to:

Collect & Explore for pets
Re: Video #20
If I understand the prob right and the code right, this part should have if($bypass == 0) PS: Note the double ==, not single...php likes to torture us that way...
Already added the change in the code sample below
and here add in $bypass=0;
Again made change in code sample below already
Basically the locations options should NOT show if you've chosen the map, or you have finished traveling and are showing that text. If I understand the intent of the code right. The bypass above should do that.
AIM: I looked over your code but can't see anything. Perhaps if you could take some screenshots of a battle happening and the error, then attach them to a post here? From your description it's a bit hard to tell how early the error is occuring.
Already added the change in the code sample below
Code: Select all
if($bypass == 0)
{
echo "<b><big><u>" . $playerinfo3['location'] . "</u></big></b><br>";
echo "<a href='store.php'>Visit Store</a><br>";
echo "<a href='weaponshop.php'>Visit Weapon Shop</a><br>";
echo "<a href='armorshop.php'>Visit Armor Shop</a><br>";
echo "<a href='inn.php'>Visit Inn</a><br>";
echo "<a href='spelltrainer.php'>Visit Spell Trainer</a><br>";
echo "<a href='battle.php'>Battle in Arena</a><br>";
echo "<a href='index.php?map=1'>Go to Map</a><br>";
}
Again made change in code sample below already
Code: Select all
<?php
$bypass=0;
$playerhp = $playerinfo3['hpoints'];
AIM: I looked over your code but can't see anything. Perhaps if you could take some screenshots of a battle happening and the error, then attach them to a post here? From your description it's a bit hard to tell how early the error is occuring.
Fight Cycle : My latest Browser game WIP
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
- RogueTomboy
- Posts: 61
- Joined: Sun May 22, 2011 3:42 pm
Re: Video #20
Thanks Callan S.!
Works like a charm now XD
Works like a charm now XD
Need art? Commissions are always open!
http://www.ladytankstudios.com
Currently addicted to:

Collect & Explore for pets
http://www.ladytankstudios.com
Currently addicted to:

Collect & Explore for pets
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video #20
ah, thanks for spotting that callan. Guess I had too much whiskey 

Re: Video #20
Yeah, need to share it with the rest of us! 
Nah, NP, just trying to give a bit back, is all!

Nah, NP, just trying to give a bit back, is all!
-
- Posts: 165
- Joined: Tue Oct 13, 2009 4:22 pm
Re: Video #20
Hey, noone of my shops are working correctly, weaponshop and armor shop. I dont why but the weapon shops dost work, its telling me the wrong prices and and a level 1 shop is selling level 40 items and the sae with armor shop, i dont know what scripts you will need but here is weaponshop.php and armorshop.php: I just finished video 20, if you need other scriptss let me know
weaponshop.php
armorshop.php
Reply as soon as possible ASAP
weaponshop.php
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
$bypass = 0;
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
$pllocation=$playerinfo3['location'];
$inninfo="SELECT * from locations where location='$pllocation' AND type='weaponshop'";
$inninfo2=mysql_query($inninfo) or die("could not get player stats!");
$inninfo3=mysql_fetch_array($inninfo2);
$shoplevel = $inninfo3['level'];
if (isset($_GET['bought']))
{
$bypass = 1;
$id=$_GET['id'];
$playerid = $playerinfo3['id'];
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
$iteminfo="SELECT * from weapons where id='$id'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
if ($playerinfo3['gold'] < $iteminfo3['price'])
{
echo "You do not have enough Gold for this purchase!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['pclass'] != $iteminfo3['class'] && $iteminfo3['class'] != "any")
{
echo "You are not the right class for this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['level'] < $iteminfo3['level'])
{
echo "You are not high enough level to use this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
$name = $iteminfo3['name'];
$rating = $iteminfo3['rating'];
$wlevel = $iteminfo3['level'];
$hittext = $iteminfo3['hittext'];
$damage = $iteminfo3['damage'];
$randid = rand(1000,999999999);
$percentage = $iteminfo3['price'] / 100;
$price = $iteminfo3['price'] * $percentage;
$newprice = $price + $iteminfo3['price'];
$newprice = (int)$newprice;
$itembought = "INSERT into playerweapons(pid, name, rating, level, randid,price,class,hittext,damage) VALUES ('$playerid','$name','$rating','$wlevel','$randid','$newprice','$class','$hittext','$damage')";
mysql_query($itembought) or die("could not insert weapon into backpack");
$updateplayer="update players set gold=gold-'$newprice' where name='$player'";
mysql_query($updateplayer) or die("Could not update player");
echo $name . " Purchased<br>";
echo $inninfo3['exitgreet'] . "<br>";
echo "<a href='index.php'>Go Back</center>";
}
if ($bypass != 1)
{
$counter = 0;
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
echo "<center>" . $inninfo3['greeting'] . "<br>";
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from weapons where class = '$class' AND level <= '$level' AND level <= '$shoplevel' || class='any'";
$invinfo2=mysql_query($invinfo) or die("could not select anything from the store.");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Rating<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
$counter = 1;
$percentage = $inninfo3['price'] / 100;
$price = $invinfo3['price'] * $percentage;
$newprice = $price + $invinfo3['price'];
$newprice = (int)$newprice;
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[rating]</td><td>$newprice</td><td><A href='weaponshop.php?id=$invinfo3[id]&bought=1'>Buy Weapon</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There is nothing in the store at this time.<br>";
echo "<a href='index.php'>Go Back</center>";
exit;
}
echo "<center><a href='index.php'>NeverMind</center></a>";
}
?>
</div>
armorshop.php
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
$bypass = 0;
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
$counter = 0;
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
$pllocation=$playerinfo3['location'];
$inninfo="SELECT * from locations where location='$pllocation' AND type='armorshop'";
$inninfo2=mysql_query($inninfo) or die("could not get player stats!");
$inninfo3=mysql_fetch_array($inninfo2);
$shoplevel = $inninfo3['level'];
if (isset($_GET['bought']))
{
$bypass = 1;
$id=$_GET['id'];
$playerid = $playerinfo3['id'];
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
$iteminfo="SELECT * from armor where id='$id'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
if ($playerinfo3['gold'] < $iteminfo3['price'])
{
echo "You do not have enough Gold for this purchase!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['pclass'] != $iteminfo3['class'] && $iteminfo3['class'] != "any")
{
echo "You are not the right class for this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['level'] < $iteminfo3['level'])
{
echo "You are not high enough level to use this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
$name = $iteminfo3['name'];
$rating = $iteminfo3['rating'];
$wlevel = $iteminfo3['level'];
$location = $iteminfo3['location'];
$randid = rand(1000,999999999);
$percentage = $iteminfo3['price'] / 100;
$price = $iteminfo3['price'] * $percentage;
$newprice = $price + $iteminfo3['price'];
$newprice = (int)$newprice;
$itembought = "INSERT into playerarmor(pid, name, rating, level, randid,price,class,location) VALUES ('$playerid','$name','$rating','$wlevel','$randid','$newprice','$class','$location')";
mysql_query($itembought) or die("could not insert weapon into backpack");
$updateplayer="update players set gold=gold-'$newprice' where name='$player'";
mysql_query($updateplayer) or die("Could not update player");
echo $name . " Purchased";
echo $inninfo3['exitgreet'] . "<br>";
echo "<a href='index.php'>Go Back</center>";
}
if ($bypass != 1)
{
echo "<center>" . $inninfo3['greeting'] . "<br>";
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from armor where class = '$class' AND level <= '$level' AND level <= '$shoplevel' || class='any'";
$invinfo2=mysql_query($invinfo) or die("could not select anything from the store.");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Rating<font color='ffffff'>______</td><td>Location<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
$counter = 1;
/////////////////////new for video 18//////////////////////
$percentage = $inninfo3['price'] / 100;
$price = $invinfo3['price'] * $percentage;
$newprice = $price + $invinfo3['price'];
$newprice = (int)$newprice;
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[rating]</td><td>$invinfo3[location]</td><td>$newprice</td><td><A href='armorshop.php?id=$invinfo3[id]&bought=1'>Buy Armor</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There is nothing in the store at this time.<br>";
echo "<a href='index.php'>Go Back</center>";
exit;
}
echo "<center><a href='index.php'>NeverMind</center></a>";
}
?>
</div>
Im dumb;)
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video #20
try this
change to
Code: Select all
$invinfo="SELECT * from weapons where class = '$class' AND level <= '$level' AND level <= '$shoplevel' || class='any'";
change to
Code: Select all
$invinfo="SELECT * from weapons where level <= '$level' AND level <= '$shoplevel' AND (class = '$class' || class='any')";