se7enet purgatorio

Page 1 of 2 12>
Topic Options
Rate This Topic
#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:
 Code:
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...

 Code:
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
#17212 - 05/04/08 09:01 AM Re: Turns based exploring - Not working [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
#1. At least half of the mods in the mod index do not work. I don't recommend using them.

#2. The easiest way to set turns is to go into the database, put this in >

turns smallint 3 not null default 50

That will give you 50 turns, set the default to whatever you want.

Then go to your explore script and put an update query to minus one turn so that every time they take a step, it will minus. Like
$query ("UPDATE SET turns=turns-1 FROM {{table}} WHERE id='".$userrow["id"."' LIMIT 1", "users";

I am sure I messed up that query but you get the point. Just put in turns=turns-1 in where the action default is exploring.

Then go into index.php and go down to the exploring function, where it has the default message that you see exploring, and add this.

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");
}


Then you should be good to go. All exploring will cease and keep displaying that message until at least 1 turn is refilled.

WARNING turn based will piss people off alot.
_________________________
MasterFayt - Amara 5 - Manas - Banar

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
#17215 - 05/04/08 10:44 PM Re: Turns based exploring - Not working [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Or VIP gets you unlimited turns ^_^
_________________________
MasterFayt - Amara 5 - Manas - Banar

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:
 Code:
 $updatequery = doquery("UPDATE {{table}} SET $action latitude='$latitude', longitude='$longitude', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
    header("Location: index.php");


into...

 Code:
 $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:

 Code:
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

 Code:
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
#17222 - 05/06/08 10:20 AM Re: Turns based exploring - Not working [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Error #1. 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");
}

You forgot a ] it should be >

($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");
}

Error #2.

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%">

Since the coding has html templates, you cannot use php, so it's best to change everything to php in the function explore, and if you don't want to. Then place the

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");
}

Before $page = <<<END

because that is the html.
_________________________
MasterFayt - Amara 5 - Manas - Banar

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
#17225 - 05/07/08 09:47 AM Re: Turns based exploring - Not working [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Works fine on mine
_________________________
MasterFayt - Amara 5 - Manas - Banar

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

 Code:
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:

 Code:
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:

 Code:
$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
#17227 - 05/07/08 03:44 PM Re: Turns based exploring - Not working [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
I believe the one you have in explore is not subtracting.

$action = "currentaction='Exploring',";

Look for that in explore and put this inside the { } brackets of it.

$updatequery = doquery("UPDATE {{table}} SET turns=turns-1, WHERE id='".$userrow["id"]."' LIMIT 1", "users");
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#17228 - 05/07/08 03:45 PM Re: Turns based exploring - Not working [Re: Fayt]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
The only other option which is sure fire way is to convert the explore function into php.
_________________________
MasterFayt - Amara 5 - Manas - Banar

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:

 Code:
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
#17235 - 05/08/08 10:55 AM Re: Turns based exploring - Not working [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Sort of, you can do it that way, or just take out the END templates and add back slashes before every double quote. Like
<input type=\"submit\" name=\"blah\" value=\"click\">
_________________________
MasterFayt - Amara 5 - Manas - Banar

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.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#17249 - 05/09/08 09:50 AM Re: Turns based exploring - Not working [Re: AnmanIndustries]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
that's why I said to remove the template and add the slashes,
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
Page 1 of 2 12>


Hop to:

se7enet

Barack Obama Logo