Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   No Clicks at all? (http://www.mysidiaadoptables.com/forum/showthread.php?t=392)

rosepose 02-15-2009 08:02 PM

No Clicks at all?
 
I'm trying to teach myself PHP, and I was wondering which bits of the script contain parts that determine when the adoptable levels up, and how hard that would be to change to no clicks? I'm trying to get it to change after a certain amount of time, you see, like this:
PHP Code:

if ($date XX) {

  foreach (
$variation->age as $age) {
         if (
$age['date'] == "a") {
              
$pickedAge=$age;
         }
    }
}

  else if (
$date XX && $date >= XX) {

  foreach (
$variation->age as $age) {
         if (
$age['date'] == "b") {
              
$pickedAge=$age;
         }
    }
}

  else if (
$date >= XX) {

  foreach (
$variation->age as $age) {
         if (
$age['date'] == "c") {
              
$pickedAge=$age;
         }
    }
}

else {
echo 
"Cannot find that age";


Rather than with clicks, because the main thing that appeals to me about this script is that you can put your adoptables on an account. Even as the admin of my site, I'm still finding it hard to get mine to level up.

BMR777 02-16-2009 03:15 PM

RE: No Clicks at all?
 
Well, I can tell you that it will be rather tricky to convert from a clicks based system to a time-based one, simply because the script wasn't designed for time-based leveling. Here's the code though that controls when an adoptable levels up...

In levelup.php:

PHP Code:

//Check and see if we need a level up...
            
$levelup checklevel($totalclicks);
            if(
$levelup $currentlevel){
            
//The creature needs to level up
            //Check if we are at max level

            
$query "SELECT * FROM adoptable_rankimages WHERE name = '$type'";
            
$result = @mysql_query($query);
            
$num = @mysql_numrows($result);

            
//Loop out code
            
$i=0;
            while (
$i 1) {

            
$l1i=@mysql_result($result,$i,"l1i");
            
$l2i=@mysql_result($result,$i,"l2i");
            
$l3i=@mysql_result($result,$i,"l3i");
            
$l4i=@mysql_result($result,$i,"l4i");
            
$l5i=@mysql_result($result,$i,"l5i");    
            
$l6i=@mysql_result($result,$i,"l6i");
            
$l7i=@mysql_result($result,$i,"l7i");
            
$l8i=@mysql_result($result,$i,"l8i");
        

            
$i++;
            }
            
            
$mymax 8;
            if(
$l1i == "" || l1i == NULL){
            
$mymax 0;
            
$img $l1i;
            }    
            else if(
$l2i == "" || l2i == NULL){
            
$mymax 1;
            
$img $l2i;
            }
            else if(
$l3i == "" || l3i == NULL){
            
$mymax 2;
            
$img $l3i;
            }
            else if(
$l4i == "" || l4i == NULL){
            
$mymax 3;
            
$img $l4i;
            }
            else if(
$l5i == "" || l5i == NULL){
            
$mymax 4;
            
$img $l5i;
            }
            else if(
$l6i == "" || l6i == NULL){
            
$mymax 5;
            
$img $l6i;
            }
            else if(
$l7i == "" || l7i == NULL){
            
$mymax 6;
            
$img $l7i;
            }
            else if(
$l8i == "" || l8i == NULL){
            
$mymax 7;
            
$img $l8i;
            }


            if(
$currentlevel $mymax){
            
//Not at max level, rank them up
    
            
if($levelup == "1" and $mymax >= $levelup){
            
$img $l1i;
            }        
            if(
$levelup == "2" and $mymax >= $levelup){
            
$img $l2i;
            }
            if(
$levelup == "3" and $mymax >= $levelup){
            
$img $l3i;
            }
            if(
$levelup == "4" and $mymax >= $levelup){
            
$img $l4i;
            }
            if(
$levelup == "5" and $mymax >= $levelup){
            
$img $l5i;
            }
            if(
$levelup == "6" and $mymax >= $levelup){
            
$img $l6i;
            }
            if(
$levelup == "7" and $mymax >= $levelup){
            
$img $l7i;
            }
            if(
$levelup == "8" and $mymax >= $levelup){
            
$img $l8i;
            }

            
mysql_query("UPDATE owned_adoptables SET currentlevel='".$levelup."' WHERE uid='".$id."'");
            
mysql_query("UPDATE owned_adoptables SET imageurl='".$img."' WHERE uid='".$id."'");
            
$flag 1;
            
$currentlevel $levelup;
            }


            } 

There are two versions of that code in levelup.php, one for registered users and one for guests.

I would wait though until the new version comes out in a week or two before changing anything as the new version is a major rewrite. :)

rosepose 02-16-2009 06:03 PM

RE: No Clicks at all?
 
Yes, I'll wait. I'm trying it out now, and I have a basic script done which grows the adoptables after a certain amount of time (ah, success!) but I still can't figure out how to put them on an account.

BMR777 02-16-2009 06:12 PM

RE: No Clicks at all?
 
What do you mean by put them on an account? They should already be on a user's account as their adoptable, if that's what you mean.

rosepose 02-16-2009 09:54 PM

RE: No Clicks at all?
 
No, I have a script where it allows the person go get a pet simply by plugging in their name and pet name. They don't need to register at all, which makes it difficult to determine ownership. The script I've done chooses a random outcome from the ones I've made and makes the pets grow after a specified number of days.[hr]
You see, what I need to do is to integrate my existing script with the Easyadoptables script so that it will allow my users to add their adopted, time growing pets to an account.

BMR777 02-17-2009 03:52 PM

RE: No Clicks at all?
 
Ok, I see. I assume though that your script has saved in a database the username and adoptable type a user has, right? What you would probably have to do is make a conversion script in PHP for your script to the PHP EasyAdoptables Script.

The converter would have to allow users to make a new account on the EasyAdoptables script and then somehow import their adoptables into their new account. It can be done I think. You would simply create a new adoptable on the EasyAdoptables database for every old adoptable the user had, then adjust the clicks or time in the database for the new adoptable accordingly.

Hope it helps,
Brandon

rosepose 02-19-2009 01:39 PM

RE: No Clicks at all?
 
Erm... No, there's no database for that. The only SQL database I've made is one that saves the ID and the date. The ID pertains to the adoptable, which I specify the growth and images in a file called adoptables.xml. So, there's no username involved.

A conversion script? OK, so I somehow have to integrate my existing script with this other script.... *scurries away* How many of the pages in EasyAdoptables have bits that include the growth-by-click system?

-Rose[hr]
Oh, and I can get you a .zip file if you need one. Seeing as how I made the script, it's very basic.

BMR777 02-19-2009 06:30 PM

RE: No Clicks at all?
 
Well, the levelup.php file is the one that actually does the leveling of adoptables. The rest of the pages just pull or display the current level from the database.

rosepose 02-20-2009 08:34 AM

RE: No Clicks at all?
 
How difficult would it be to add something like this:
PHP Code:

if ($date 3

and
PHP Code:

else if ($date XX && $date >= XX) { 

under the levelup bits and have it work so that you need clicks and time? Would those codes work in the slightest?

BMR777 02-20-2009 08:58 AM

RE: No Clicks at all?
 
I don't know that you can measure date as a numerical value. Maybe you can though. I suppose you could do that somehow if you could measure date as a numerical value.

You would have to do something like this to the database:

Code:

alter table owned_adoptables add column leveldate varchar (30) ;
Then you would when the adoptable is created edit adopt.php to store the date as a numeric number, such as 1-1-2009 becomes 112009. Then when you level up you would get the current date and check it against the one in the database and only do the level if it matches your criteria. I suppose it can be done quite easily.

I wouldn't start on this yet though as a new release is right around the corner. :)


All times are GMT -5. The time now is 02:29 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.