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)
-   -   Help with a item function (http://www.mysidiaadoptables.com/forum/showthread.php?t=4663)

AndromedaKerova 11-10-2014 04:20 AM

Is it possible to add a check if the pet is using its alt image and if it IS then make it use an alternative of the skin to match?

If it ISN'T then it alters it to the first defined image.

Same for the reverter. It would need to know if its an alt image so it could revert it back to it.

This is just in case people still want alts as well as skins.

kristhasirah 11-10-2014 07:56 AM

If you want an item to change the adopt to his/her alt version and return back to the normal one, the script already have one function that does that.
But i think is possible to code that opcion... saddly i dont know how code that, the changes i did where based on pure luck and because they where kind of small.

AndromedaKerova 11-10-2014 04:05 PM

I'll see if I can get the basic image alter and the reverter installed and do a bit of fiddling and see if I can get my idea added. If I can, I'll post the revision. ^_^

AndromedaKerova 11-10-2014 06:43 PM

[strike]I have an error with the item. I installed the skin version as directed but when I try and access my items page to use it on my pet, the page appears blank.

I have to manually remove the item using the ACP to be able to get to the inventory page again.[/strike]

*Edit*
Ok, I fixed that issue.

New problem is when I try to use the reverter or the changer on the pet, it now returns this:
The item function is invalid

Happens for both items.

AndromedaKerova 11-10-2014 08:37 PM

I've had a go at making an alternate check + alternate setter from the skin changer but it refuses to work.
Not sure what I did wrong. Still learning this stuff.

PHP Code:

function items_Skin($item$adopt){ 
          
$mysidia Registry:: get("mysidia");  
         
        
$imageurl $adopt->imageurl;
        
$currentLevel $adopt->currentlevel
            
        
//Let's check if the adoptable is using this custom skin.  
        
if($imageurl == "http://yoursite.com/picuploads/png/nameorcodeoftheimage.png") {  
        else if(
$imageurl == "http://yoursite.com/picuploads/png/nameorcodeoftheimageALT.png") {
            
//The adoptable is already using this custom skin 
            
$note "Your adoptable is using this custom skin.";  
        }  
        
//Let's check if the adoptable is below level 10.  
        
else if($currentLevel 10){ 
            
$note "Your adoptable is not at level 10 yet."
        } 
        
//Adoptable has all the requirements, let's update it  
        
else{               
            
$mysidia -> db -> update("owned_adoptables", array("usealternates" => 'no'), "imageurl" => 'http://yoursite.com/picuploads/png/nameorcodeoftheimage.png'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");  
            
$note "Your adoptable {$adopt->name} is now using a new custom skin.";  
        else{               
            
$mysidia -> db -> update("owned_adoptables", array("usealternates" => 'yes'), "imageurl" => 'http://yoursite.com/picuploads/png/nameorcodeoftheimageALT.png'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");  
            
$note "Your adoptable {$adopt->name} is now using a new custom skin.";  
            
//Update item quantity...  
            
$delitem $item->remove();   
        }  
        return 
$note

Thankfully my tests with the reverter have revealed that if the pet was using its alt form, it will return to it. If the pet is not alternate then it returns to that state.

That means it's just the actual skin changer that needs fiddling with to make work. \0/

IntoRain 11-10-2014 09:07 PM

Quote:

Originally Posted by AndromedaKerova (Post 31514)
I've had a go at making an alternate check + alternate setter from the skin changer but it refuses to work.
Not sure what I did wrong. Still learning this stuff.

PHP Code:

function items_Skin($item$adopt){ 
          
$mysidia Registry:: get("mysidia");  
         
        
$imageurl $adopt->imageurl;
        
$currentLevel $adopt->currentlevel
            
        
//Let's check if the adoptable is using this custom skin.  
        
if($imageurl == "http://yoursite.com/picuploads/png/nameorcodeoftheimage.png") {  
        else if(
$imageurl == "http://yoursite.com/picuploads/png/nameorcodeoftheimageALT.png") {
            
//The adoptable is already using this custom skin 
            
$note "Your adoptable is using this custom skin.";  
        }  
        
//Let's check if the adoptable is below level 10.  
        
else if($currentLevel 10){ 
            
$note "Your adoptable is not at level 10 yet."
        } 
        
//Adoptable has all the requirements, let's update it  
        
else{               
            
$mysidia -> db -> update("owned_adoptables", array("usealternates" => 'no'), "imageurl" => 'http://yoursite.com/picuploads/png/nameorcodeoftheimage.png'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");  
            
$note "Your adoptable {$adopt->name} is now using a new custom skin.";  
        else{               
            
$mysidia -> db -> update("owned_adoptables", array("usealternates" => 'yes'), "imageurl" => 'http://yoursite.com/picuploads/png/nameorcodeoftheimageALT.png'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");  
            
$note "Your adoptable {$adopt->name} is now using a new custom skin.";  
            
//Update item quantity...  
            
$delitem $item->remove();   
        }  
        return 
$note

Thankfully my tests with the reverter have revealed that if the pet was using its alt form, it will return to it. If the pet is not alternate then it returns to that state.

That means it's just the actual skin changer that needs fiddling with to make work. \0/

I don't think your if's/else's and brackets are closing well. For example you have this else-if

PHP Code:

 else-if($imageurl == "http://yoursite.com/picuploads/png/nameorcodeoftheimageALT.png") {
                
//The adoptable is already using this custom skin 
                
$note "Your adoptable is using this custom skin.";  
            } 

inside this if

PHP Code:

 if($imageurl == "http://yoursite.com/picuploads/png/nameorcodeoftheimage.png") { 

which is not making sense because if it passes the first if for the normal image you already know what imageurl is and it is not the ALT image for sure. You also have an else without closing it

Sorry, I'm not sure what you want to do yet, so I can't help more than this :/

AndromedaKerova 11-10-2014 09:22 PM

I'm only a beginner with coding. My aim is to expand on the skin changer. To make it ask if the pet is using an alt image and if it is, instead of painting the regular, it would paint an alternative of the custom skin to match better with the original.

Without that, it makes the alt pet just look like every other pet that has this item used on it. Seems to lose its altness while the database keeps the value.

Examples:
BEFORE
AFTER

Rhiadra is the one using the alt image but after painting it appears not to be.

Next thing I want to attempt is making it check if the pet is male or male/alt then make it set respective images for them too.

IntoRain 11-10-2014 09:54 PM

So if it's using an alt image, it uses another alt image? And if it's using the common image, use the alt image?

AndromedaKerova 11-10-2014 09:57 PM

The way it works currently is it paints a certain species the new image. It overrides the alt image though the data is still in the DB for the alt pet. I want the image to set a second if the pet is an alt so it "looks" like its still an alt.

Obviously regular users would no longer know if the pet is alt or not in the current way.

parayna 12-11-2014 08:42 AM

Hmm, that's true ... would be cool if that was somehow included ^_^


All times are GMT -5. The time now is 10:59 PM.

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