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 03-20-2013, 05:46 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,384
kristhasirah
Default Edit rarity code for 1.3.2 to the 1.3.3 script

just like the title says, im using the rarity code in my site, and is very useful, because i can hide some eggs from public view and show more some types than others, but i have no idea how i can edit the code to make it compatible with the new script =(

this is the code im using:
Code:
   $adoptform = "<form name='form1' method='post' action='doadopt.php'><h3>Available Adoptables</h3><table width='500' height='130' background='http://pokepony.x10.mx/picuploads/deserty1.png' class='adopt'>";
    $onlyone = 0; 
    $uncommon = rand(1,50);   
    $rare = rand(1,100);   
    $ultrarare = rand(1,200);
    $legendary = rand(1,300);
    $legendary2 = rand(1,250);   

    if ($uncommon==1 && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='11' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }   
    else if ($rare==1 && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='12' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }       
    else if ($ultrarare==1  && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='13' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }  
    else if ($legendary==1  && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
}  
    else if ($legendary2==1  && $onlyone==0){   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='14' ORDER BY RAND() LIMIT 4"; 
$onlyone = 1;   
    }         
    else{   
    $query = "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='10' ORDER BY RAND() LIMIT 4";   
    }   
    $stmt = $mysidia->db->query($query);  
   

    while($row = $stmt->fetchObject()) {
 	  // Call a function to check if we have the proper privledge level to adopt this pet
	  $canadopt = canadopt($aid, "showing", "none", $row); // Feed an adoptable ID and showing, to show the adopt to guests...

	  if($canadopt == "yes"){
			//If we can adopt the adoptable, show the image and adoption link...
			$adoptform .= "<td  width='25%' VALIGN='center'><div align=center><img src='http://www.pokepony.x10.mx/picuploads/png/ee15a8cd09e9cde3a34896e250ece23d.png' /></div></a><br>
   <div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center><strong>{$row->description}</strong></div></td>";
	  }
   } // End the loop  
   
   $adoptform .= "</table><h3>Adopt</h3>
			     <p>Adoptable Name: <input name='name' type='text' id='name' />
			     <p><input type='submit' name='Submit' value='Adopt Me'></p></form>";
   $mysidia->page->addcontent($adoptform);
__________________
Reply With Quote
  #2  
Old 03-27-2013, 04:02 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 332,906
Hall of Famer is on a distinguished road
Default

Well your raw html code should still work with this:

PHP Code:
$document->addLangvar($html);
// or:
$document->add(new Comment($html)); 
Though its more recommended to make use of the GUI package since it is more professional and flexible. One reason is that the form's action(redirect page) can be an issue if you are using relative url.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #3  
Old 03-27-2013, 01:04 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,384
kristhasirah
Default

believe me if i knew how to make use of the GUI package i would use it, but i have 0% of knowledge when it comes to coding, the only thing i can do is make small edits to the codes or add mods and nothing else, i din't make the rarity code, i got it from a post in here... that's why i was asking if there was a way to edit it to make it available for the new script.

and now here comes some questions... where should i add the code? or how should i add it? im kind of lost here =(
__________________
Reply With Quote
  #4  
Old 03-27-2013, 04:29 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 332,906
Hall of Famer is on a distinguished road
Default

Well for this... Change this line below:

PHP Code:
$mysidia->page->addcontent($adoptform); 
to:

PHP Code:
$document->add(new Comment($adoptform)); 
Also change the form action form 'doadopt.php' to 'adopt' since doadopt.php no longer exists.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 03-27-2013, 09:32 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,384
kristhasirah
Default

Thanks for your help HoF, sadly din't manage to make it work, i guess i wont be able to upgrade my site, because my site depends completly in the rarity code
thats the adopt page-> I will wait for 1.4.x version and see if the random generated egg is added to the script, or if someone manage to make something similar to the rarity code for this version
__________________
Reply With Quote
  #6  
Old 04-22-2015, 11:36 AM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,384
kristhasirah
Default

Just to inform... after a year of waiting and a day of being bored, i manage to understand what you told me HoF, now i have the rarity code working for the v1.3.4 ^^
the code dont look pretty... but now i have dancing eggs XD
__________________
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Item 'Rarity' Column Kyttias Questions and Supports 3 11-08-2014 05:51 PM
My art edit solskenn Art Gallery 6 04-03-2012 09:58 PM
Invite Code/Alpha Code Shex Questions and Supports 0 03-07-2011 04:08 AM
Edit No Name ??[Answered] gjac1 Questions and Supports 5 12-03-2009 05:23 AM


All times are GMT -5. The time now is 01:53 AM.

Currently Active Users: 7743 (0 members and 7743 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