Sain Cai
June 7th, 2009, 21:25
I have this as temporary code for my RPG I cam creating. This is for random exploration and fights that occur:
<?php // quests.php controls handling of all advanced quests.
// Copy, paste and change the whole quest function to create more, add rooms what ever.
// THIS STARTS QUEST 1 STONE BUILDING
FUNCTION quest1() {
global $userrow, $numqueries;
if ($userrow["currentaction"] == "Fighting1") { header("Location: index.php?do=fight1"); die(); }
if ($userrow["currentaction"] == "Fighting2") { header("Location: index.php?do=fight2"); die(); }
if ($userrow["currentaction"] == "Fighting3") { header("Location: index.php?do=fight3"); die(); }
if (isset($_POST['building']))
{
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "You have entered into a 20 by 30 room, a fireplace in the North East corner two old rotten chairs with a coffee table between them sit in front of the fireplace.";
$page .= "Theres a larger table with four chairs around it centered in the room, some old wooden plates and bowls sit upon the table.<br />";
$page .= "There are two doors in the right wall witch one do you wish to try.<br /><br />";
$page .= "You check the left door and it is locked, smash open the door and <form action=index.php?do=quest1 method=post><input type=submit value='Enter' name=room1 class=\"button105\"> the room</form><br />";
$page .= "You check the right door and it is unlocked, open the door and <form action=index.php?do=quest1 method=post><input type=submit value='Enter' name=room3 class=\"button105\"> the room</form><br />";
$page .= "<form action=index.php?do=gotown:0 method=post> or <input type=submit value='Return' name=move class=\"button105\"> to the city.</form></td></tr></table>";
display($page, "Stone Building Quest");
}
if (isset($_POST['room1']))
{
$chancetofight = rand(1,3);
if ($chancetofight == 1) {
$action = "currentaction='Fighting1', currentfight='1',";
} else {
$action = "currentaction='Exploring',";
}
$updatequery = doquery("UPDATE {{table}} SET $action latitude='200', longitude='200', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "This is obviously a bedroom with bed, a dresser and a foot locker at the end of the bed and a door to your left.";
$page .= "You open the foot locker first and find some old blankets.<br>You check the door and it is not locked, <br />";
$page .= "<form action=index.php?do=quest1 method=post>You may <input type=submit value='Enter' name=room2 class=\"button105\"> the room</form>";
$page .= "<form action=index.php?do=quest1 method=post>or <input type=submit value='Leave' name=building class=\"button105\"> the room.</form></td></tr></table>";
display($page, "Stone Building Quest"); }
if (isset($_POST['room2']))
{
$chancetofight = rand(1,3);
if ($chancetofight == 1) {
$action = "currentaction='Fighting2', currentfight='1',";
} else {
$action = "currentaction='Exploring',";
}
$updatequery = doquery("UPDATE {{table}} SET $action latitude='200', longitude='200', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "You have walked into a small lab full of test tubes, coils, vials, bottles, pouchs, bags and barrels ";
$page .= "You search around and find nothing of value or of use.<br />";
$page .= "<form action=index.php?do=quest1 method=post><input type=submit value='Leave' name=room1 class=\"button105\"> the room.</form></td></tr></table>";
display($page, "Stone Building Quest"); }
if (isset($_POST['room3']))
{
$chancetofight = rand(1,3);
if ($chancetofight == 1) {
$action = "currentaction='Fighting3', currentfight='1',";
} else {
$action = "currentaction='Exploring',";
}
$updatequery = doquery("UPDATE {{table}} SET $action latitude='200', longitude='200', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "You have walked into a small kitchen, after searching around for awhile you realize there is nothing of value in here";
$page .= "<form action=index.php?do=quest1 method=post><input type=submit value='Leave' name=building class=\"button105\"> the room.</form></td></tr></table>";
display($page, "Stone Building Quest");
}
// THIS ENDS QUEST 1 STONE BUILDING
}
?>
My question is about the map image I have: the castle.gif, roughly 90kb. Would the image use 90KB every time you enter a room? If you go here: http://dragonthrone.namepad.net and use Demo for the username and demo as password you can see what I would mean. Click Castle and you can mneuver around the basic set up of it. The map will always be on top for each room, I just dont know if it uses the bandwidth for every room, even though its coded on the same php page.
I hope this made sense.
<?php // quests.php controls handling of all advanced quests.
// Copy, paste and change the whole quest function to create more, add rooms what ever.
// THIS STARTS QUEST 1 STONE BUILDING
FUNCTION quest1() {
global $userrow, $numqueries;
if ($userrow["currentaction"] == "Fighting1") { header("Location: index.php?do=fight1"); die(); }
if ($userrow["currentaction"] == "Fighting2") { header("Location: index.php?do=fight2"); die(); }
if ($userrow["currentaction"] == "Fighting3") { header("Location: index.php?do=fight3"); die(); }
if (isset($_POST['building']))
{
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "You have entered into a 20 by 30 room, a fireplace in the North East corner two old rotten chairs with a coffee table between them sit in front of the fireplace.";
$page .= "Theres a larger table with four chairs around it centered in the room, some old wooden plates and bowls sit upon the table.<br />";
$page .= "There are two doors in the right wall witch one do you wish to try.<br /><br />";
$page .= "You check the left door and it is locked, smash open the door and <form action=index.php?do=quest1 method=post><input type=submit value='Enter' name=room1 class=\"button105\"> the room</form><br />";
$page .= "You check the right door and it is unlocked, open the door and <form action=index.php?do=quest1 method=post><input type=submit value='Enter' name=room3 class=\"button105\"> the room</form><br />";
$page .= "<form action=index.php?do=gotown:0 method=post> or <input type=submit value='Return' name=move class=\"button105\"> to the city.</form></td></tr></table>";
display($page, "Stone Building Quest");
}
if (isset($_POST['room1']))
{
$chancetofight = rand(1,3);
if ($chancetofight == 1) {
$action = "currentaction='Fighting1', currentfight='1',";
} else {
$action = "currentaction='Exploring',";
}
$updatequery = doquery("UPDATE {{table}} SET $action latitude='200', longitude='200', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "This is obviously a bedroom with bed, a dresser and a foot locker at the end of the bed and a door to your left.";
$page .= "You open the foot locker first and find some old blankets.<br>You check the door and it is not locked, <br />";
$page .= "<form action=index.php?do=quest1 method=post>You may <input type=submit value='Enter' name=room2 class=\"button105\"> the room</form>";
$page .= "<form action=index.php?do=quest1 method=post>or <input type=submit value='Leave' name=building class=\"button105\"> the room.</form></td></tr></table>";
display($page, "Stone Building Quest"); }
if (isset($_POST['room2']))
{
$chancetofight = rand(1,3);
if ($chancetofight == 1) {
$action = "currentaction='Fighting2', currentfight='1',";
} else {
$action = "currentaction='Exploring',";
}
$updatequery = doquery("UPDATE {{table}} SET $action latitude='200', longitude='200', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "You have walked into a small lab full of test tubes, coils, vials, bottles, pouchs, bags and barrels ";
$page .= "You search around and find nothing of value or of use.<br />";
$page .= "<form action=index.php?do=quest1 method=post><input type=submit value='Leave' name=room1 class=\"button105\"> the room.</form></td></tr></table>";
display($page, "Stone Building Quest"); }
if (isset($_POST['room3']))
{
$chancetofight = rand(1,3);
if ($chancetofight == 1) {
$action = "currentaction='Fighting3', currentfight='1',";
} else {
$action = "currentaction='Exploring',";
}
$updatequery = doquery("UPDATE {{table}} SET $action latitude='200', longitude='200', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$page = "<table width=100%><tr><td align=center valign=top><img src=\"images/castle.gif\"></td></tr><tr><td class=title align=center>Stone Building Quest 1<br />";
$page .= "You have walked into a small kitchen, after searching around for awhile you realize there is nothing of value in here";
$page .= "<form action=index.php?do=quest1 method=post><input type=submit value='Leave' name=building class=\"button105\"> the room.</form></td></tr></table>";
display($page, "Stone Building Quest");
}
// THIS ENDS QUEST 1 STONE BUILDING
}
?>
My question is about the map image I have: the castle.gif, roughly 90kb. Would the image use 90KB every time you enter a room? If you go here: http://dragonthrone.namepad.net and use Demo for the username and demo as password you can see what I would mean. Click Castle and you can mneuver around the basic set up of it. The map will always be on top for each room, I just dont know if it uses the bandwidth for every room, even though its coded on the same php page.
I hope this made sense.