DYNRPG - FLOW OF TIME
Create and manipulate the flow of time using DynRPG plugins.
Link_2112- 08/12/2012 09:51 PM
Here is what it looks like in action
Download the demo project
Note: I wrote this tutorial out and then made changes to the system. It has gone through several revisions and I combed over it to ensure it's all correct. If there is anything that doesn't work, not explained, or if you see something explained that isn't part of the coding please let me know.
If you find something hard to read or if it's hard to follow, let me know.
Step 1 - Making your project Dyn-o-mite
Before you can start using plugins you need to infuse your project with the awesome power of DynRPG.Find the 5 God Medallions and ascend to the top of Mount OlympiaGo to Cherry's website and download it.
http://rpg-maker.cherrytree.at/dynrpg/
Make a backup to be safe and patch your project's RPG_RT.exe. This will create a folder in your project called "DynPlugins". You store the plugin files in this folder. Don't use subfolders in there.
You can find most of the existing plugins on Cherry's site, but a few seem to be only found in the RMN forums.
http://cherrytree.at/cms/lang/en/download/?category=8
For this tutorial you only need the Date & Time plugin, but to make it easier to display the time I will be using the Text plugin by Kazesui.
http://rpgmaker.net/forums/topics/11004/
When you extract those files you will usually find a demo project folder, a folder with the source code, and the files needed for the plugin. Find the plugin files and put them directly into your projects DynPlugins folder. If you don't know what files are needed, take a look in the demo project DynPlugins folder. There should always be a readme file included with the download that will give all the requirements and explain the commands.
Most plugins will consist of only a single .dll file, like with the Date/Time plugin. The Text plugin is also a single .dll file but it requires one extra step. Look in your projects root folder and you will find a file called DynRPG.ini. Open it and add the following lines:
The plugin works by treating the text like a picture, so you have to assign it a number. I use a high number because if it's a low number other pictures will appear on top of it. Other pictures, for the HUD display, will need to appear behind it.
A built in feature of DynRPG is the ability to use up to 2000 pictures. I'm not sure if the editor will allow you to set it that high, so you may need to use a hack or Cherry's Ultimate RPGmaker. I use Ultimate for this and so many other reasons, you should too if your PC will run it. It doesn't matter what the number is, use 1 or 50 if you want.
Now that you've done all the preparations your DynPlugin folder and DynRPG.ini should include the following:
Now open your project and let's set up the events.
Step 2 - Become familiar with your new power
The first step is to understand what commands are now available thanks to the plugins and how to use them.
Using them is simple. In the editor, use the Insert Comment command and type in the DynPlugin command. I will refer to them as "comment commands" from now on. When the event is triggered, the comment command will execute.
With RPGmaker when you include a comment in an event, even though nothing visual happens the game still processes that line of code with the comment on it. So now, instead of doing nothing it will do something! Genius! That is how all DynRPG plugins work.
------------------------------
Here are a few important commands as written in the readme files.
Date & Time plugin
A Timestamp in this case is similar to what is called Unix time. It is the number of seconds that have passed since January 1, 1970. I've noticed that when a Timestamp is 0 it gives a date of December 31, 1969. Wikipedia says Unix time doesn't count leap seconds, so maybe that can account for the difference.
Heh, either way Timestamp is important because a single number can determine the Seconds, Minutes, Hours, Day of the week, Day of the year, Month/Day, and Year.
This command checks your PC's calander to give the current date.
This command checks your PC's clock to give the current time.
This commands looks at a Timestamp, which can be a variable, and determines what the date would be.
This command looks at a Timestamp and determines what the time would be.
This command allows you to choose a date, you can use variables, and determines what the Timestamp number would be.
This command is the same as above but with the time information included.
Note: There are commands to get a specific piece of information, such as minutes only as opposed to getting seconds and hours along with it.
Text plugin
This command will display text on the screen. Using this command alone will do nothing. I has to be followed by a show picture command of whatever number you picked in the DynRPG.ini file. For this example it would be Show Picture 1000.
This command will rewrite text in place of the the previous written text.
IMPORTANT: If you decide to skip any optional parameters, close the comamnd with ", end". Basically use the word end as a replacement for the missing parameter. There is a glitch that can cause extra characters to be written on the screen when the command is left open ended.
Once you write text, it will just sit there. If you put another write command after the first, nothing will happen. It is already written. You can delete it and write it again, but it makes more sense to use this change text command.
This command will erase one piece of text.
There are another commands that I didn't list here. One common aspect of this plugin is that you give a label to a piece of text. It is used, like "Clock" below, to tell the command which piece of text to alter.
Since I am using this plugin to show the time using a clock, here is a brief overview of how it works:
Step 1 - Happens once
Draw "Clock" as hours:minutes
Step 2 - Repeats
Change "Clock" to hours:minutes
Step 3 - Happens once
Erase "Clock"
Another event is moving time forward so every second after you write the time, it has changed. So the clock event constantly rewrites the new time in the same spot. You can show and hide the clock at any time.
Step 3 - Create the flow of time
The basis of this tutorial is the Timestamp. All hail the mighty Timestamp!
It is the one thing that changes which determines what all the other outputs are. Every system is designed to manipulate the Timestamp, which in essence manipulates time, and then outputs each bit of information to variables that are displayed directly on screen using text. And it's all done automatically by the plugins.
This avoids the need to create a series of variable operations and conditional branches to determine the day, month, and year. It also means that you don't have to setup up those tedious systems to show the number of a variable on screen using pictures *shudder* so much effort.
First assign a few switches and variables. These are the names I used, call them whatever and place them where ever. I use caps sometimes when naming switches and variables. It helps important ones stand out.
Switches
Variables
If you want a system to use Real time, make another set of these variable. I would recommend putting it in even if you don't have an immediate use for it, there are some neat things you can do with it.
Now, we can start adding seconds to the Timestamp to simulate the flow of time. Essentially it's a common event adding 1 to the Timestamp variable with a wait of 1.0 seconds. For every 1 second of real time~(it's not exact) the Timestamp, or Game time, goes up by 1 second.
Make a common event and call it "THE FLOW OF TIME". It's a parallel process with the switch "THE FLOW OF TIME" as the trigger. This is what goes in it:
Before time can be added to the Timestamp, this event checks how fast time is moving. This is managed by the Speed Factor variable. THE SPEED OF TIME is the actual amount that gets added to the Timestamp. So in the game the player would have access to change the Speed Factor, and depending on that value this event will know how much to add to the Timestamp.
Speed Factor
0 - Time is standing still. This can also be achieved by turning off the switch THE FLOW OF TIME.
1 - Game time is flowing at the same rate as Real time.
2 - Game time is flowing twice as fast as Real time.
3 - Game time is flowing 4 times as fast as Real time.
4 - Game time is flowing 10 times as fast as Real time.
5 - Game time is flowing 60 times as fast as Real time.
These are fairly standard rates of speed, you can change them to whatever you'd like. You can make more increments by adding a branch for Speed Factor at 6, 7, 8... and changing the value of THE SPEED OF TIME in that branch. Leave the highest number branch with the "greater than or equal to" condition, with the middle numbers being "equal to".
Note: If you use high numbers, try and use ones that are divisible by 60. If THE SPEED OF TIME is 50 the game clock appears to increase 1 minute per second. Except that every 5 seconds there is a delay. Making the speed 60 fixes this.
Once THE SPEED OF TIME is determined, it gets added to the Game Timestamp variable. This is how time moves forward. The event waits 1 second and repeats into infinity, or it would if the game didn't crash when the Timestamp reached the gazillionith second. It collapses in on itself xD I tested it out and discovered that this happens after about 70 years. It can be remedied by offsetting everything. So after 70 years revert the timestamp back to 0 and add 70 years when the date is being shown(because it will think it's 1970 again).
IMPORTANT: I would suggest not giving the player the ability to travel too fast through time or you will significantly reduce the life of the Game universe. You can start offsetting it, but it likely to cause some problems.
The comment commands after the wait are to ensure that the game always has the updated date and time from your PC.
The variable commands after that will make it display year 1, instead of 1969.
Step 4 - Do you have the time?
Ok, we managed to flow some time. Now to make use of it. Let's start by creating a clock to display the time.
The first step is to extract the Game time from the Game Timestamp using this comment command:
@GetTimeFromTimestamp Timestamp, VariableID(Hour), VariableID(Minute), VariableID(Second)
Let's fill in the blanks:
@GetTimeFromTimestamp v1, 4, 3, 2
v1 is variable 1. It's saying that the Timestamp is in variable 1. The hour gets written into variable 4, minutes in 3, and seconds in 2. Any time you set multiple parameters in any DynRPG comment command, you need to separate them with a comma followed by a space. If you missed a space and put in 3,2 it might not recognize the 2, but 3 will still work.
Now to use the Text plugin comment commands to display that on screen. Start with this command:
@write_text
parameter#1: identifier tag for the text
parameter#2: x coordinate of the text
parameter#3: y coordinate of the text
parameter#4: text to be shown in the text
parameter#5: (optional) "fixed" is typed here if text moves with map
parameter#6: (optional) Color to be used on the text
parameter#7: (optional) Set picture id to be associated with
Let's fill in the blanks:
I find that if you don't assign a color in every command, it will change colors on you. So it's best to put it every time you can. I didn't set a picture ID in this example because it's the first one and is automatically assigned to picture ID 1000 as determined from DynRPG.ini. If I add more text I might want to assign it a new ID so I can manipulate it without affecting other text. I use ", end" to avoid the glitch because I am skipping an optional parameter.
This will draw the values of hour and minutes in the format of a clock somewhere near the bottom right corner of the screen. The switch "Clock is showing" is turned on at this point.
Next it needs to repeat to make sure the time that is showing is current. There is a separate common event for showing the clock that uses the 'Clock is showing' switch as a trigger. Inside this common event is a parallel process that is always using the change_text comment command. It looks like this:
The pieces are all the same. This will overwrite the old variable values with the new ones. I add the 1 on the end to make sure it remains the same color.
There is an issue with displaying the time this way. When the minutes are less than 10, it shows like this "4:5" instead of "4:05". This happens with any kind of time system setup like this. The way to fix it is to add a 0 when minutes are less than 10. A simple conditional branch can fix this, you can see it in the pictures below.
To hide the clock the erase_text comment command is used.
That's a step-by-step analysis of the whole thing. Here is what I came up with as a final setup.
Note: The variable numbers in the images will vary slightly from the examples given in this tutorial. They will be the variable numbers you will see in the demo project.
The first switch, W, is merely the trigger. It can be replaced with the usual Key Input Process followed by a conditional branch checking that variable.
When W is pressed on the keyboard the clock will show. When W is pressed again the clock will hide. I used another DynRPG plugin to gain access to every key on the keyboard. I also have a picture, HUD - Clock, that shows behind the clock. In this case it shows off-screen then moves up into view.
There is a branch that checks for army time. Converting safely from army time requires a copy of the time because after you manipulate the main value, it gets rewritten as army time after 1 second.
All the branches in the middle are needed for the numbers to display in the right spot. If the first number was a single digit it would show slightly to the left of the correct spot. And when the minutes are less than 10 it needs to add a 0.
The first branch converts it from Army time to...not Army time.
Then the branches for positioning the numbers.
This is mostly the same with references to Game and Real time reversed.
I can't remember why but this event doesn't need the Call AM/PM event, yet it still works :/
This event was required for the process of switching between the Game clock and the Real clock. There is a parallel process that checks when you press Q, when you do it runs this event. It's pretty much the code from the Show Clock event with an erase command at the start.
It erases the current "Clock" and writes the other kind of "Clock" text again. Currently the only thing repeating is the command to change_text, which doesn't work unless the text is written. Thus, the need for this event arose. It was my solution but I'm sure this whole thing could be written slightly different and it wouldn't need that. Whatever! This works.
This event checks if army time is supposed to be displayed. If not, then it will show a picture for either AM or PM.
You only need to change this code to change how AM/PM is displayed. The placement of all the code ensures that this is checked after the time is updated but before the conversion to army time.
This is an event I created so that I could get all the date/time information from the Game Timestamp in one Call Event command. I also created several other events that grab specific bit of information from the Timestamp that can be called on any time, instead of always writing out the comment commands.
This is the event that will allow you to activate these features. In my game this one event will oversee all buttons. I organize it by putting only Call Events in these branches.
Again it's the DynPlugin which allows me to use Q, W, and E as buttons. If you aren't using the plugin you would put a Key Inputting command and matching conditional branch.
The Call event "Toggle Army time" has only a switch toggle.
I made it a call event because that's how I usually do these kinds of things and in the future it would be easier to add things to that command. You could always just replace the Calling of Toggle Army time with the single Switch Operation.
Step 5 - What now?
Hopefully you have been able to set the flow of time and create the clock to show it. So what can be done with it now?
Lots of cool stuff!
I only just created this system recently so I'm still finding ways to use it myself. One I'm working on now is farming. I have a good start on it, I have things growing in cycles. They can be harvested when fully grown. It's pretty boring to sit there and watch them grow, but crank up the Speed Factor and what would have taken minutes before only takes seconds. Expect a tutorial on that and any other systems I create.
This all leads to:
I am also experiementing with all the other DynRPG plugins so you can expect to see more DynRPG tutorials soon.
Download the demo project
Note: I wrote this tutorial out and then made changes to the system. It has gone through several revisions and I combed over it to ensure it's all correct. If there is anything that doesn't work, not explained, or if you see something explained that isn't part of the coding please let me know.
If you find something hard to read or if it's hard to follow, let me know.
Step 1 - Making your project Dyn-o-mite
Before you can start using plugins you need to infuse your project with the awesome power of DynRPG.
http://rpg-maker.cherrytree.at/dynrpg/
Make a backup to be safe and patch your project's RPG_RT.exe. This will create a folder in your project called "DynPlugins". You store the plugin files in this folder. Don't use subfolders in there.
You can find most of the existing plugins on Cherry's site, but a few seem to be only found in the RMN forums.
http://cherrytree.at/cms/lang/en/download/?category=8
For this tutorial you only need the Date & Time plugin, but to make it easier to display the time I will be using the Text plugin by Kazesui.
http://rpgmaker.net/forums/topics/11004/
When you extract those files you will usually find a demo project folder, a folder with the source code, and the files needed for the plugin. Find the plugin files and put them directly into your projects DynPlugins folder. If you don't know what files are needed, take a look in the demo project DynPlugins folder. There should always be a readme file included with the download that will give all the requirements and explain the commands.
Most plugins will consist of only a single .dll file, like with the Date/Time plugin. The Text plugin is also a single .dll file but it requires one extra step. Look in your projects root folder and you will find a file called DynRPG.ini. Open it and add the following lines:
[DynTextPlugin]
PictureID=1000
The plugin works by treating the text like a picture, so you have to assign it a number. I use a high number because if it's a low number other pictures will appear on top of it. Other pictures, for the HUD display, will need to appear behind it.
A built in feature of DynRPG is the ability to use up to 2000 pictures. I'm not sure if the editor will allow you to set it that high, so you may need to use a hack or Cherry's Ultimate RPGmaker. I use Ultimate for this and so many other reasons, you should too if your PC will run it. It doesn't matter what the number is, use 1 or 50 if you want.
Now that you've done all the preparations your DynPlugin folder and DynRPG.ini should include the following:

