Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 04-01-2016, 09:10 AM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 18,715
NobodysHero is on a distinguished road
Default Explore System - Need Help With Database Not Resetting

Okay, I saw the fix in this thread, but I still can't get it to reset. Can someone show me in my code where it's wrong? I'm really having a hard time here. This is the code for my Egg Hunt game that I made for a on-site holiday, I added extra columns in the database, just like it says for the explore pages, then modified ONLY those parts of the code.

The regular explore pages don't reset either, so showing me what I did wrong here will also help me see where I went wrong on the others. Thanks!


PHP Code:
<?php

class beltanegrabView extends View{
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;
            
$document->setTitle("Welcome to the Beltane Egg Hunt!");  
                
$reset $mysidia->user->lastday != $today;  
                
$updatedExploreTimes $reset $mysidia->user->exploretimes 1;  
        
$today date("d");
        if (
$mysidia->user->bellastday != $today) {
        
$mysidia->db->update("users", array("beltanegrab" => (0)), "username = '{$mysidia->user->username}'");        
        }

        
$mysidia->db->update("users", array("bellastday" => $today), "username = '{$mysidia->user->username}'");
        
$mysidia->db->update("users", array("beltanegrab" => ($mysidia->user->beltanegrab 1)), "username = '{$mysidia->user->username}'");  
        if (
$mysidia->user->beltanegrab <= 12) {  
            
$random rand(1,1000);
            


            if(
$random && $random 49){
                
$species "Ruadh Butterfly";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '25'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br> Pretty, pretty <b>$species</b>! Flutter, flutter, flutter!</center>"FALSE));
            }
            elseif(
$random >= 50 && $random <= 99){
                
$amount rand(50,200000);
                
$mysidia->user->changecash($amount); 
                
$document->add(new Comment("<center>Oh look! You found $amount tyleans!</center>"FALSE)); 
            }
            if(
$random >= 100 && $random <= 149){
                
$species "Corcra Butterfly";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '26'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br> Good thing you brought your net! The $species</b> is quite the flier!</center>"FALSE));
            }  
            if(
$random >= 150 && $random <= 249){
                
$species "Oraiste Butterfly";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '27'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br> Oh look! You found a <b>$species!</b> OHOH! There it goes! GRAB IT!</center>"FALSE));
            }  
            if(
$random >= 250 && $random <= 350){
                
$item "Cearc Egg";
                
$qty 1;
                
$newitem = new StockItem($item);
                
$newitem->append($qty$mysidia->user->username);  
                
$itemIMG $mysidia->db->select("items", array("imageurl"), "id = '50'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$itemIMG' alt='$item IMG' /><br>Poor little abandoned <b>$item</b>. It might not hatch, but it's still cute.</center>"FALSE));
            }
            if(
$random >= 351 && $random <= 450){
                
$species "Lemon Cearc";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '35'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br> Oh, I can't wait til it hatches! The <b>$species</b> is my favorite! </center>"FALSE));
            }
            if(
$random >= 451 && $random <= 500){
                
$species "Black Cherry Cearc";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '39'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br> Oh, I can't wait til it hatches! The <b>$species</b> is my favorite! </center>"FALSE));
                }  
            if(
$random >= 501 && $random <= 550){
                
$species "Licorice Cearc";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '36'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>The <b>$species</b> is like the ugly duckling, only it's a Cearc and it's cute!</center>"FALSE));
            }
            if(
$random >= 551 && $random <= 600){
                
$species "Blueberry Cearc";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '37'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>Looking at the <b>$species</b> chick makes me want some jellybeans!</center>"FALSE));
            }
            if(
$random >= 601 && $random <= 650){
                
$species "Kiwi Cearc";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '38'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>Green? Weird... Maybe it's radioactive! Oh, no wait. It's just a <b>$species</b>!</center>"FALSE));
            }
            if(
$random >= 651 && $random <= 700){
                
$species "Coconut Cearc";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '40'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>Awwww! This <b>$species</b> is nearly as white as its shell!</center>"FALSE));
            }
            if(
$random >= 701 && $random <= 750){
                
$species "Oyster";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '145'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>OHOHOH! Look, it's a <b>$species</b>! Wait... What's a $species have to do with Beltane? Meh.</center>"FALSE));
            }
            if(
$random >= 751 && $random <= 800){
                
$species "Eggshell Velociraptor";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '159'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>This <b>$species</b> jumped right out! WHOA!</center>"FALSE));
            }
            if(
$random >= 801 && $random <= 850){
                
$species "One Cereus Bunny";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '158'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>Awwww. Did you know <b>$species</b> was in there? Don't look at me! I didn't know either!</center>"FALSE));
            }
            if(
$random >= 851 && $random <= 899){
                
$species "Cereus Fox";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '157'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br>What a sly and handsome <b>$species</b> you've found!</center>"FALSE));
            }
            }
        if(
$random >= 900 && $random <= 999){
$document->add(new Comment("<center>Nothing in your egg, huh? Guess you better crack open another one!<br><br> 
<a href='/beltanegrab'>Explore Again</a><br><br><img src='http://i.imgur.com/6EjkLtI.png' /></center>"
FALSE));
            }   
            elseif(
$random == 1000){
                
$species "Chasmic Sheep";
                
$newadopt = new StockAdopt($species);
                
$newadopt->append($mysidia->user->username);
                
$adoptIMG $mysidia->db->select("adoptables", array("eggimage"), "id = '156'")->fetchColumn();
                
$document->add(new Comment("<center><img src='$adoptIMG' alt='$species IMG' /><br> MY GOODNESS! You've found a $species! LOOK HOW FLUFFY!</center>"FALSE));
            }
            else{
            
            
$document->add(new Comment(" <br><center><b>You can only search 12 eggs a day. If this is the only message you see, then you have no more tries.</b></center>"FALSE));
            
$document->add(new Comment("<br><center>Click on an egg below to try another one! Click the nest or refresh.<br><a href='/beltanegrab'><img width='50%' src='http://i1166.photobucket.com/albums/q610/MystFell/SHATTEREDMIND/Google%20Drive/Site_Assets/Web%20Assets/Beltane/BirdNest_Eggs_zpsa2b593d0.png'</a>></center>"FALSE));

            }
        

    }

}
?>
Reply With Quote
  #2  
