Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.2.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=38)
-   -   Multiple Alternate Image Plugin (http://www.mysidiaadoptables.com/forum/showthread.php?t=2063)

Irion 04-21-2011 05:15 PM

Okay, so I tried this out since it was exactly what I was looking for.

First of all, I get "templates/icons/delete.gif" as the adopt image on level up and on myadopts.php?act=manage/stats but they show up on myadopts.php
I'm guessing this is due to the modification in the getcurrentimage function. I'll be having a look over it to learn how it's done.

I've had a go at adding an adoptable and read the instructions|FAQ but it's a little confusing and doesn't seem to be working, so I'm humbly asking for some clarification.
Here's what I done and perhaps you can tell me where I'm going wrong:

1. I created a new adoptable through admin.php, enabled the alternate images and filled in [Start using the alternate outcome at level number:] as 0 while the alternate outcome chance I put as 2. Though these number don't really matter and are just satisfying checks, right?

2. I added another level to the adopt I just made (Which was an egg by the way) through admin.php. This was level 1 and I added (one of) the alt image(s) for this level while I was at it; I also input 1 as the required number of clicks- for the sake of testing.

3. Next, it was my understanding that I then go to maiadmin.php and select "Add Alternate Image". I filled out the form as follows:

- Uploaded Image: I selected the same alt image as I used in the creation of level 1.
- Select Adopt: Selected the adopt I'd made, of course (I only have one in the database).
- Entry Level: This was a tad confusing despite your best efforts at explaining. My understanding at first was that it was supposed to be an integer that relates to the level (or stage) that the non-alt is at if it's the first in the alt line. So I input 1 as my value (I then tried again later with "yes" and got no different results)
- Replace Level: I thought this was self explanatory and was asking which level this alt will relate to in the level table. So I input 1.
- Path: I believe I understand this... I input 2 because it would be the 2nd path that that can start at.
- Subpath: I left this blank for the time being
- Select Adopt: Well I believe this was supposed to be called "Method" - and I chose "Random Method" from the drop down.
- Data: I input 2 to represent a 1 in 2 chance.

I then adopted 20 of my adoptable and proceeded to level them into the next stage. None of them returned as the alt.
I then created another alt image with maiadmin.php and used my 3rd alt (I want the egg to hatch into 3 different things- with one of them being significantly rarer). I input 3 for Path while keeping all the other variables the same.
I adopted another 20 and proceeded to level them but I still got the standard one.

Am I misunderstanding something? I also tried selecting as the alt image nothing when creating level 1 in admin.php

Last note: The "return" link on maiadmin.php?do=addnew takes you to www.$domain/'maiadmin.php/'

Beaux 04-29-2011 03:44 PM

I'm having the same issue with everything turning out standard, but I also get this error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /inc/functions.php on line 460

when I adopt or level a creature.

Not sure what to make of it since I'm still a newb to PHP. I've looked at both the original and modified codes and they're the same aside from the rows underneath...

Great script, though. I'll be in heaven once I can get it to work. :D

Kaeliah 04-30-2011 01:07 AM

Quote:

Originally Posted by Irion (Post 16348)
Okay, so I tried this out since it was exactly what I was looking for.

First of all, I get "templates/icons/delete.gif" as the adopt image on level up and on myadopts.php?act=manage/stats but they show up on myadopts.php
I'm guessing this is due to the modification in the getcurrentimage function. I'll be having a look over it to learn how it's done.

I've had a go at adding an adoptable and read the instructions|FAQ but it's a little confusing and doesn't seem to be working, so I'm humbly asking for some clarification.
Here's what I done and perhaps you can tell me where I'm going wrong:

1. I created a new adoptable through admin.php, enabled the alternate images and filled in [Start using the alternate outcome at level number:] as 0 while the alternate outcome chance I put as 2. Though these number don't really matter and are just satisfying checks, right?

2. I added another level to the adopt I just made (Which was an egg by the way) through admin.php. This was level 1 and I added (one of) the alt image(s) for this level while I was at it; I also input 1 as the required number of clicks- for the sake of testing.

3. Next, it was my understanding that I then go to maiadmin.php and select "Add Alternate Image". I filled out the form as follows:

- Uploaded Image: I selected the same alt image as I used in the creation of level 1.
- Select Adopt: Selected the adopt I'd made, of course (I only have one in the database).
- Entry Level: This was a tad confusing despite your best efforts at explaining. My understanding at first was that it was supposed to be an integer that relates to the level (or stage) that the non-alt is at if it's the first in the alt line. So I input 1 as my value (I then tried again later with "yes" and got no different results)
- Replace Level: I thought this was self explanatory and was asking which level this alt will relate to in the level table. So I input 1.
- Path: I believe I understand this... I input 2 because it would be the 2nd path that that can start at.
- Subpath: I left this blank for the time being
- Select Adopt: Well I believe this was supposed to be called "Method" - and I chose "Random Method" from the drop down.
- Data: I input 2 to represent a 1 in 2 chance.

I then adopted 20 of my adoptable and proceeded to level them into the next stage. None of them returned as the alt.
I then created another alt image with maiadmin.php and used my 3rd alt (I want the egg to hatch into 3 different things- with one of them being significantly rarer). I input 3 for Path while keeping all the other variables the same.
I adopted another 20 and proceeded to level them but I still got the standard one.

Am I misunderstanding something? I also tried selecting as the alt image nothing when creating level 1 in admin.php

Last note: The "return" link on maiadmin.php?do=addnew takes you to www.$domain/'maiadmin.php/'

Nothing that you've explained seems to be an issue, but if you could please check out your database, and even take screenshots of the tables related to the adoptables and the alternates to see if there is any information missing or weird there. That's where I usually tend to start when attempting a troubleshoot.

Quote:

Originally Posted by Beaux (Post 16449)
I'm having the same issue with everything turning out standard, but I also get this error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /inc/functions.php on line 460

when I adopt or level a creature.

Not sure what to make of it since I'm still a newb to PHP. I've looked at both the original and modified codes and they're the same aside from the rows underneath...

Great script, though. I'll be in heaven once I can get it to work. :D

Would you mind posting lines 400-500 in your functions.php or just the whole thing. The problem may also be the lack of compatibility with the mysql_num_rows thing.

It's a big script which is why there are so many bugs and glitches in it. I will be working on an updated version soon that will simplify things quite a bit and also hopefully work more reliably.

Beaux 04-30-2011 01:27 PM

PHP Code:

// Now we check those three conditions we have in the Admin CP
    
if($row['whenisavail'] == "conditions") {
        
// If we have a restriction on the number of times this can be adopted...
        
if($row['freqcond'] == "enabled") {
            
// Select from the database and determine how many times this adoptable type has been adopted
            
$num 0;

            
$query "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables WHERE type='$type'"// QUERYPROBLEM
            
$result runquery($query);
            
$num mysql_numrows($result);

            if(
$num $number) {
                return 
"no";
            }
        }

        
// Begin the date restriction check
        
$today date('Y-m-d');

        if(
$row['datecond'] == "enabled" and $row['date'] != $today) {
            return 
"no";
        }

        
// We are checking to see how many of this adoptable a user owns
        // If they own more than the specifed number, they cannot adopt...
        
if($row['moreless'] == "enabled") {
            
$num 0;

            
$query "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables WHERE owner='$loggedinname' and type='$type'";
            
$result runquery($query);
            
$num mysql_numrows($result);

            if(
$num $row['morelessnum']) {
                return 
"no";
            }
        }


        
// Check if the user is of a specified usergroup...
        
if($row['levelgrle'] == "enabled") {
            
$ourgid getgroup();

            
// If the two numbers do not match, do not allow the adoption...
            
if($ourgid != $row['grlelevel']) {
                return 
"no";
            }    
        }
    } 
// end conditions
    
return "yes";
}

