Log in

View Full Version : Help with Fishing pages...?


Ittermat
04-01-2016, 12:50 AM
Okay so I did try to do this all on my own.. its not working XD So I need some help please..

what im trying to do is that you need A fishing pole and bait to fish..and each time you fish it uses a bait..but you keep the pole... everytime I've tried it so far it takes my pole, leaves the bait and doesnt do anything

heres my exploreforestlake.php


<?php

class ExploreforestlakeController extends AppController{

public function __construct(){
parent::__construct("member");
}

public function index(){
$mysidia = Registry::get("mysidia");
}
}
?>

And my exploreforestlakeview.php

<?php

class Exploreforestlakeview extends View{

public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle("Fishing in the Forest Lake");


$document->add(new Comment(" <a href='http://http://atrocity.mysidiahost.com/pages/view/Forestlake'><b>Go back to the Forest?</a></b>", FALSE));


$item = "Fishing pole";
$hasitem = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item}' and owner='{$mysidia->user->username}'")->fetchColumn();
if($hasitem){
$today = date("d"); // Day of the month

// Reset explore counter if the last recorded exploration was on a different day than today:
$reset = $mysidia->user->lastday != $today;

// Allow user to explore if they are under the limit or if reset condition is true.
if ($mysidia->user->exploretimes <= 50 || $reset) {
// Update the last day that they explored to today
$mysidia->db->update("users", array("lastday" => $today), "username = '{$mysidia->user->username}'");

// If $reset condition was true, reset the count to 1, otherwise increment the existing count.
$updatedExploreTimes = $reset ? 1 : $mysidia->user->exploretimes + 1;

$mysidia->db->update("users", array("exploretimes" => ($updatedExploreTimes)), "username = '{$mysidia->user->username}'");
$item_name = "Worm bait";
$qty = 1;
$item = new PrivateItem($item, $mysidia->user->username);
$item->remove($qty, $mysidia->user->username);

$random = rand(1,100);
if($random > 1 && $random < 20){
$item = "Bass";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/2879896ec53a9ca6f0fe008ed741fcf9.png' /><b>$item</b>!", FALSE));

}
if($random > 1 && $random < 20){
$item = "Catfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c7c6b8aecbedb50364a4a1f337465205.png' /><b>$item</b>!", FALSE));

}
if($random > 1 && $random < 20){
$item = "Minnow";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97c91ea1a9b860bd200ed64613075c28.png'/> <b>$item</b>!", FALSE));

}

elseif($random >= 21 && $random <= 30){
$amount = rand(5,20);
$mysidia->user->changecash($amount);
$document->add(new Comment("Oh look! You found $amount cash!", FALSE));

}

if($random >= 31 && $random <= 40){
$item = "Goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c9ba65aaf86106d7dcad0ee866bfe9b5.png' /><b>$item</b>!", FALSE));

}
if($random >= 61 && $random <= 70){
$item = "Green goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/ea0c2e09ddabdb09219dc51327eda1c6.png'/> <b>$item</b>!", FALSE));

}
if($random >= 61 && $random <= 70){
$item = "Salmon";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/1d582df0254184cfa7db4355d0f88456.png'/> <b>$item</b>!", FALSE));

}
if($random >= 61 && $random <= 70){
$item = "Perch";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3b10be95eb860ceef037e1ec48032bd8.png' /> <b>$item</b>!", FALSE));

}
if($random >= 61 && $random <= 70){
$item = "Tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3a2bd74fe67aaf339aca053295a05fe3.png'/><b>$item</b>!", FALSE));

}
if($random >= 61 && $random <= 70){
$item = "Tilapia";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/381485713a62701c02d9542270840c5f.png'/><b>$item</b>!", FALSE));

}
if($random >= 61 && $random <= 70){
$item = "Trout";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/64e477dc4e5f6bd8d067ca0069f383c6.png'/><b>$item</b>!", FALSE));

}
elseif($random >= 61 && $random <= 70){
$species = "Feesh";
$newadopt = new StockAdopt($species);
$newadopt->append($mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4c84be28b2521512213bf7557959d35d.png'/> $species egg! Its uncommon.", FALSE));

}
if($random >= 71 && $random <= 75){
$item = "Eel";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/31cd0b3000b5c97920ca5b24c11c209b.png'/><b>$item</b>!", FALSE));

}
if($random >= 71 && $random <= 75){
$item = "Green angelfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/055dfbad2fc20f9436fb07c4f4377037.png'/><b>$item</b>!", FALSE));

}
if($random >= 71 && $random <= 75){
$item = "Green and blue guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e54874ea8a2b03d12da45f53621b4b6d.png'/><b>$item</b>!", FALSE));

}
if($random >= 71 && $random <= 75){
$item = "Green and magenta guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e7a43df0325b27724e313928683b2ff4.png'/><b>$item</b>!", FALSE));

}
if($random >= 71 && $random <= 75){
$item = "Red lobster";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97cbb6c7b48e66c68a415d2e3a6bbcdc.png'/><b>$item</b>!", FALSE));

}
if($random == 100){
$item = "Green betta fish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/879a6fc1961eb7d8e504e6579c267fed.png'/><b>$item</b>!", FALSE));

}
if($random == 100){
$item = "Green koi";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/95d261007e6933e5c9e0e098af07199a.png'/><b>$item</b>!", FALSE));

}
if($random == 100){
$item = "Green tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4181c20e206d7c27063ebd322aeae903.png'/><b>$item</b>!", FALSE));

}
if($random >= 91 && $random <= 99){
$document->add(new Comment("You didn't catch anything. Better luck next time.", FALSE));
}
} else { // Past limit
$document->add(new Comment("It seems you have fished too much today, why don't you take a rest until tomorrow?", FALSE));
}
} else { // Lacking item
$document->add(new Comment("Sorry you need a fishing pole and Bait to Fish!", FALSE));
}


