Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 12-27-2020, 11:21 AM
Micolai's Avatar
Micolai Micolai is offline
Loving Mysidia!
 
Join Date: May 2020
Location: Tennessee
Posts: 130
Gender: Female
Credits: 26,495
Micolai is on a distinguished road
Arrow Time season and calendar changes

Seasons Display

So I wanted to have a little season icon and text that would change based on the calendar, so I managed to get this working.

Quote:
$today = new DateTime();
if(new DateTime() < new DateTime($today->format('Y').'-3-20 00:00:00')) $season = "Winter <img src='https://i.imgur.com/yYgkRTD.png'>";
else if (new DateTime() < new DateTime($today->format('Y').'-6-21 00:00:00')) $season = "Spring ";
else if (new DateTime() < new DateTime($today->format('Y').'-9-22 00:00:00')) $season = "Summer <img src='https://i.imgur.com/NwNeO64.png'>";
else if (new DateTime() < new DateTime($today->format('Y').'-12-20 00:00:00')) $season = "Fall <img src='https://i.imgur.com/vWiRVTe.png'>";
else $season = "Winter <img src='https://i.imgur.com/yYgkRTD.png'>";
$this->moneyBar->add(new Comment("<b id='season'>{$season}</b><br>"));
You can see where I have the little image icons beside my season's text.
I pasted this into the protected function setMoneyBar area of class_sidebar.php file. So my code looks like this:

Quote:
protected function setMoneyBar(){
$mysidia = Registry::get("mysidia");
$this->moneyBar = new Paragraph;

$today = new DateTime();
if(new DateTime() < new DateTime($today->format('Y').'-3-20 00:00:00')) $season = "Winter <img src='https://i.imgur.com/yYgkRTD.png'>";
else if (new DateTime() < new DateTime($today->format('Y').'-6-21 00:00:00')) $season = "Spring ";
else if (new DateTime() < new DateTime($today->format('Y').'-9-22 00:00:00')) $season = "Summer <img src='https://i.imgur.com/NwNeO64.png'>";
else if (new DateTime() < new DateTime($today->format('Y').'-12-20 00:00:00')) $season = "Fall <img src='https://i.imgur.com/vWiRVTe.png'>";
else $season = "Winter <img src='https://i.imgur.com/yYgkRTD.png'>";
$this->moneyBar->add(new Comment("<b id='season'>{$season}</b><br>"));

$this->moneyBar->add(new Comment("You have {$mysidia->user->money} {$mysidia->settings->cost}.<br>"));

$donate = new Link("donate");
$donate->setText("Transfer Freedom Points");
$this->setDivision($this->moneyBar);
}
___________________

Day/Night Cycle

I also wanted to create a code for changing my explore page image map based on day and night. So for this I made a page for my image map area called Map.

So first you need to create the regular php page in your root folder. public_html. You can call it whatever, but I called mine map.php and inside paste this:
Quote:
<?php



class MapController extends AppController{



public function __construct(){

parent::__construct("member");

}

}
and save. Then in your view folder, create a new file called (whatever you pick)view.php. Mine was mapview.php.
Paste this into the view file:
Quote:
<?php

class MapView extends View{



public function index(){

$mysidia = Registry::get("mysidia");

$document = $this->document;

$document->setTitle("<br>The Wild<br><br>");

$h = date('G'); //set variable $h to the hour of the day
//G is the date key for hours in 24 format (not 12), with no leading 0s, like 02.
if ($h < 12) $img = "<img src='https://i.imgur.com/sa78yME.jpg' width='750' usemap='#image-map'>";
else $img = "<img src='https://i.imgur.com/rWiXA8c.jpg' width='750' usemap='#image-map'>";
//
$document->add(new Comment("{$img}<br>"));

}}
Hope this helps anyone! I'll be working at figuring out how to get the time and calendar to work together but right now you'll have to switch the day and night image out for each new season. Once I get it figured out I'll add it.
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion

Last edited by Micolai; 04-19-2021 at 06:29 PM.
Reply With Quote
  #2  
Old 04-19-2021, 07:56 PM
TruaShamu TruaShamu is offline
Member
 
Join Date: Dec 2020
Posts: 2
Gender: Unknown/Other
Credits: 835
TruaShamu is on a distinguished road
Default

This is great! Thanks so much :)
Reply With Quote
  #3  
Old 04-20-2021, 01:53 PM
Micolai's Avatar
Micolai Micolai is offline
Loving Mysidia!
 
Join Date: May 2020
Location: Tennessee
Posts: 130
Gender: Female
Credits: 26,495
Micolai is on a distinguished road
Default

Quote:
Originally Posted by TruaShamu View Post
This is great! Thanks so much :)
No problem! :D
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion
Reply With Quote
Reply

Tags
calendar, hour, season, time

Thread Tools
Display Modes

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


All times are GMT -5. The time now is 04:56 AM.

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