Author Topic: Showing the timer  (Read 445 times)

Showing the timer
« on: 04 Jan 2021, 23:57 »
Hello!

In the game I am developing the main Character has x time to do one action before the time finishes and he needs to start again.
So far I have configured one timer running in checked by Repetely executed in Global Script which already knows when this Timer is over,
but I would like to stablish a count down in the game, so the player is able to see how much time left does he have,
but I didn't find any function to check the time left for the timer.
Can you please provide me any idea?

Regards.

Re: Showing the timer
« Reply #1 on: 05 Jan 2021, 01:23 »
I don't think there is any built-in function that allows you to read a timer value, but you can effectively create your own timer by making an integer variable to count down the frames as they elapse and use the value from GetGameSpeed to convert the counter value into another format.

i.e. if your game speed is 40 this means that repeatedly executing commands will be run 40 times per second, so a 2 second delay could mean decrementing the value from 80 to 0.

Re: Showing the timer
« Reply #2 on: 05 Jan 2021, 09:47 »
Hi.

Thanks for you answer. That is a solution.
Is there iny way to access to the class created in orger to build a get method?

Regards,

Re: Showing the timer
« Reply #3 on: 05 Jan 2021, 09:52 »
I once wrote a timer module that allows to read remaining time, and some more: https://www.adventuregamestudio.co.uk/forums/index.php?topic=55545.0

Is there iny way to access to the class created in orger to build a get method?

Please clarify, what class are you refering to?
« Last Edit: 05 Jan 2021, 09:54 by Crimson Wizard »

Re: Showing the timer
« Reply #4 on: 05 Jan 2021, 22:13 »
Thank you very much for your work.