$document->add(new Comment("<img src='http://i67.tinypic.com/1zxb4fk.jpg'/>", FALSE));
}
}
?>



Im also trying to get the images to show up when you catch something... and theres a picture of a lake that I want on the page...(for atmosphere basically..) But I cant get it to work... help please?

Heres the page...everything is also all mushed together.....

http://atrocity.mysidiahost.com/exploreforestlake

Thank you in advance ^^;; I've been trying to get this to work for like...3 hours

Ittermat
04-01-2016, 11:41 AM
Bump, added a screenshot since I realized you cant see the page if you arent a member lol

LUC1G07CH1
04-01-2016, 07:00 PM
I have tested this and it works fine to me,i think you need to buy the pole and the bait again,so i think it will be fine to you too. (i have purchased a pole,but the message had with me and my pole dissapeared,so i buy it again and tadaaa!)

Ittermat
04-01-2016, 07:03 PM
Hmm I was messing with it a little bit...
but its not supposed to take your pole at all XD

LUC1G07CH1
04-01-2016, 08:31 PM
But my pole dissapeared again,oh noes! :ohnoes:

Ittermat
04-01-2016, 08:32 PM
yea its not supposed to be taking the pole...just the bait... wait till I actually fix it to use it please XD

LUC1G07CH1
04-01-2016, 09:14 PM
Okay! *insert a thumbup*

tahbikat
04-01-2016, 09:56 PM
Try this? I haven't tested it so just let me know if it works or not. Replace the parts that need replacing, from the $item line to the remove item line.



$item = "Fishing pole";
$item2 = "Worm Bait";
$hasitem = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item}' and owner='{$mysidia->user->username}'")->fetchColumn();
$hasitem2 = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item2}' and owner='{$mysidia->user->username}'")->fetchColumn();
if($hasitem && $hasitem2){
$today = date("d"); // Day of the month

// Reset explore counter if the last recorded exploration was on a different day than today:
$reset = $mysidia->user->lastday != $today;

// Allow user to explore if they are under the limit or if reset condition is true.
if ($mysidia->user->exploretimes <= 50 || $reset) {
// Update the last day that they explored to today
$mysidia->db->update("users", array("lastday" => $today), "username = '{$mysidia->user->username}'");

// If $reset condition was true, reset the count to 1, otherwise increment the existing count.
$updatedExploreTimes = $reset ? 1 : $mysidia->user->exploretimes + 1;

$mysidia->db->update("users", array("exploretimes" => ($updatedExploreTimes)), "username = '{$mysidia->user->username}'");
$item_name = "Worm bait";
$qty = 1;
$item_name = new PrivateItem($item_name, $mysidia->user->username);
$item_name->remove($qty, $mysidia->user->username);

Ittermat
04-01-2016, 10:04 PM
That worked! Now I just need to tweak a few things...and figure out how to space things... and how to add a link to continue fishing XD

tahbikat
04-01-2016, 10:14 PM
Yay, awesome! c:

Ittermat
04-01-2016, 10:39 PM
okay now Im getting this error...

Parse error: syntax error, unexpected 'else' (T_ELSE), expecting function (T_FUNCTION) in /home/atrocity/public_html/view/exploreforestlakeview.php on line 200

Heres my line 200 down..

} else { // Past limit
$document->add(new Comment("It seems you have fished too much today, why don't you take a rest until tomorrow?", FALSE));
}
} else { // Lacking item
$document->add(new Comment("Sorry you need a fishing pole and Bait to Fish!", FALSE));
}
}
}
?>

