Reading Adoptable Level as Integer

Forum
Last Post
Threads / Messages

dlithehil

Member
Member
Joined
Jun 10, 2022
Messages
92
Points
18
Location
USA
Mysidian Dollar
789
Heyo... again.... I'm working on my encyclopedia entries and I want certain things to pop up only when a player has a pet of a certain level anywhere in their adopts, rather than just as their favpet.
Here's my code for the entire sub-page. I have no clue how to get it to read as an integer so I can use >= rather than just =

PHP:
public function starpus(){
        $mysidia = Registry::get("mysidia");
        $document = $this->document;
        
        $document->setTitle("Starpus");
        
        //Counts some stuff
        $species = "2";
        $count = $mysidia->db->select("owned_adoptables", array(), "adopt='{$species}'")->rowCount();
        $user = $mysidia->user->getID();
        
        //Page Starts Here
        $document->add(new Comment("
        <table><tr><th>Basic Information</th></tr></table>
        <table><tr><td>
            <b>Species:</b> Starpus<br><br>
            <b>Size:</b> Approx. 2ft Diameter<br><br>
            <b>Description:</b> Insert Description Here<br><br>
            <b>Amount In-Game:</b> {$count}
        </td>
        <td><img src='https://f2.toyhou.se/file/f2-toyhou-se/images/100376467_LeICloAtzZgPvfw.png' alt='Starpus egg'>
        </td></tr></table>"));
        
        $document->add(new Comment("<table><tr><th>Observations</th></tr></table>"));
        $document->add(new Comment("<table><tr>"));
        
        //Level Requirements
        $starone = $mysidia->db->select("owned_adoptables", array(), "owner='{$user}' && adopt='2' && currentlevel >='1'")->rowCount();
        
        //Lore
        if($starone != 0){
            document->add(new Comment("lore here"));
        
        //If Starpus is not at least level 2.
        }else{document->add(new Comment("There are no observations yet..."));}
        
        $document->add(new Comment("</tr></table>"));
        
        //Back
        $document->add(new Comment("<a href='/encyclopedia'>Back to Library</a>"));
    }

You can safely ignore the elseifs and $starpus3/5 because they're commented out and such until i can get $starone working...
Edit: I just took out the elseifs and $starpus3/5 because they were making the code a little clunky. They're still on my site but like...
Edit 2: I should really put the whole page code... so I did.
 
Last edited:
... I forgot the $ in front of $document............
Time to see if the level thingy works.

Update: it does. So you can ignore this but if anyone wants to use it as a template, there ya go!
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,314
Messages
33,326
Members
1,612
Latest member
BubbaSawyerIsACutie
BETA

Latest Posts

Top