Now open your project and let's set up the events.
Step 2 - Become familiar with your new power
The first step is to understand what commands are now available thanks to the plugins and how to use them.
Using them is simple. In the editor, use the Insert Comment command and type in the DynPlugin command. I will refer to them as "comment commands" from now on. When the event is triggered, the comment command will execute.
With RPGmaker when you include a comment in an event, even though nothing visual happens the game still processes that line of code with the comment on it. So now, instead of doing nothing it will do something! Genius! That is how all DynRPG plugins work.
------------------------------
Here are a few important commands as written in the readme files.
Date & Time plugin
@GetTimestamp VariableID
------------------------
Writes the current timestamp into the variable with the given ID.
A Timestamp in this case is similar to what is called Unix time. It is the number of seconds that have passed since January 1, 1970. I've noticed that when a Timestamp is 0 it gives a date of December 31, 1969. Wikipedia says Unix time doesn't count leap seconds, so maybe that can account for the difference.
Heh, either way Timestamp is important because a single number can determine the Seconds, Minutes, Hours, Day of the week, Day of the year, Month/Day, and Year.
@GetDate VariableID(Month), VariableID(Day), VariableID(Year)
-------------------------------------------------------------
Writes the current date into the variables with the given IDs.
This command checks your PC's calander to give the current date.
@GetTime VariableID(Hour), VariableID(Minute), VariableID(Second)
--------------------------------------------------------------------
Writes the current time into the variables with the given IDs.
This command checks your PC's clock to give the current time.
@GetDateFromTimestamp Timestamp, VariableID(Month), VariableID(Day), VariableID(Year)
-------------------------------------------------------------------------------------
Writes the date of the given timestamp into the variables with the given IDs.
This commands looks at a Timestamp, which can be a variable, and determines what the date would be.
@GetTimeFromTimestamp Timestamp, VariableID(Hour), VariableID(Minute), VariableID(Second)
-----------------------------------------------------------------------------------------
Writes the date if the given Timestamp into the variables with the given IDs.
This command looks at a Timestamp and determines what the time would be.
@GetTimestampFromDate Month, Day, Year, VariableID(Timestamp)
-------------------------------------------------------------
Writes the timestamp of the given date into the variable with the given ID.
This command allows you to choose a date, you can use variables, and determines what the Timestamp number would be.
@GetTimestampFromDate Month, Day, Year, Hour, Minute, Second, VariableID(Timestamp)
-----------------------------------------------------------------------------------
Overloaded version of GetTimestampFromDate with time.
This command is the same as above but with the time information included.
Note: There are commands to get a specific piece of information, such as minutes only as opposed to getting seconds and hours along with it.
Text plugin
@write_text
parameter#1: identifier tag for the text
parameter#2: x coordinate of the text
parameter#3: y coordinate of the text
parameter#4: text to be shown in the text
parameter#5: (optional) "fixed" is typed here if text moves with map
parameter#6: (optional) Color to be used on the text
parameter#7: (optional) Set picture id to be associated with
This command will display text on the screen. Using this command alone will do nothing. I has to be followed by a show picture command of whatever number you picked in the DynRPG.ini file. For this example it would be Show Picture 1000.
@change_text
parameter#1: identifier tag for text to change
parameter#2: content of new text
parameter#3: color to be used in the text
This command will rewrite text in place of the the previous written text.
IMPORTANT: If you decide to skip any optional parameters, close the comamnd with ", end". Basically use the word end as a replacement for the missing parameter. There is a glitch that can cause extra characters to be written on the screen when the command is left open ended.
Once you write text, it will just sit there. If you put another write command after the first, nothing will happen. It is already written. You can delete it and write it again, but it makes more sense to use this change text command.
@remove_text
parameter#1: identifier tag for text to remove
parameter#2: "end" (i.e. just write anything here)
This command will erase one piece of text.
There are another commands that I didn't list here. One common aspect of this plugin is that you give a label to a piece of text. It is used, like "Clock" below, to tell the command which piece of text to alter.
Since I am using this plugin to show the time using a clock, here is a brief overview of how it works:
Step 1 - Happens once
Draw "Clock" as hours:minutes
Step 2 - Repeats
Change "Clock" to hours:minutes
Step 3 - Happens once
Erase "Clock"
Another event is moving time forward so every second after you write the time, it has changed. So the clock event constantly rewrites the new time in the same spot. You can show and hide the clock at any time.
Step 3 - Create the flow of time
The basis of this tutorial is the Timestamp. All hail the mighty Timestamp!
It is the one thing that changes which determines what all the other outputs are. Every system is designed to manipulate the Timestamp, which in essence manipulates time, and then outputs each bit of information to variables that are displayed directly on screen using text. And it's all done automatically by the plugins.
This avoids the need to create a series of variable operations and conditional branches to determine the day, month, and year. It also means that you don't have to setup up those tedious systems to show the number of a variable on screen using pictures *shudder* so much effort.
First assign a few switches and variables. These are the names I used, call them whatever and place them where ever. I use caps sometimes when naming switches and variables. It helps important ones stand out.
Switches
- THE FLOW OF TIME
- Clock is showing
Variables
- THE SPEED OF TIME
- Speed Factor
- Show which clock? (optional, used for an option to display Game time or Real time)
- Game - Timestamp
- Game - Seconds (optional, I chose not to use or display Game seconds)
- Game - Minutes
- Game - Hour
- Game - Day
- Game - Month
- Game - Year
- Game - Day of the week
- Game - Day of the year
If you want a system to use Real time, make another set of these variable. I would recommend putting it in even if you don't have an immediate use for it, there are some neat things you can do with it.
- Real - Timestamp
- Real - Seconds
- Real - Minutes
- Real - Hour
- Real - Day
- Real - Month
- Real - Year
- Real - Day of the week
- Real - Day of the year
Now, we can start adding seconds to the Timestamp to simulate the flow of time. Essentially it's a common event adding 1 to the Timestamp variable with a wait of 1.0 seconds. For every 1 second of real time~(it's not exact) the Timestamp, or Game time, goes up by 1 second.
Make a common event and call it "THE FLOW OF TIME". It's a parallel process with the switch "THE FLOW OF TIME" as the trigger. This is what goes in it:

Before time can be added to the Timestamp, this event checks how fast time is moving. This is managed by the Speed Factor variable. THE SPEED OF TIME is the actual amount that gets added to the Timestamp. So in the game the player would have access to change the Speed Factor, and depending on that value this event will know how much to add to the Timestamp.
Speed Factor
0 - Time is standing still. This can also be achieved by turning off the switch THE FLOW OF TIME.
1 - Game time is flowing at the same rate as Real time.
2 - Game time is flowing twice as fast as Real time.
3 - Game time is flowing 4 times as fast as Real time.
4 - Game time is flowing 10 times as fast as Real time.
5 - Game time is flowing 60 times as fast as Real time.
These are fairly standard rates of speed, you can change them to whatever you'd like. You can make more increments by adding a branch for Speed Factor at 6, 7, 8... and changing the value of THE SPEED OF TIME in that branch. Leave the highest number branch with the "greater than or equal to" condition, with the middle numbers being "equal to".
Note: If you use high numbers, try and use ones that are divisible by 60. If THE SPEED OF TIME is 50 the game clock appears to increase 1 minute per second. Except that every 5 seconds there is a delay. Making the speed 60 fixes this.
Once THE SPEED OF TIME is determined, it gets added to the Game Timestamp variable. This is how time moves forward. The event waits 1 second and repeats into infinity, or it would if the game didn't crash when the Timestamp reached the gazillionith second. It collapses in on itself xD I tested it out and discovered that this happens after about 70 years. It can be remedied by offsetting everything. So after 70 years revert the timestamp back to 0 and add 70 years when the date is being shown(because it will think it's 1970 again).
IMPORTANT: I would suggest not giving the player the ability to travel too fast through time or you will significantly reduce the life of the Game universe. You can start offsetting it, but it likely to cause some problems.
The comment commands after the wait are to ensure that the game always has the updated date and time from your PC.
The variable commands after that will make it display year 1, instead of 1969.
Step 4 - Do you have the time?
Ok, we managed to flow some time. Now to make use of it. Let's start by creating a clock to display the time.
The first step is to extract the Game time from the Game Timestamp using this comment command:
@GetTimeFromTimestamp Timestamp, VariableID(Hour), VariableID(Minute), VariableID(Second)
Let's fill in the blanks:
@GetTimeFromTimestamp v1, 4, 3, 2
v1 is variable 1. It's saying that the Timestamp is in variable 1. The hour gets written into variable 4, minutes in 3, and seconds in 2. Any time you set multiple parameters in any DynRPG comment command, you need to separate them with a comma followed by a space. If you missed a space and put in 3,2 it might not recognize the 2, but 3 will still work.
Now to use the Text plugin comment commands to display that on screen. Start with this command:
@write_text
parameter#1: identifier tag for the text
parameter#2: x coordinate of the text
parameter#3: y coordinate of the text
parameter#4: text to be shown in the text
parameter#5: (optional) "fixed" is typed here if text moves with map
parameter#6: (optional) Color to be used on the text
parameter#7: (optional) Set picture id to be associated with
Let's fill in the blanks:
@write_text "Clock", 280, 220, "\v[4]:\v[3]", fixed, 1, end
I find that if you don't assign a color in every command, it will change colors on you. So it's best to put it every time you can. I didn't set a picture ID in this example because it's the first one and is automatically assigned to picture ID 1000 as determined from DynRPG.ini. If I add more text I might want to assign it a new ID so I can manipulate it without affecting other text. I use ", end" to avoid the glitch because I am skipping an optional parameter.
This will draw the values of hour and minutes in the format of a clock somewhere near the bottom right corner of the screen. The switch "Clock is showing" is turned on at this point.
Next it needs to repeat to make sure the time that is showing is current. There is a separate common event for showing the clock that uses the 'Clock is showing' switch as a trigger. Inside this common event is a parallel process that is always using the change_text comment command. It looks like this:
@change_text "Clock", "\v[4]:\v[3]", 1
The pieces are all the same. This will overwrite the old variable values with the new ones. I add the 1 on the end to make sure it remains the same color.
There is an issue with displaying the time this way. When the minutes are less than 10, it shows like this "4:5" instead of "4:05". This happens with any kind of time system setup like this. The way to fix it is to add a 0 when minutes are less than 10. A simple conditional branch can fix this, you can see it in the pictures below.
To hide the clock the erase_text comment command is used.
That's a step-by-step analysis of the whole thing. Here is what I came up with as a final setup.
Note: The variable numbers in the images will vary slightly from the examples given in this tutorial. They will be the variable numbers you will see in the demo project.