Ittermat
04-01-2016, 10:56 PM
Also heres my Entire view file....?

Code:

<?php

class Explorearea1View extends View{

public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle("Fishing in the Forest Lake");


$document->add(new Comment(" <a href='http://atrocity.mysidiahost.com/pages/view/Forestlake'><b>Go back to the Forest?</a></b>", FALSE));



$item = "Fishing pole";
$item2 = "Worm Bait";
$hasitem = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item}' and owner='{$mysidia->user->username}'")->fetchColumn();
$hasitem2 = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item2}' and owner='{$mysidia->user->username}'")->fetchColumn();
if($hasitem && $hasitem2){
$today = date("d"); // Day of the month

// Reset explore counter if the last recorded exploration was on a different day than today:
$reset = $mysidia->user->lastday != $today;

// Allow user to explore if they are under the limit aor if reset condition is true.
if ($mysidia->user->exploretimes <= 50 || $reset) {
// Update the last day that they explored to today
$mysidia->db->update("users", array("lastday" => $today), "username = '{$mysidia->user->username}'");

// If $reset condition was true, reset the count to 1, otherwise increment the existing count.
$updatedExploreTimes = $reset ? 1 : $mysidia->user->exploretimes + 1;

$mysidia->db->update("users", array("exploretimes" => ($updatedExploreTimes)), "username = '{$mysidia->user->username}'");

$item_name = "Worm bait";
$qty = 1;
$item_name = new PrivateItem($item_name, $mysidia->user->username);
$item_name->remove($qty, $mysidia->user->username);

$random = rand(1,115);
if($random > 1 && $random < 20){
$item = "Bass";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/2879896ec53a9ca6f0fe008ed741fcf9.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

$item = "Catfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c7c6b8aecbedb50364a4a1f337465205.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

$item = "Minnow";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97c91ea1a9b860bd200ed64613075c28.png'/> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

if($random > 21 && $random < 30){
$amount = rand(5,20);
$mysidia->user->changecash($amount);
$document->add(new Comment("Oh look! You found $amount cash! <a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

if($random > 31 && $random < 40){
$item = "Goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c9ba65aaf86106d7dcad0ee866bfe9b5.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 71 && $random < 84){
$item = "Green goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/ea0c2e09ddabdb09219dc51327eda1c6.png'/> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 57 && $random < 60){
$item = "Salmon";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/1d582df0254184cfa7db4355d0f88456.png'/> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 41 && $random < 46){
$item = "Perch";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3b10be95eb860ceef037e1ec48032bd8.png' /> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 85 && $random < 89){
$item = "Tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3a2bd74fe67aaf339aca053295a05fe3.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 90 && $random < 94){
$item = "Tilapia";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/381485713a62701c02d9542270840c5f.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 94 && $random < 98){
$item = "Trout";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/64e477dc4e5f6bd8d067ca0069f383c6.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
elseif($random >= 61 && $random <= 70){
$species = "Feesh";
$newadopt = new StockAdopt($species);
$newadopt->append($mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4c84be28b2521512213bf7557959d35d.png'/> $species egg! Its uncommon.<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 98 && $random < 100){
$item = "Eel";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/31cd0b3000b5c97920ca5b24c11c209b.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 103 && $random < 105){
$item = "Green angelfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/055dfbad2fc20f9436fb07c4f4377037.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 106 && $random < 108){
$item = "Green and blue guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e54874ea8a2b03d12da45f53621b4b6d.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 109 && $random < 111){
$item = "Green and magenta guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e7a43df0325b27724e313928683b2ff4.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 113 && $random < 115){
$item = "Red lobster";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97cbb6c7b48e66c68a415d2e3a6bbcdc.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random == 100){
$item = "Green betta fish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/879a6fc1961eb7d8e504e6579c267fed.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random == 100){
$item = "Green koi";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/95d261007e6933e5c9e0e098af07199a.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random == 100){
$item = "Green tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4181c20e206d7c27063ebd322aeae903.png'/><b>$item</b>! <a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));
}
}
if($random >= 91 && $random <= 99){
$document->add(new Comment("You didn't catch anything. Better luck next time.", FALSE));
}
else{
$document->add(new Comment("Oops! Something went wrong.", FALSE));
}
}
else{
$document->add(new Comment("It seems you have fished too much today, why don't you take a rest?", FALSE));
}

}

}
?>

Im so confused right now XD

tahbikat
04-02-2016, 01:58 PM
if($random > 1 && $random < 20){
$item = "Bass";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/2879896ec53a9ca6f0fe008ed741fcf9.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

$item = "Catfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c7c6b8aecbedb50364a4a1f337465205.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

$item = "Minnow";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97c91ea1a9b860bd200ed64613075c28.png'/> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}


Is this supposed to reward three different catches at once? (Bass, Catfish, Minnow) If so, you need to remove the extra brackets at the end of the Bass and Catfish item codes. If not, then you need to fix those up and add if statements with the random number lines like the others have.

Ittermat
04-02-2016, 01:59 PM
lol! I forgot to add the random numbers in front of those....The coding is messing with my brain...

Ittermat
04-02-2016, 02:10 PM
Okay so I fixed that... but now I need to figure out how to do spacing XD And how to add the image to the page...

tahbikat
04-02-2016, 02:18 PM
Okay so I fixed that... but now I need to figure out how to do spacing XD And how to add the image to the page...

Replace with this. Where the image code is, put the image's link there. There's a more correct way of doing this but this was just easier:


} else { // Past limit
$document->add(new Comment("You have used <b>{$mysidia->user->exploretimes} out of 50</b> explore points.<br /><br />It seems you have explored too much today, why don't you take a rest until tomorrow?", FALSE));
}
} else { // Lacking item
$document->add(new Comment("Woah there! You need a pair of Snow Boots in order to explore. Wouldn't wanna get frostbite! Why don't you go purchase some from Gerolt's first?", FALSE));
}
$document->add(new Comment("<br /><img src='IMG SRC HERE' />"));
}

}
?>

Ittermat
04-02-2016, 02:26 PM
I did that... but it gives me this error...
Parse error: syntax error, unexpected 'else' (T_ELSE), expecting function (T_FUNCTION) in /home/atrocity/public_html/view/exploreforestlakeview.php on line 206

Sorry to be so much trouble... x.x...

}
} else { // Lacking item
$document->add(new Comment("Woah there! You need a pole and Bait to fish!", FALSE));
}
$document->add(new Comment("<br /><img src='http://i67.tinypic.com/1zxb4fk.jpg'/>"));
}
}
?>

