[DYNRPG] MAIN MENU GAME PLAYTIME CLOCK & BACKGROUND/FOREGROUND OPTIONS

Add a clock & images to the default main menu!

==========================================================================
Main Menu Game Playtime Clock w/Foreground & Background Image Support v4.1
For RPG Maker 2003 with DynRPG v0.13 or higher
By PepsiOtaku
==========================================================================

I'd like to share a plug-in I just finished. This plug-in calculates & displays the time played in the main menu. It does this by identifying the amount (in seconds) the current session has been open (since either starting a new game or loading a save), and adds this amount to the total playtime, then converts the result to a clock format.

I made sure there were no memory leaks or anything, so this plugin should be stable. Let me know if you spot any serious issues!




Installation

To install the plugin, make sure that you have patched your project with cherry's DynRPG patch which
can be found here: http://cherrytree.at/dynrpg

1. Copy the "game_clock.dll"into the DynPlugins folder of your own project.

2. Edit Picture\menu-time_fg.png to match your project's system graphic. This image also doubles as a foreground image, which you can use to further decorate/modify the menu screen. The file can be changed via your DynRPG.ini file.

3. Additionally, this plugin supports adding a background image (placed behind the system window)

4. Add the following (between the asterisks) to your DynRPG.ini
**********************************************


[game_clock]
SessionStart=4003
SessionCurrent=4004
SessionSecs=4005
PlaytimeSecs=4006
PlaytimeHH=4007
PlaytimeMM=4008
PlaytimeSS=4009
RestartTrigger=4010
ForegroundVar=4011
BackgroundVar=4012
ForegroundImage=Picture\menu-time_fg.png
DummyImage=Picture\Pixel.png
BackgroundImage=Picture\Pixel.png
TimeTextDisplay=Time

**********************************************


5. Change the numeric values 4003, 4004 etc to the variables of your choice.

6. Pixel.png is a dummy image used for the text display.

7. TimeTextDisplay is the actual label text displayed in the menu.

8. ForegroundImage is the window image below the time display. You can use this image to alter other aspects of the main menu screen. See below. The image on the right shows the alterations I made.



9. If you would like to add a background, change the value of BackgroundImage to the file of your choice.

Note: The ForegroundImage and BackgroundImage must be no larger than 320x240

Forgot to add this to the readme, but this is an explanation of the variables:

SessionStart - Stores the cpu time the session started (in seconds)
SessionCurrent - Stores the cpu time the session is currently on (in secs)
SessionSecs - Stores the difference (in secs)
PlaytimeSecs - This is your total gameplay time on a particular save. This can only be edited to a specific value by setting the RestartTrigger.
PlaytimeHH - Hour digit (Max is 65535)
PlaytimeMM - Minute digit
PlaytimeSS - Second digit
RestartTrigger - Used to manually set the playtime to a certain time (ie. Setting it to "0" would reset the time to 0)

NEW TO VERSION 4
================
4.1 - Small bugfix with the rect calculations

Nothing visual, but the code is more efficient. onFrame callback no longer loads/unloads the foreground
image every frame.

Added rect calculations for the background image, which should be supported by future versions of DynRPG.
(thanks Cherry!) Save/load menu is unaffected by this.

Version 3
=========
Bugfixes

Version 2
=========
- Fixed BackgroundImage on Save/Load menu

- Added support for variable controlled foreground & background images. Use "ForegroundVar" and
"BackgroundVar" to set the variable ID's youw ill use to control the background images

- "ForegroundImage" and "BackgroundImage" still identify the default images. To define additional images,
make a copy of those with the number you will assign the variables to after the identifier.
Example: If ForegroundVar 4011 is set to "2", the plugin will look for "ForegroundVar2="

**********************************************

ForegroundImage1=Picture\menu-time_fg2.png
BackgroundImage1=Panorama\canyon04.png
BackgroundImage2=Panorama\cyberspacelol.png
BackgroundImage3=Panorama\forest05.png
**********************************************


With this functionality, you can add multiple system sets to your game, and the plugin can still support it

Extra: Extract game_clock_testProject.rar to see a test project with it in action!
Instructions

This plugin is pretty much plug and play, so just load your game, then open the menu! Voila!

Details

  • 1.2 MB
  • 491
  • 11/28/2021 09:24 AM

Actions

Posts

Pages: first 123 next last
Hmmmmm...this could be quite useful for me... That is, if I working on a killer app RPG. :P