// MESSY
function getaltstatus($parentid$childid$childlevel) {

    
// This function determines if we will use alternate images...
    
$alt "Cannot find adopt with given parent id.";

    
// First we need to see if this adoptable type has alternate images enabled...
    
$query "SELECT * FROM ".$prefix."adoptables WHERE id='".$parentid."'";
    
$result mysql_query($query);
    
$num mysql_num_rows($result);
    
$alternates=@mysql_result($result$i,"alternates");
    
    
// Let's see if the level we are on is the level that requires alternates
    
if($alternates == "enabled") {
        
// Alternates for adoptable type are enabled, next check to see if this adopt is already using an alternate.
        
$query "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='".$childid."'";
        
$result mysql_query($query);
        
$num mysql_num_rows($result);
        
$usealt=@mysql_result($result$i,"usealternates");
        
$currentimage=@mysql_result($result$i,"altimage");
        if(
$usealt == "no"){
        
// Alternates are not currently being used, next check for alternate image w/ specified entry level.
        
$query "SELECT * FROM ".$prefix."alternates WHERE entry='".$childlevel."' AND adoptid='".$parentid."'";
        
$result runquery($query);
        
        while(
$row mysql_fetch_array($result)){
        
$method=$row['method'];
        
$data=$row['data'];
        
$newurl=$row['alturl'];
        
// check what kind of method we're using to choose an alternate.
        
if($method == "random"){
        
$chance rand(1$data);
        if(
$chance == 1){
            
$alt $newurl;
        }
        else{
            
$alt "The random finder did not pick 1.";
        }
        
        }
        else{
            
$alt "Not finding method random...";
        }
        
        
$i++;
        }
        
        
        }
        else if(
$usealt == "yes"){ 

Lines 400-500.
I'll bet anything I pasted it in wrong.

Kaeliah 04-30-2011 07:07 PM

I don't see why it wouldn't be working unless the query is failing for some reason. =/

Beaux 05-01-2011 05:42 AM

I keep trying multiple things but nothing's worked yet. Maybe I'll get it eventually.

Nemesis 05-01-2011 10:20 AM

haha how i used to do things, just ram the code in there lol, great way to learn. just try and understand what its doing and look up things you don't know. good luck with your site, and i can't remember if you were like some of us trying to learn php through this project or just want your site working:hmmm:

Beaux 05-01-2011 10:57 AM

Quote:

Originally Posted by Nemesis (Post 16486)
haha how i used to do things, just ram the code in there lol, great way to learn. just try and understand what its doing and look up things you don't know. good luck with your site, and i can't remember if you were like some of us trying to learn php through this project or just want your site working:hmmm:

That's how I learn. c: I just stick in the code I want and compare it to the original if something goes wrong to see where it's different.

I taught myself CSS and HTML by doing that exactly, haha.

And I'm new to the forum so you probably haven't heard anything of me, but I do hope to learn a lot from it. I'm a pretty self-sufficient person and like doing absolutely everything on my own. I try to avoid asking for help unless I really really need to.

But I still can't fix this error... I've even tried deleting everything and reuploading the site with the scripts already modded. Same error.

I also noticed the original script has mysql_numrows and the modded version has mysql_num_rows, but changing the latter to the former still did nothing.

I'm honestly stumped. Watch it turn out to be some huge problem caused just because I misplaced one thing on accident. (It happens often)

Is nobody else getting the error I'm getting?

Kaeliah 05-01-2011 01:51 PM

What version of the script are you using?

Beaux 05-01-2011 02:10 PM

The newest one. I think I might re-download it and try from a fresh download, though.

I've been looking for anything that might be wrong but so far I've seen nothing that looks out of place.

I've even looked the error up on Google but none of others' solutions have been able to fix it.

Definitely gonna keep trying until I figure it out, though. This script is worth it.


All times are GMT -5. The time now is 06:57 AM.

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