A bunch of small questions

Forum
Last Post
Threads / Messages

gwynmil

Member
Member
Joined
Sep 6, 2017
Messages
25
Points
0
Location
UK
Mysidian Dollar
0
I've been tinkering for a few days and am impressed so far. All features are working, the number of mods and tips shared in the community are amazing, and it seems the only errors are caused by me not knowing how to properly edit scripts. But I'm learning quickly :)

Just a few things are currently leaving me stumped. It would be great if more experienced Mysidia users could answer these.

1. Changed the auto-ban to redirect to a warning page, but still curious, do either of these actually stop the action being done (like user pounding another's pet)?

2. The inventory is hideous to scroll down, as my Background item images are huge. I'd like to change the table layout and resize images, but can't find the exact script/page to edit this. Same for the myadopts page, it'd be lovely to rearrange pets into rows of 2 or 3 thumbnails rather than scrolling one by one.

(ah never mind, just found the tables. Looks like they're constructed with PHP rather than HTML. This will be tricky to edit but I'll try. Still not sure how to deal with image sizes though)

3. Where are custom pages stored among the other scripts? /pages/view/whatever. Made a few in the admincp and now can't find them in the file manager.

4. It seems it's not possible to edit the Main or Element themes in the admincp. Anyway, I have another ready to use. Is it safe to delete them? Will the new theme become the default?

5. I'm not very good at "reading" PHP and understanding exactly how some functions work, yet. Half of our breeding system involves mixing colours and I'm supposing hex/rgb are the way to go. Found this function and am wondering if anyone's used it already, or can tell what it will output.

For example rgb 255,255,56 (bright yellow) + 46,88,134 (dark blue) could result in 167,124,101 (murky red-brown) which is technically within the 3 number ranges, but looks very wrong overall. What's needed is for all 3 values to change in the same way, like the gradients on this page.
So it would be great to know if this how the above function also works, before I start fidding with the breeding scripts and possibly mess them up :) (although I'll probably do that anyway)

6. I would like to have small bits of custom CSS on certain pages (only a different body background and a faded illustration in the BG of the main content div). Such as a nest background for all the breeding-related pages, a market background for the shop and trade areas... what's the most sensible way to set that up? Still slightly overwhelmed by the number of scripts/parts making up the site, haha.

Thanks very much for any help! :happyc:
 
Last edited:
1. It stops it, so the other user's pet won't go to the pound if it is attempted.
3. The ACP-made pages are stored in the database (a.k.a phpMyAdmin) under "content"
3.5. To be frank, I 100% prefer creating new pages without the ACP. It's less clunky and adds freedom, so the old way quickly become obsolete. You can read up on it here: link
4. It is safe to delete them, but it is best to have something to fall back on if the new theme doesn't work out. The new theme won't automatically become the new default, you have to set it as such through the ACP under settings->basic settings.
5. Not entirely sure on this one, since I don't know how you would tint/add color to the pet images
6. This can be done with the custom page solution. You can use custom style tags in them as well; just make sure you use them above the php tags!
 
Excellent, thank you again for the answers! :)

I tried poking around with the tables but can't wrap my head around this TableBuilder method. $NameOfTable->setBordered(TRUE/FALSE); why does that work in the daycare table but have no effect in any others? Mysterious stuff.

Guessing it would be alright to remove the default tables and build new ones with echoed HTML and foreach loops, styled with CSS?

About 6. <link rel="stylesheet" type="text/css" href="style.css"> - so you can just add that at the beginning, before the PHP starts, and the contents will overwrite parts of the main site theme? If yes, this should be done on the breeding.php rather than breedingview.php (for one example) page, right?
 
I forgot about the table builder! I would say phase it out, absolutely. I'm in the process of doing that now, and the results are so much better; especially if you use Bootstrap (or Foundation):
5513515346690048.png