The first switch, W, is merely the trigger. It can be replaced with the usual Key Input Process followed by a conditional branch checking that variable.
When W is pressed on the keyboard the clock will show. When W is pressed again the clock will hide. I used another DynRPG plugin to gain access to every key on the keyboard. I also have a picture, HUD - Clock, that shows behind the clock. In this case it shows off-screen then moves up into view.
There is a branch that checks for army time. Converting safely from army time requires a copy of the time because after you manipulate the main value, it gets rewritten as army time after 1 second.
All the branches in the middle are needed for the numbers to display in the right spot. If the first number was a single digit it would show slightly to the left of the correct spot. And when the minutes are less than 10 it needs to add a 0.

The first branch converts it from Army time to...not Army time.
Then the branches for positioning the numbers.

This is mostly the same with references to Game and Real time reversed.
I can't remember why but this event doesn't need the Call AM/PM event, yet it still works :/

This event was required for the process of switching between the Game clock and the Real clock. There is a parallel process that checks when you press Q, when you do it runs this event. It's pretty much the code from the Show Clock event with an erase command at the start.
It erases the current "Clock" and writes the other kind of "Clock" text again. Currently the only thing repeating is the command to change_text, which doesn't work unless the text is written. Thus, the need for this event arose. It was my solution but I'm sure this whole thing could be written slightly different and it wouldn't need that. Whatever! This works.

