Quote:
Originally Posted by AndromedaKerova
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 :/