This is the method I use for custom tables, and I highly recommend it:
PHP:
public function index(){
	    //header("Location: /myadopts");
	    $mysidia = Registry::get("mysidia");
		$document = $this->document;
	    $document->setTitle($this->lang->title);
	    //tab title
 $document->add(new Comment("<title>Your Pantry</title>"));

        $pagination = $this->getField("pagination");
		$stmt = $this->getField("stmt")->get();
		if($stmt->rowCount() == 0){
		    $document->addLangvar($this->lang->empty);
		    return;
		}
		$shelfSpace = $mysidia->db->select("users", array("shelfspace"), "username = '{$mysidia->user->username}'")->fetchColumn(); 
		$adoptAmount = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' AND health > '0'")->rowCount();
		if($adoptAmount >= 10){
		$mysidia->db->update("users_status", array("fullpantry" => 'unlocked'), "username='{$mysidia->user->username}'");
		}
		$document->add(new Comment("
			<div class='card'>
  			<h2 class='card-header'><center>Pantry Stats</center></h2>
  			<div class='card-body'>
    				<b>Shelf space:</b> {$adoptAmount}/{$shelfSpace} <a href='/expand' class='badge badge-secondary'>+</a>
  			</div>
			</div>"));
	     $document->add(new Comment("<table class='table table-bordered table-dark'>
  <thead>
    <tr>
      <th>Image</th>
      <th>Info</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>", FALSE));
		while($aid = $stmt->fetchColumn()){
		    $adopt = new OwnedAdoptable($aid);
		    $gender_lookup = $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn(); 
		    $type = $adopt->getType();
                   if ($gender_lookup == "m") { $Gender = "Male"; } 
                   if ($gender_lookup == "f") { $Gender = "Female"; }
                   
                   $document->add(new Comment("<tr>
      <td><img src='{$adopt->getImage()}'></td>
      <td><b><em>{$adopt->getName()}</b></em><br></br> Level {$adopt->getCurrentLevel()}<br></br> {$Gender}</td>
      <td><a href='/myadopts/manage/{$aid}' class='btn btn-primary' style='width:200px; height:auto;'>Manage</a></td>
    </tr>", FALSE));
                   } 
		
		$document->add(new Comment("</tbody></table>"));
    }
It can even by applied to messages and stuff:
4668051873333248.png


For #6, I've only ever tried it in the view file, so I don't know. I would try styling with "<style></style>" above the PHP tags first, since I don't know if "link rel" would work; you can try it though.
 
Ooh, your site design is lovely! I'll give that code a try right away, thanks for sharing.

Custom CSS is working, hooray. Style tags had no effect, but it seems extra CSS for certain pages can be done in the admincp.

Properly-custom pages are also so much nicer to design from scratch. Thank you yet again.

Another thing you just made me wonder: what's the default maximum number of adopts a user can have, and where can it be changed? Never seen it mentioned anywhere.
 
There is no limit, I just made one myself. I coded my site so user can only own a certain number of pets at a time, and they have to get an expansion to be able to breed/own more. I can give you the code if you want.
 
That would be very kind of you! Maybe later, though - we have so many bigger features to fix first. Us two admins will probably end up with hundreds of griffs while trying to test breeds, sexes, ages, markings, colours... ah, this is daunting. :ohnoes:

The task perplexing me today: never been able to get backgrounds to appear (based on Abronsynth's mod). Div/table is empty. Also any attempt to add an adopt's image, other than usual $document->add($image);, causes blank page.

But I'm not fond of the current set-up anyway - having separate manage, click and profile pages. It would be great just to have a single page for each griff, with all their info and click/management links, for visitors and owner alike. Something roughly like this image.

Any ideas how to arrange this? Someone in another topic mentioned making petprofile/petprofileview.php. I can probably figure out how to add all the stuff in there, but how to make levelup and the myadopts page link there instead of /manage?

(also it looks like I'm really gonna need help with the breeding/colour scripts, are there any other Mysidia members who've used ImageMagick in this way? Will pay/draw/make 3D stuff/whatever in exchange for help! Getting slightly desperate haha.)
 
Last edited:
I assume you mean the public profile mod: http://www.mysidiaadoptables.com/forum/showthread.php?t=5448
To make myadopts and levelup redirect to there instead, you would have to go into the respective view files and change where the links lead. If you're using my myadopts table code, for example, you would change this:
HTML:
<td><a href='/myadopts/manage/{$aid}' class='btn btn-primary' style='width:200px; height:auto;'>Manage</a></td>
To this:
HTML:
<td><a href='/levelup/publicprofile/{$aid}' class='btn btn-primary' style='width:200px; height:auto;'>Manage</a></td>

I've never been able to get backgrounds to appear with that mod either, but I have been able to show an adopt's image without $document->add($image);. Have you tried this?:
Code:
$document->add(new Comment("<img src='{$adopt->getImage()}'><br>"));

I know Abronsyth's started using ImageMagick, but I think they're using pre-drawn images instead of hex color codes. You can try asking though. I can try and help too, but I don't know how much help I can be since I've never attempted it.
 
Yes, that profile mod. Thanks! Will have a go. And will message Abronsynth about the IM.

Nope, that gives a blank page. Your biography mod wouldn't work either. Perhaps I made a mistake while adding the BG or the profile mods... anyway I suppose neither will be needed any more, with the new profile pages. Ought to remove them.

Need to instead come up with an item that changes the body background-image for these pages. Until one is chosen, a griff's profile sticks with default CSS. This feature would be possible to implement, right? Not too different to what the BG mod did...
 
It should be possible...somehow. I couldn't wrap my head around the google search results, but it is possible to apply PHP variables in css: link
 
Sorry for slow reply. I decided to stick with a large div for the background. Huge body-bg images turned out to be impractical.

Dinocanid, could we hire you to add the breeding/IM stuff for us? I can make a bunch of pre-coloured body parts and markings in case hex/rgb is too difficult right now.
There are also some other mods (existing and not) that would be good to add... but I'd rather focus on the creative side of things for a while, than more code. I seem to break half the scripts I touch, haha.

I saw your thread about coding for payment, and would happily pay you by Paypal. Will need to discuss exact plans with my co-designer first, but either way, you up for some work? :)
 
I'd love some work actually! (Kind of need the money, lol)
I can try to work with hex codes, since it might be possible, but if it doesn't work out than pre-colored parts and markings would be the way to go.
 
Fabulous! ... although we just discovered yesterday that x10hosting free accounts don't allow people to sign in from different countries, meaning my co-designer in the US is kinda screwed, and I guess it blocks you as well.

I'll try to upgrade as soon as possible, then message you with the details of what we need. Sorry for this delay.
 
Was busy for a week, now back to messing around. Gonna try to learn and add some more mods myself, so poor Dino won't be piled with a million random small tasks to do later. x)

Added original owner and birthday (Kyttias' mod). They work fine on griffs' Stats pages, but I can't get them to show up on the temporary profiles (levelupview) amongst the other stats.
{$birthday} - shows nothing
{$this->birthday} - shows nothing
{$adopt->getBirthday()} - causes error
I don't yet understand the difference between all these methods. When is it appropriate to use each one?

edit: nevermind, {$adopt->birthday} was the way to go. D'oh. Also the background mod is mysteriously working now, hooray!

Birth dates seem to be delayed by a few hours. I stayed up til the early hours and made some griffs; they had the previous day. Made another this afternoon and it's the correct date. Is the game using an American time system or something?

Finally, when errors are turned on, holy balls. Every page of the site has this mess at the top, before things load normally. I guess it can be safely ignored again, but it would be quite nice to fix it, so I can see what causes errors elsewhere.
The offending line: if($this->thematicBreak) $this->renderThematicBreak();
edit: removed that line and errors are mostly gone, whew.
 
Last edited:
Was busy for a week, now back to messing around. Gonna try to learn and add some more mods myself, so poor Dino won't be piled with a million random small tasks to do later. x)

Added original owner and birthday (Kyttias' mod). They work fine on griffs' Stats pages, but I can't get them to show up on the temporary profiles (levelupview) amongst the other stats.
{$birthday} - shows nothing
{$this->birthday} - shows nothing
{$adopt->getBirthday()} - causes error
I don't yet understand the difference between all these methods. When is it appropriate to use each one?

Also, birth dates seem to be delayed by a few hours. I stayed up til the early hours and made some griffs; they had the previous day. Made another this afternoon and it's the correct date. Is the game using an American time system or something?

Finally, when errors are turned on, holy balls. Every page of the site has this mess at the top, before things load normally. I guess it can be safely ignored again, but it would be quite nice to fix it, so I can see what causes errors elsewhere.
The offending line: if($this->thematicBreak) $this->renderThematicBreak();
edit: removed that line and errors are mostly gone, whew.
For the birthday variable, there is a difference between those three:
  • {$birthday}: $birthday must be defined within that function. For example
    PHP:
    $birthday = $mysidia->db->select("owned_adoptables", array("birthday"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
    $document->add(new Comment("Birthday: {$birthday}"));
  • {$this->birthday}: In levelupview.php, you wouldn't use $this, you have to use $adopt. So it would be {$adopt->birthday}
  • {$adopt->getBirthday()}: For this, you must set it up in class_ownedadoptable.php like this:
    PHP:
    public $birthday; //add with the other listed variables
    
    public function getBirthday(){
            return $this->birthday;
        }

For the actual dates, I think the server time is set to UTC by default (or EST, not entirely sure) You can change the timezone by sticking this at the top of any script you want though (within the php tags!):
PHP:
date_default_timezone_set('TIMEZONE');
Here's a page on it: link

Now for the errors. This might sound wrong but uh...you can just turn them back off lol. While it is nice to fix them if you can, they actually don't affect the site in any way and can safely be ignored without causing any problems (just like strict standards), plus it saves a lot of headaches. I don't think anyone has found a proper fix for them, since everyone just disables them. I've been working on my site for 3 years, and I just have them turned off without any issues.

(I posted after your edit, but might as well keep this here ^^;)
 
Perfect, thank you for the explanations. I completely forgot about adding more things to that class file, too.

Guessing the time is EST, 5 hours behind me. It's hard to be sure lol (ought to add a timer somewhere). Is there a certain place to set the timezone so it'll affect the whole site at once?

Also, forgot to ask. Using the dynamic image script later, does that mean the Alternate Image feature is redundant, since all the pre-set adopt images will be ignored? Griffs are divided into many breeds, then 2 sexes, then 6 stages for each one (including eggs which should have dynamic colouring and shapes to hint at the contents). I don't think it'll be a problem, pathing to all the right folders.

And working out the breeding system, ahhh. I'm hoping to let most of the breeds intermix, with the chicks having 50% chance of inheriting either breed. Same as all the parents' other traits.
Should this be part of the modified breeding script (have all these common "breeds" actually be a single one, and the different names/images just for show), or can Mysidia handle this by default, using the "create baby/breed adopt" system in some arcane way?
 
I don't know where you would put it to have it affect the whole site. I think I did it once, but I honestly don't know what I did lol. I think I might have stuck it in the index, or class_template...

With the dynamic image script, it would ignore pre-set adopt images (and any related mods to it). Alternate images are still possible by using if statements in the image generation, which is how I have different linearts for pups and adults in Wild Souls.

For the breeding system, mysidia handles that by default with "create breed adopt" (you must have it set to "advanced" and not "heuristic" though), so thankfully something like that will not need a rewrite. It's also possible to directly modify the breeding script for things like marking rarities/probability, etc. Abron's battle mod includes inheriting stats, and it can be modified to include different type traits too.
 
OK, so... I must create lots of "breed adopts", the same breeds over and over, to cover every possible parent combination that can spawn them?
For three test breeds:
BasicGriff - from BasicGriff parent(s)
BasicGriff - from BasicGriff, Minoanish
BasicGriff - from BasicGriff, Heraldish
Minoanish - from Minoanish parent(s)
Minoanish - from Minoanish, BasicGriff
Minoanish - from Minoanish, Heraldish
Heraldish - from Heraldish parent(s)
Heraldish - from Heraldish, BasicGriff
Heraldish - from Heraldish, Minoanish


I guess it's not a problem really (as long as everything is kept track of! These numbers will increase exponentially with more breeds added). Actually the ability to make some cross-outcomes rarer than others is very nice - so it could be incredibly rare to get a Minoanish chick from mixed breedings, compared to pure-breeding.

edit: oh wow, just realised hybrid-breeds are possible then.
GallusPavo x BasicSylph = GallusSylph, GallusBasic, PavoBasic, PavoSylph
GallusPavo x GallusPavo = GallusPavo, Gallus or Pavo (but getting the hybrid would be most likely)
This is amazing. So many detailed opportunities. Wheee!

One last question for tonight. On the breeding page, when parent(s) are selected in the dropdown lists, it would be nice to display their images too. I can imagine how to do this with Javascript and a couple of divs, but PHP and these page structures are new and weird lol. Have you any ideas?
 
Last edited:
My bad, I was thinking of pre-set adopt images, which in that case you would have to do that.

Depending on what method you want, you could do what I do on Wild Souls and have one "adopt species" (in this case, griffin). Then you add columns in the owned_adoptables table to hold the breed information (so base color, markings, breed, sex, level/stage). I don't know how you have your different breeds planned out, but if they have different linearts for certain ones then the dynamic image script can handle that by swapping them depending on the breed. What this means is that you would never have to use the "breed adopts" section of the ACP. This is what my table looks like as an example:
6144994804236288.png


(I made a new custom table, but wid is basically the same as aid. In case you were wondering, "empty" means that there is no marking in that slot, so the script loads a blank PNG image of the same name on that layer.)
Then I modified the breeding script so things like markings and colors can be inherited with some probability. You could also modify it to where certain breeds result in another. In that case the combinations would be hard-coded in, but you wouldn't need to do any repeats and it reduces the busywork.
 
Last edited:
I think I have it all figured out now, thank you. It might be a bit of a chore manually adding 158932685 breeding combinations in the admincp, but being able to create detailed hybrid outcomes is worth it... and anyway, my co-designer should share some of the work. x)

Ooh yes, having "empty" markings with transparent PNGs was exactly what we were thinking of! It's cool to see that someone else has got it working already. So it's not such a crazy idea after all (I have no idea how most breeding games organise their coat layers, it seems to be a well-guarded secret).
And yes, all the different stages' linearts/shading must be stored in the correct folders and layered after the other body parts.

If you don't mind, I'm really curious to see some of your wolves now. :D Dynamic coat combinations are so fun.
 
Last edited:

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top