[DYNRPG PLUG-IN] MAIN MENU GAME PLAYTIME CLOCK

Posts

Pages: first 12 next last
Main Menu Game Playtime Clock (version 2)
w/Foreground & Background Image Support

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!



Download!
(source & test project included)

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 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!
This only works with blue menu, in the current setting. I switched it to transparent, and it matches if I have a green or yellow setting (sort of, it matches with the background instead of the foreground, which is unfortunate, but short of another patch just for that, I can't see a way around it).

Anyway, this plugin is pretty snazzy. It told me that my prologue sequence took roughly 1 min 5 secs.
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
I don't have any use for this myself as I don't use rm2k3, but nice work!
author=bulmabriefs144
This only works with blue menu, in the current setting. I switched it to transparent, and it matches if I have a green or yellow setting (sort of, it matches with the background instead of the foreground, which is unfortunate, but short of another patch just for that, I can't see a way around it).

Anyway, this plugin is pretty snazzy. It told me that my prologue sequence took roughly 1 min 5 secs.
If you want to change the blue window image, just edit "Picture\menu-time_fg.png" to whatever you want.

I consider this the foreground because you can draw graphics on top of the menu this way. As I documented above, you can also add a background image. To visualize this:

Top Layer - Time text
Third Layer - Foreground image
Second Layer - Default Menu
First Layer - Background image

This is what you can potentially do with this plugin:

(work in progress)


The window to the left of the face graphics were spaced out a little more, I made the gold and time overlap, and added in the icons with the text of the menu options matted out.
Alrighty, I got it working! My only complaint really is just that I have to start over from the beginning of my game, but hey, not a huge deal.

But I got the thing working at least, which makes me glad, this is a plug in I've been waitin' to have for a long time, so thanks muchly PepsiOtaku. :D

*Putting this on P2R and P5*
I'm honestly not sure whether it's a problem with DynRPG or the plug-in but...

Save files aren't being properly created when I actually save the game. I've been trying to delete all my save files, but... for some reason Save02, 04, and 05 all seem to never appear in the game folder, yet still appear on the save menu. When I load File02 and 04, I get Savexx.dyn in the root folder, which makes sense. But when I save, I don't get Save04.lsd. Nor when I save in File05 do I get Save05.lsd OR Save05.dyn.

I'm just rather confused where the heck the game is getting the call for these save files when they don't exist in the root folder. And if they don't exist there, where DO they exist? ... so I can get rid of them.

As a note, this only started happening AFTER I PnP'd this script...

(not all doom and gloom, though; other than this strangeness, plug-in works GREAT and I'm loving it. ... other than this glitch heh)
That's really weird. This plugin doesn't actually interact with "onSaveGame" at all, so I'm not sure why you're having those problems. What other plugins do you have installed? Try process of elimination by removing plugins one by one.
It's... the only one I have installed. To make sure it worked out - because originally I was using Cherry's old TBB system - I made a back-up of my old RPG_RT.exe and just c+p'd the one from the Clock demo.

... get this, I've been doing a search on my computer to look for the elusive save files and... it's in some strange AppData subfolder called "Virtual Store" or something. It's got a few other folders in there of other programs as well. So it seems the problem is with Windows; sorry. This'll require further research...
Just tested this, and I love how this works. Too bad it can't be used on current files, but oh well. It shouldn't be too big of an issue for those people! I might give the custom menu thing a try, but not too certain on how to handle that. I've never dealt with this kind of thing before. ^^;
I'm actually kind of wondering at this point whether this can be combined with, say, the Text plug-in to put other kinds of text on the menu. I mean, if one can put the time stuff on there, who's to say you can like... set a string in an outside event that corresponds to like the location the player is in and drawing THAT on the main menu?

... actually that's just wishful thinking on my part, though I'm pretty sure it could be done. My programming-fu is woefully weak however, so...

Still! I found out that because of how the foreground is drawn, you can actually use that to make it look like you can only have x amount of party members, since the foreground is over the default menu. Makes for some really neat effects.

Also, I've been having trouble with the background layer thingie. It works for the main menu (iirc), but it ends up displaying OVER the save/load menu. Totally forget if it shows up when one is using items/abilities on the party as well, but I can always check that again.

EDIT: Yep, works great for the main menu. Covers the save/load menu completely, though, especially if you're using a full 320x240 image. And even if you're using just that little section that's usually black on the default menu with a matte around everything else, that bit still shows up OVER the save/load. Any ideas?
trance2: I thought about doing that too, but you can't use the text plugin in the default menus since there's no way to event that. I had to specifically write a drawText command (in dynrpg) for this plugin to show the time.
But I mean like... is it possible to get the string used for drawText FROM the other plug-in? Like... the string used to tell the engine what to display has to be stored somewhere. You'd think you could use a text call to call that string and display it. It's less using the Text plug-in on the menu and more using what you put into the Text and calling that using something else.

I'm honestly not sure exactly how calls work between plug-ins or between a plug-in and the engine (my main programming knowledge is in Java because the College Board sucks, PHP, and mySQL), but... logically it seems like it might work?

Also... any word on why/how the background layer is on top of the save/load menu and/or a way to remedy it? :x
trance2: Yeah I haven't attempted to do anything with storing strings yet. I don't think you can call something directly from another plugin. It has to be called from rpg maker 2003 using the existing dynrpg calls, or from an external file (which would require a separate plugin). There's a number of things you could do. I wouldn't mind seeing the location in the menu either, but the issue would be space. Where could you fit it? :)

Regarding your issue, it sounds like you have your background layer defined as "ForegroundImage=" when it should be "BackgroundImage="

The former is for stuff you want to draw on top of the menu, while the latter is for things you want to draw behind the menu. If you look at my demo project included, the ForegroundImage is just the little blue window for the time. The rest is the transparency color. The BackgroundImage can be a full panorama since it gets drawn behind the menu.
From what I found out, opening a save file that isn't fresh causes the game to freeze and lock up. Therefore, anyone that's got a current save can't use my new patch with this. : S
Well, as for space things... I actually made it so the foreground covers up where a fourth party member would be, since my game only has three max for a battle party. So there's this big empty space under the party window that gave me the idea. As for where to put it otherwise... I'd say above the Time window, but considering if you include ALL the menu options, like in the demo, there's no room... It'd probably take someone wanting to custom do it, rather than being a PnP.

I know it's not set as Foregroundimage because it shows as a background on the main menu. And there's also this:

ForegroundImage=Picture\menu-time_fg.png
DummyImage=Picture\Pixel.png
BackgroundImage=Picture\blocks.png

"blocks.png" is the full panorama. And again, it works WONDERFULLY on the main menu.



But when I go to save the game...



No, that's not me uploading a picture of the panorama. I'd make a gif of it if I could but... .-.

EDIT: Guess I should include what I DID do with the foreground file... Transparencies are pretty sweet for getting this to work well.



@Xenomic: Easy fix for that - go into your game's directory and delete all the files with the extension ".dyn." Should be like "Save01.dyn" and such. No, it won't destroy your save or anything that DynRPG's done to them. It'll just allow the game to reset with the new plug-ins. That crashing thing happened to me as well when I installed a new plug-in, but after I deleted the .dyn files, it worked perfectly (and it created a new .dyn file).
author=Xenomic
From what I found out, opening a save file that isn't fresh causes the game to freeze and lock up. Therefore, anyone that's got a current save can't use my new patch with this. : S

Delete your SaveXX.dyn file for that save. It's some kind of bug, where every time you add a new dynrpg plugin, this happens. I had the same issue & made a little plugin that auto-deletes them on exiting the game since I wasn't using them for anything.

trance2: Those look very nice! The little clock icon is a nice touch. I may need to update the plugin to add an exception for the Save screen. I use a custom save/load menu so I forgot to test that out. For now, disable the background I guess. :/
Ah...nice to know that. I never messed with DynRPG plugins much aside from the very first Conditions plugin (which I never used sadly because I still need more done with it before I can use it). Posted that in the other forums where I posted my update patch. Much obliged for letting me know about that!
Okay, here's what I was trying to get at.



I have four systems.



I want the background over there to stay as background (so the whitemist stays), but I want to have the other match the system file. I'm open to altering the code myself, if you don't wanna. I just kinda dunno how.

Thanks trance, I never knew that (and have been nuking perfectly good saves because of it).
bulma: I added support for this. When I fix the bug below, I'll update this plugin and explain how additional backgrounds/foregrounds works.

author=trance2
But when I go to save the game...


I officially hate this bug. What the fuck was enterbrain thinking when he made the save/load menu this way? The issue I'm trying to workaround at the moment is that the background has to be drawn within the "onBackgroundDrawn" callback, but it doesn't look like the background refreshes between the main menu and the save menu (to my knowledge anyway). I wrote a check to see if the save menu is active, but it doesn't work yet. I'll figure something out though.

edit: Actually, I think I need to resize the background via the RECT parameter in that callback.
New version is done (click the main download link). I fixed the save/load screen and successfully added support for multiple foreground/background images. See the readme/demo project!
Pages: first 12 next last