#17211 - 05/04/08 08:35 AM
Turns based exploring - Not working
|
gamefreak888
Rice Krispies
Registered: 09/06/07
Posts: 215
|
Offline
|
|
Mod can be found here
It is not working. I've followed all the instructions (I'm not using the New Improved Compass mod) and I'm sure there's nothing wrong with my version/computer/internet connection or whatever.
When I first installed it, I couldn't explore the world anymore. When I pressed North, for example, I received an error: "You are already in this town". This happened always. However, when I changed this script from the mod:
if (isset($_GET["north"])) { $latitude++; $taketurn = 1; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; $taketurn = 0; } }
if (isset($_GET["south"])) { $latitude--; $taketurn = 1; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); $taketurn = 0; } }
if (isset($_GET["east"])) { $longitude++; $taketurn = 1; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; $taketurn = 0; } }
if (isset($_GET["west"])) { $longitude--; $taketurn = 1; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); $taketurn = 0; } }
into...
if (isset($_POST["north"])) { $latitude++; $taketurn = 1; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; $taketurn = 0; } }
if (isset($_POST["south"])) { $latitude--; $taketurn = 1; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); $taketurn = 0; } }
if (isset($_POST["east"])) { $longitude++; $taketurn = 1; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; $taketurn = 0; } }
if (isset($_POST["west"])) { $longitude--; $taketurn = 1; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); $taketurn = 0; } }
... the problem was solved.
I then tested the script by setting the number of turns for myself into '5'. So I went exploring but nothing happened. I didn't get a message like "You haven't got any turns left". Then I checked the scripts included in the mod and I saw that there wasn't any text like that.
What did happen was that as a sudden point my current location became 'frozen' at 4 North 10 East, but I could still explore. The current location variables did not changed but I could still move around the world.
And why isn't there something included in this mod in the leftnav or rightnav that tells the player how many turns he's got left?
Does anyone knows how to get this mod working?
|
|
Top
|
|
|
#17213 - 05/04/08 11:14 AM
Re: Turns based exploring - Not working
[Re: Fayt]
|
gamefreak888
Rice Krispies
Registered: 09/06/07
Posts: 215
|
Offline
|
|
Thanks.
Well some people will piss off but some others will like it. You can't just play forever, so that makes people enjoy the game more, and perhaps even in a way that they use all their turns every day. And you can make a pay system with something like a VIP account, which gets you more turns.
|
|
Top
|
|
|
#17220 - 05/06/08 04:43 AM
Re: Turns based exploring - Not working
[Re: Fayt]
|
gamefreak888
Rice Krispies
Registered: 09/06/07
Posts: 215
|
Offline
|
|
It's not working.
In explore.php I changed this line:
$updatequery = doquery("UPDATE {{table}} SET $action latitude='$latitude', longitude='$longitude', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
header("Location: index.php");
into...
$updatequery = doquery("UPDATE {{table}} SET $action latitude='$latitude', turns=turns-1, longitude='$longitude', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
header("Location: index.php");
And in index.php I added:
if ($userrow["turns" == "0") {
display("<p>Sorry but you ran out of turns. Please return to town <a href=\"index.php?do=gotown:1\">here</a>.", "Error");
}
after
function doexplore() { // Just spit out a blank exploring page.
// Exploring without a GET string is normally when they first log in, or when they've just finished fighting.
$page = <<<END
<table width="100%">
<tr><td class="title"><img src="images/title_exploring.gif" alt="Exploring" /></td></tr>
<tr><td>
Je verkent de wereld en er is niets bijzonders gebeurt.
</td></tr>
</table>
END;
But when I go to index.php I get a blank page. Same thing when I add the if function before this standard explore text or after the return $page; line (which is wrong, but I just tried it).
I also tried to put this code after function doexplore() { : global $userrow;
But still no result.
Edited by basleijser (05/06/08 04:45 AM)
|
|
Top
|
|
|
#17224 - 05/07/08 01:59 AM
Re: Turns based exploring - Not working
[Re: Fayt]
|
gamefreak888
Rice Krispies
Registered: 09/06/07
Posts: 215
|
Offline
|
|
No blank page this time but I don't see the message that I don't have any turns left. But I'll try to mess a bit with the script to get it working...
|
|
Top
|
|
|
#17226 - 05/07/08 10:55 AM
Re: Turns based exploring - Not working
[Re: Fayt]
|
gamefreak888
Rice Krispies
Registered: 09/06/07
Posts: 215
|
Offline
|
|
I put this code before $page = <<<END: in index.php
if($userrow["turns"] == "0") {
display("<p>Sorry but you ran out of turns. Please return to town <a href=\"index.php?do=gotown:1\">here</a>.", "Error");
}
So the whole function looks like this:
function doexplore() { // Just spit out a blank exploring page.
global $userrow, $controlrow, $numqueries;
// Exploring without a GET string is normally when they first log in, or when they've just finished fighting.
if($userrow["turns"] == "0") {
display("<p>Sorry but you ran out of turns. Please return to town <a href=\"index.php?do=gotown:1\">here</a>.", "Error");
}
$page = <<<END
<table width="100%">
<tr><td class="title"><img src="images/title_exploring.gif" alt="Exploring" /></td></tr>
<tr><td>
You're exploring the world but nothing strange happens.
</td></tr>
</table>
END;
return $page;
}
and in explore.php:
$updatequery = doquery("UPDATE {{table}} SET $action latitude='$latitude', turns=turns-1, longitude='$longitude', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
And I've got a 'turns' field in my users table with a default of 50.
Edited by basleijser (05/07/08 10:56 AM)
|
|
Top
|
|
|
#17233 - 05/08/08 08:07 AM
Re: Turns based exploring - Not working
[Re: Fayt]
|
gamefreak888
Rice Krispies
Registered: 09/06/07
Posts: 215
|
Offline
|
|
Like this:
function doexplore() { // Just spit out a blank exploring page.
global $userrow, $controlrow, $numqueries;
// Exploring without a GET string is normally when they first log in, or when they've just finished fighting.
if($userrow["turns"] == "0") {
display("<p>Sorry but you ran out of turns. Please return to town <a href=\"index.php?do=gotown:1\">here</a>.", "Error");
} else {
$page .= "You're exploring the world, but nothing happens."; }
return $page;
}
Ok I'll try it out now.
|
|
Top
|
|
|
#17237 - 05/08/08 10:41 PM
Re: Turns based exploring - Not working
[Re: Fayt]
|
AnmanIndustries
Cookie Crisp
   
Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth
|
Offline
|
|
If its in template form dont put slashes next to quotes in text. If its in regular code you will need them.
|
|
Top
|
|
|
|
|