Timer to determine how long the game took to finish

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Timer to determine how long the game took to finish

Postby drummerac » Mon Jan 04, 2010 1:50 pm

Hi everyone, happy new year!

I need to make a timer to determine how long the game took to finish.

At the end i want to display how long the game took, but i don't want it to be displayed until the end.

Does anyone know how I can do this?
User avatar
drummerac
Member
 
Posts: 53
Joined: Fri Apr 10, 2009 5:07 pm
Location: Ireland

Postby Mystery » Mon Jan 04, 2010 4:56 pm

You could create a global countdown, or in this case a count up.

Create a variable called Counter

VBScript Global Procedures:
Code: Select all
Sub RaiseCounter
Counter = Counter + 1
End Sub


Project Properties: "Execute some VBScript code every time that a frame is loaded"
Code: Select all
Action.CreateTimedEvent 1,"RaiseCounter", true


To show time on the end frame:
Create a text on the frame by right clicking on it, and enter something
Code: Select all
Text(text_index) = "It took you " + Counter + " seconds to finish the game."


(Note, I haven't tested it, so no guaranty for the 100% correctness, but it should get you started)

If you use the save feature, I'm not sure if you have to add a script to the Project Properties: "Execute some VBScript code every time that a game is loaded" to ensure that the counter is working properly :?:

You may also need to use a conversion formula so that the time is shown in hours, minutes and seconds, instead of only seconds.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby drummerac » Tue Jan 05, 2010 1:16 am

Great, thanks Mystery, I'll check it tomorrow, it's 00:16 here now :)
User avatar
drummerac
Member
 
Posts: 53
Joined: Fri Apr 10, 2009 5:07 pm
Location: Ireland

Postby Mystery » Tue Jan 05, 2010 2:22 pm

You're welcome :)

Good luck, and don't hesitate to post if there is a mistake in my posted scripts, or if you need further help to make it work.
I may be not able to help with the time conversion script, but I'm sure one of our scripting geniuses would know how to do it if you can't figure it out.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron