GAME CLOCK TUTORIAL

How to keep track of gameplay time

  • drxeno02
  • 12/22/2011 04:20 PM
  • 7595 views
Greetings everyone! This is DRXeno, developer of JAOD Project, here with a clock system tutorial for your game. What do you need a clock for, you might ask? Well, you don’t need it, but SquareSoft used it in their old RPG games. (Yes-yes, I know I just made an excellent point) So lets get into it!

Start by creating one switch and four variables. The switch is (0001:Timer) and the four variables are (0001:Second), (0002:Minute), (0003:Hour) and (0004:Day).

-==Setup==-
** Go to Common Events and begin a new event with Parallel Process and trigger switch (0001:Timer)
** Add a wait 1.0 Sec command

-==Configure Seconds into Minutes==-
** Go to variable operations on your list of event-command options to add a variable. You already made the variable (0001:Second) use this. Now configure the SET to (+), and change OPERAND to 1
** Create a fork/branch option, you want to say in words “If (0001:Second) is EQUAL to 60”. This is done by changing the SET to 60, and making sure the drop down is “equal to”.
** Go to variable operations on your list of event-command options to add a variable. You already made the variable (0002:Minute) use this. Now configure the SET to (+), and change OPERAND to 1
** Go to variable operations on your list of event-command options to add a variable. Add the (0001:Second) variable and configure the SET to (-), and change OPERAND to 60

-==Configure Minutes into Hours==-
** Create a fork/branch option, you want to say in words “If (0002:Minute) is EQUAL to 60”. This is done by changing the SET to 60, and making sure the drop down is “equal to”.
** Go to variable operations on your list of event-command options to add a variable. You already made the variable (0003:Hour) use this. Now configure the SET to (+), and change OPERAND to 1
** Go to variable operations on your list of event-command options to add a variable. Add the (0002:Minute) variable and configure the SET to (-), and change OPERAND to 60

-==Configure Hours into Days==-
** Create a fork/branch option, you want to say in words “If (0003:Hour) is EQUAL to 24”. This is done by changing the SET to 24, and making sure the drop down is “equal to”.
** Go to variable operations on your list of event-command options to add a variable. You already made the variable (0004:Day) use this. Now configure the SET to (+), and change OPERAND to 1
** Go to variable operations on your list of event-command options to add a variable. Add the (0003:Hour) variable and configure the SET to (-), and change OPERAND to 24


The explanation above should resemble the below coding:

<>Wait: 1.0 sec.
<>Variable Ch:(0001:Second)+.1
<>FORK Optn:Vrbl(0001:Second)-60
<>Variable Ch:(0002:Minute)+.1
<>Variable Ch:(0001:Second)-.60
<>FORK Optn:Vrbl(0002:Minute)+.60
<>Variable Ch:(0003:Hour)+.1
<>Variable Ch:(0002:Minute)-.60
<>FORK Optn:Vrbl(0003:Hour)+.24
<>Variable Ch:(0004:Day)+.1
<>Variable CH:(0003:Hour)-.24
<>
:END Case
<>
:END Case
<>
:END Case

-==DRXeno’s Challenge==-

Can you figure out a way to display your timer to the end users?

Answer:

To display your timer to the end users you have to reference the variables that you want to showcase. This can be done using a message box, such as portrayed below.

<>Messg: You have been playing for \v(4) days, \v(3) hours, \v(2) minutes, \v(1) seconds

This message can be triggered any way you like, on mouse click, integrated into a custom menu system and/or other. Just remember that the timer will not begin if you do not turn ON switch (0001:Timer). Turning this switch OFF at any time will stop the timer.


For any questions or concerns contact me, I’m around here somewhere!
Name: Leonard Tatum A.K.A DRXeno
Email: LJTatum@hotmail.com
AIM: jaquio123
Official Webpage: http://leonardtatum.blogspot.com/
Gamepage: http://rpgmaker.net/games/3708/

Posts

Pages: 1
If your going for a straight up timer, this is sufficient.

But if your using it to display time like a standard clock there is one minor issue. When you have been playing for 2 hours and 5 minutes, it would display like this: 2:5 - where it would look better if it was like this: 2:05. To solve this I added another variable/branch for "10's of minutes". Then it's just a matter of adjusting the numbers so that minutes go to 10, add 1 to tens of minutes, then reset to 0. (You have it minus the amount, but I prefer reset to 0) Obviously you would have to alter 10's of minutes into hours, too.

For displaying variables, you have to use square brackets
[ ]

You would have to surround them in code tags to be visible on RMN.

Also, is this a typo
The exclamation above should resemble the below coding:

Explanation? :P
@Link_2112 yes "exclamation" should have been "explanataion". Thank you Link_2112!
It seems you both have a lots to learn about variables and how they work.
author=Davenport
It seems you both have a lots to learn about variables and how they work.
This tutorial is pointless. If you need any help, try playing some of my games
I made long before you were probably born.


I have no words for this hahah
LEECH
who am i and how did i get in here
2599
author=Link_2112
author=Davenport
It seems you both have a lots to learn about variables and how they work.
This tutorial is pointless. If you need any help, try playing some of my games
I made long before you were probably born.
I have no words for this hahah


I have some words, but i dont want to repeat them in front of daven, as im quite sure he is a small child.
I tried doing this but the clock is too fast, what's going on here? Something don't make sense. Everything matches up like I did:

Wait 1.0 seconds
Control Variables Clock Seconds +=1
Conditional Branch Clock Seconds = 60
Control Variables Clock Minutes +1
Control Variables Clock Seconds =-60
Branch End

Conditional Branch Clock Minutes = 60
Control Variables Clock Hours +1
Control Variables Clock Minutes =-60
Branch End

Conditional Branch Clock Hours = 24
Control Variables Clock Days +1
Control Variables Clock Hours =-24
Branch End

Bep.
Any pointers on what's wrong??
Pages: 1