Nice work, bud. But I always wondered, "Why couldn't Enterbrain add a timer in the default menu system when they released this game way back then?" I mean, it looks so simple and it would definitely help. Oh well, at least they did in the later versions.
I would love this if I wasn't making a custom menu. Great work though! Rpg2k3 sure has some long legs.
Similar to what Duff Man from the Simpsons once said, "Rm2k3 will never die! OH YEAH!!!"
New version is out. I fixed the save/load screen and successfully added support for multiple foreground/background images (brought up here: http://rpgmaker.net/forums/topics/13382/). See the readme/demo project!
author=PepsiOtaku

images[1]->RPG::Image::drawText(timeOffset, 184, timeTextShow.str(), 0);
// draw the time
images[1]->RPG::Image::drawText(8, 168, configuration["TimeTextDisplay"], 1);
//draw the label text
images[1]->RPG::Image::drawText(26, 184, " : : ", 1);
// draw the ":" characters

Change the "0" or "1" at the end of each line to:

RPG::variables[####]


Where #### is the variable id, so you'd end up with:


images[1]->RPG::Image::drawText(timeOffset, 184, timeTextShow.str(), RPG::variables[0031]); 
// draw the time
images[1]->RPG::Image::drawText(8, 168, configuration["TimeTextDisplay"], RPG::variables[0036]);
//draw the label text
images[1]->RPG::Image::drawText(26, 184, " : : ", RPG::variables[0036]);
// draw the ":" characters

The actual value of the variable must be between 0-19 of course, so the plugin will recognize the color.

You can use this if you wanna make custom text colors.
amazing plugin, see changes in the menu are always welcome
InfectionFiles
the world ends in whatever my makerscore currently is
4370
I really want to use this plugin, definitely going to look into it.

Thanks for this!
Is there a way to make this in Lunar IPS patch format? I downloaded a pack that had them in ips but this one is Hpa isn't it?
No. It requires DynRPG, so you have to patch your game with that first.
Is there a way to set it so that if the time reaches a certain number the game ends?
Yes! You can make use of these variables that were set in your ini:
PlaytimeHH - Hour digit (Max is 65535)
PlaytimeMM - Minute digit
PlaytimeSS - Second digit

So if you wanted the game to end after 2 hours, make a parallel process event that checks if PlaytimeHH is "2" or more. If so, turn on a switch. Make an autostart common event that starts when that switch turns on, and add your game end scenario.
author=PepsiOtaku
Yes! You can make use of these variables that were set in your ini:
PlaytimeHH - Hour digit (Max is 65535)
PlaytimeMM - Minute digit
PlaytimeSS - Second digit

So if you wanted the game to end after 2 hours, make a parallel process event that checks if PlaytimeHH is "2" or more. If so, turn on a switch. Make an autostart common event that starts when that switch turns on, and add your game end scenario.

I kind of want to mention that I screwed up with my project, so I had to restart from the point I had with my backup. DynRPG doesn't work for some reason. With no plugins installed at all, DynRPG screwed with the teleport player command and I can't get the player to change maps. Sorry for my useless question earlier. :(
If you can help me with my DynRPG/teleport problem then I may get DynRPG back in my project so I can use this.
Hmmm, you could post about the issue in the main DynRPG thread here:
http://rpgmaker.net/forums/topics/10254/

If it's a bug with DynRPG itself, Cherry would be able to help you out. On the other hand, it could be an issue with the coding of your events (like a parallel process issue). I have a couple teleport player events that work fine. Do you have a test project or something I could look at?

Edit: Actually, I sometimes get "Subscript out of range (-1)" in my teleport player events. Is that the error you were talking about?
author=PepsiOtaku
Hmmm, you could post about the issue in the main DynRPG thread here:
http://rpgmaker.net/forums/topics/10254/

If it's a bug with DynRPG itself, Cherry would be able to help you out. On the other hand, it could be an issue with the coding of your events (like a parallel process issue). I have a couple teleport player events that work fine. Do you have a test project or something I could look at?

Edit: Actually, I sometimes get "Subscript out of range (-1)" in my teleport player events. Is that the error you were talking about?


No. Teleporting just didn't work. I deleted the project I had with the teleport problem, and without DynRPG in the backup project when I was testing it(sure I also was using no extra stuff like parrallel process events so I will be testing that as well) it worked perfectly. :|
I downloaded this purely for the clock, but I thought the images were an excellent bonus.

One problem though - I can't get the foreground image to work.
The background image is working like a charm, but no matter what I do, it acts as if there's no image selected. I've even tried downloading your example image and pointing it to that, but nothing happens.

Any suggestions?
What do you have in your DynRPG.ini?
Where is the image located & what's the filename?
Is the image a valid 256 color png? If it isn't, you'll get exactly what you described (no error message or anything).

It's gotta be one of those. I just re-downloaded it and tested out the project, and it works fine.
Got it, thanks.

It wasn't a valid image, Too many colours? I just converted it to a 256 colour BMP then back to PNG and it works fine.

Like my name suggests, I'm a bit of a noob :P
Thanks again for the help, and for an awesome plugin :3
Awesome! Glad I could help!
You know, an awesome addition to the fore-/background part would be the ability to change the picture ingame using a comment or something.
Could be very nice to things that are shown per Hero, if I want to show an extra "E" in front of the EXP-number, or do something with the faces, for example.
Is that possible? P:
Yeah, I need to update a lot of my plugins to use comment parameters instead of switches/vars. You can technically do as you asked already, but you have to define all of your images in the ini file first..

(From the OP)
- Added support for variable controlled foreground & background images. Use "ForegroundVar" and
"BackgroundVar" to set the variable ID's youw ill use to control the background images

- "ForegroundImage" and "BackgroundImage" still identify the default images. To define additional images,
make a copy of those with the number you will assign the variables to after the identifier.
Example: If ForegroundVar 4011 is set to "2", the plugin will look for "ForegroundVar2="

**********************************************

ForegroundImage1=Picture\menu-time_fg2.png

BackgroundImage1=Panorama\canyon04.png

BackgroundImage2=Panorama\cyberspacelol.png

BackgroundImage3=Panorama\forest05.png

**********************************************
Pages: first 123 next last