This event checks if army time is supposed to be displayed. If not, then it will show a picture for either AM or PM.
You only need to change this code to change how AM/PM is displayed. The placement of all the code ensures that this is checked after the time is updated but before the conversion to army time.

This is an event I created so that I could get all the date/time information from the Game Timestamp in one Call Event command. I also created several other events that grab specific bit of information from the Timestamp that can be called on any time, instead of always writing out the comment commands.

This is the event that will allow you to activate these features. In my game this one event will oversee all buttons. I organize it by putting only Call Events in these branches.
Again it's the DynPlugin which allows me to use Q, W, and E as buttons. If you aren't using the plugin you would put a Key Inputting command and matching conditional branch.
The Call event "Toggle Army time" has only a switch toggle.
Switch Operation: [0013:Show as Army time]ON/OFF Toggle
I made it a call event because that's how I usually do these kinds of things and in the future it would be easier to add things to that command. You could always just replace the Calling of Toggle Army time with the single Switch Operation.
Step 5 - What now?
Hopefully you have been able to set the flow of time and create the clock to show it. So what can be done with it now?
Lots of cool stuff!
I only just created this system recently so I'm still finding ways to use it myself. One I'm working on now is farming. I have a good start on it, I have things growing in cycles. They can be harvested when fully grown. It's pretty boring to sit there and watch them grow, but crank up the Speed Factor and what would have taken minutes before only takes seconds. Expect a tutorial on that and any other systems I create.
This all leads to:
- Abilities that control time.
- Day/Night.
- Seasons.
- Quests that are only available on Wednesdays.
- NPCs that will be expecting something to be done by next April.
- An area could have different monsters to battle depending on the time of year.
- Behind the scenes you could use Game or Real time to determine random factors.
- Time travel?
- Journal with accurate dates. You can see that you last played on Aug 11, or that you beat the boss on July 28.
I am also experiementing with all the other DynRPG plugins so you can expect to see more DynRPG tutorials soon.
Posts 

Pages:
1
Pages:
1