Old 04-05-2016, 08:47 AM
RestlessThoughts's Avatar
RestlessThoughts RestlessThoughts is offline
Member
 
Join Date: Mar 2016
Posts: 10
Gender: Female
Credits: 1,133
RestlessThoughts is on a distinguished road
Default :)

The main issue is that even though you update the table to be 0, $mysidia->user->beltanegrab still holds the old, original value. So you're updating the table to 0, then setting it back to the old value + 1.

So the easiest patch would be to set $mysidia->user->beltanegrab to 0 when you update the table to be 0. Then the next check of $mysidia->user->beltanegrab later down the script will be correctly reset and allow players to continue.
PHP Code:
if ($mysidia->user->bellastday != $today) { 
        
$mysidia->db->update("users", array("beltanegrab" => (0)), "username = '{$mysidia->user->username}'");
       
$mysidia->user->beltanegrab 0;         
    } 
__________________
Reply With Quote
  #3  
Old 04-06-2016, 09:01 AM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 18,715
NobodysHero is on a distinguished road
Default

Restless... I'm quickly becoming your biggest fan. <3
Reply With Quote
  #4  
Old 04-06-2016, 11:33 AM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 33,612
Ittermat is on a distinguished road
Default

I Know restless is awesome! <3
Reply With Quote
  #5  
Old 04-10-2016, 10:39 AM
LUC1G07CH1's Avatar
LUC1G07CH1 LUC1G07CH1 is offline
Member
 
Join Date: Mar 2016
Location: Too distant for telling, but it's HUEBR
Posts: 150
Gender: Unknown/Other
Credits: 19,704
LUC1G07CH1 is on a distinguished road
Send a message via AIM to LUC1G07CH1 Send a message via Yahoo to LUC1G07CH1
Default

As seeing you all calling her aweome,i think that i'll ask help for her in the future ^u^
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 03:33 AM.

Currently Active Users: 9783 (0 members and 9783 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636