Increase time in the timer

I'd like to increase time in the timer.
For an example, I create a 10 minute countdown timer for using an oil lamp before it goes off.
When the player collects lamp oil, the time will increase like 1 minute and the timer continues counting down.
What should I do? I have little knowledge in Ruby language but I can read it.
Thank you 🙂
You can do a workaround using just eventing, if the oil lamp will fully refill the timer.


The way you wanna do it, you have to use a script command indeed.
If you want to add a minute to the timer, this would be the script call:

Code:
$game_timer.start(($game_timer.sec + 60) * Graphics.frame_rate)



What happens if they collect the oil and they don't have the lamp turned on?  Could that situation happen?  Do you have a check for it?  You probably wouldn't want to run that script call if the lamp isn't being used.
Thank you for your helps, Shaz and Dreadshadow!
 

What happens if they collect the oil and they don't have the lamp turned on?  Could that situation happen?  Do you have a check for it?  You probably wouldn't want to run that script call if the lamp isn't being used.


I want to make my game like the player can collect lamp oil like a normal item and has to use it in the item menu only, I will check it again. Thank you so much!
I can make the player use lamp oil in item menu and the time in the timer increases! I also make conditional branch to check if the lamp is turned on or not 🙂

I have another question. If I want to pause the timer when the player turns off the lamp and continue the timer when the player turns on the lamp, how can I make it? (like press some key to turn on and turn off the lamp)
There isn't really a way to pause the timer.  


You could use Control Variables, select a variable, and put $game_timer.sec into the script box.  That will store the remaining time into a variable.  Then use Stop Timer to cancel the timer.


When you're ready for it to start again, instead of using the Timer event command, use a script call to start the timer, passing in the calculation for the number of seconds you've got in the variable.


For example, if you use Control Variables to put the number of seconds left on the timer into variable 15, the command to restart it would be 

Code:
$game_timer.start($game_variables[15] * Graphics.frame_rate)
Thank you soooo much, I can do it.

I'm sorry for asking many questions, how can I make a timer box showing a number in that variable for making the player think that the time is paused. (Could I ask for how to show and how to hide it?)
Because when I use Control Timer: Stop, the timer box is disappear. I've tried to make a script by myself from "Sprite_Timer" but I can't do it 🙁
You would need a script for that.
Thank you for your help, I will try it 🙂

Original thread: https://forums.rpgmakerweb.com/threads/increase-time-in-the-timer.72197/