tahbikat
04-02-2016, 04:20 PM
Humm, try adding it below the second to last bracket instead? So between the last two brackets? Works fine with my code.

Ittermat
04-02-2016, 07:42 PM
nope...that didnt work XD

tahbikat
04-02-2016, 07:48 PM
That's strange... If you remove the image code line, do you still get the error?

Ittermat
04-02-2016, 07:50 PM
yea still there...

Ittermat
04-02-2016, 07:58 PM
Heres my View..considering I dont exactly know what Im doing I may have possibly screwed it up?

<?php

class ExploreforestlakeView extends View{

public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle("Fishing in the Forest Lake");


$document->add(new Comment(" <a href='http://atrocity.mysidiahost.com/pages/view/Forestlake'><b>Go back to the Forest?</a></b>", FALSE));



$item = "Fishing pole";
$item2 = "Worm Bait";
$hasitem = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item}' and owner='{$mysidia->user->username}'")->fetchColumn();
$hasitem2 = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item2}' and owner='{$mysidia->user->username}'")->fetchColumn();
if($hasitem && $hasitem2){
$today = date("d"); // Day of the month

// Reset explore counter if the last recorded exploration was on a different day than today:
$reset = $mysidia->user->lastday != $today;

// Allow user to explore if they are under the limit aor if reset condition is true.
if ($mysidia->user->exploretimes <= 20 || $reset) {
// Update the last day that they explored to today
$mysidia->db->update("users", array("lastday" => $today), "username = '{$mysidia->user->username}'");

// If $reset condition was true, reset the count to 1, otherwise increment the existing count.
$updatedExploreTimes = $reset ? 1 : $mysidia->user->exploretimes + 1;

$mysidia->db->update("users", array("exploretimes" => ($updatedExploreTimes)), "username = '{$mysidia->user->username}'");

$item_name = "Worm bait";
$qty = 1;
$item_name = new PrivateItem($item_name, $mysidia->user->username);
$item_name->remove($qty, $mysidia->user->username);

$random = rand(1,159);
}
if($random > 1 && $random < 20){
$item = "Bass";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/2879896ec53a9ca6f0fe008ed741fcf9.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 116 && $random < 135){
$item = "Catfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c7c6b8aecbedb50364a4a1f337465205.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 136 && $random < 155){
$item = "Minnow";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97c91ea1a9b860bd200ed64613075c28.png'/> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

if($random > 21 && $random < 30){
$amount = rand(5,20);
$mysidia->user->changecash($amount);
$document->add(new Comment("Oh look! You found $amount cash! <a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}

if($random > 31 && $random < 40){
$item = "Goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c9ba65aaf86106d7dcad0ee866bfe9b5.png' /><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 71 && $random < 84){
$item = "Green goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/ea0c2e09ddabdb09219dc51327eda1c6.png'/> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 57 && $random < 60){
$item = "Salmon";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/1d582df0254184cfa7db4355d0f88456.png'/> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 41 && $random < 46){
$item = "Perch";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3b10be95eb860ceef037e1ec48032bd8.png' /> <b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 85 && $random < 89){
$item = "Tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3a2bd74fe67aaf339aca053295a05fe3.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 90 && $random < 94){
$item = "Tilapia";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/381485713a62701c02d9542270840c5f.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 94 && $random < 98){
$item = "Trout";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/64e477dc4e5f6bd8d067ca0069f383c6.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
elseif($random >= 61 && $random <= 70){
$species = "Feesh";
$newadopt = new StockAdopt($species);
$newadopt->append($mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4c84be28b2521512213bf7557959d35d.png'/> $species egg! Its uncommon.<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 98 && $random < 100){
$item = "Eel";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/31cd0b3000b5c97920ca5b24c11c209b.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 103 && $random < 105){
$item = "Green angelfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/055dfbad2fc20f9436fb07c4f4377037.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 106 && $random < 108){
$item = "Green and blue guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e54874ea8a2b03d12da45f53621b4b6d.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 109 && $random < 111){
$item = "Green and magenta guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e7a43df0325b27724e313928683b2ff4.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random > 113 && $random < 115){
$item = "Red lobster";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97cbb6c7b48e66c68a415d2e3a6bbcdc.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random >= 158 && $random <= 159){
$item = "Green betta fish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/879a6fc1961eb7d8e504e6579c267fed.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random >= 156 && $random <= 157){
$item = "Green koi";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/95d261007e6933e5c9e0e098af07199a.png'/><b>$item</b>!<a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));

}
if($random >= 155 && $random <= 156){
$item = "Green tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4181c20e206d7c27063ebd322aeae903.png'/><b>$item</b>! <a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));
}
}
if($random >= 91 && $random <= 99){
$document->add(new Comment("You didn't catch anything. Better luck next time.", FALSE));
}
} else { // Past limit
$document->add(new Comment("You have used <b>{$mysidia->user->exploretimes} out of 20</b> explore points.<br /><br />It seems you have fished too much today, why don't you take a rest until tomorrow?", FALSE));
}
} else { // Lacking item
$document->add(new Comment("Woah there! You need a pole and Bait to fish!", FALSE));
}
$document->add(new Comment("<br /><img src='http://i67.tinypic.com/1zxb4fk.jpg' />"));
}
?>

tahbikat
04-02-2016, 08:19 PM
There's an extra bracket that needs to be removed in this part. Remove the bracket all the way to the left:

if($random >= 155 && $random <= 156){
$item = "Green tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4181c20e206d7c27063ebd322aeae903.png'/><b>$item</b>! <a href='http://atrocity.mysidiahost.com/exploreforestlake'><b>Continue Fishing?</a></b>", FALSE));
}
}
if($random >= 91 && $random <= 99){
$document->add(new Comment("You didn't catch anything. Better luck next time.", FALSE));
}

Ittermat
04-02-2016, 08:25 PM
thanks XD Everythings still smushed together though XD HAHA theres still some tweakin to do ^^