Extended Game Timers

I know this is an old thread but I've seen this script and want to use it fully! Great job on creating this.

I am currently using your script for resource gathering node resets. Works wonders!

Now, I'm trying to use these timers to be controlled by variables which works fine too, as long as you don't need a timer less than 60 seconds or for 1 minute and 15 seconds. Sadly, I DO need timers that involve fractions of a minute.

Scenario:



Code:
$game_variables[1] = InputNumber() # Not really putting InputNumber() in code, just showing in code format.
$game_variables[2] = $game_variables[1] / 60
$game_timer.set_timer($game_variables[2], [@map_id, @event_id, 'A', false])
First I store a variable from the InputNumber function, then I divide it by 60 to get minutes. After that I set a $game_timer to the minutes variable. Here's where my problem comes in. The game won't let me store variables with decimals, it always drops the decimal.

Does this mean that I won't be able to set your timers for minutes and seconds with variables? Because right now it will do whole minutes fine (with variables), and it will do manual fractions of a minute fine (7/60 [without variables]).

Hope that I explained myself well enough. Please let me know if I am missing something. Thanks!
Yeah, I think you can do this - you just do the /60 in the call script rather than storing it into another variable. To use your example:

$game_variables[1] = (input number)

Call Script: $game_timer.set_timer($game_variables[1] / 60, [@map_id, @event_id, 'A', false])

Be careful with this, as the script call will go onto two lines at least, maybe 3. Make sure you do the line break after something that makes it clear there's more to come. If you do this wrong, you'll know because it'll give you an error, and if you hit F11 as soon as you go back to the editor, it'll take you to the Game_Interpreter's Call Script command. So put the line breaks after any of these symbols: ( [ / ,
Yeah, my thoughts exactly. I started doing that last night after I posted. I think if I tinker with it some more I'll get to where I need to go. Also, I'd like to use your if statement that you build in for the conditional branch, but the example in the code comments didn't work and throws an error.
what code comments? You'll have to be more specific, as this is not meant to be used within a conditional branch.
I tried using the code below in a script conditional branch. I received an error about and expected $end I believe.

Spoiler
Code:
#--------------------------------------------------------------------------
# * Event Timer Set?
# Checks whether a timer has been set for a switch or self switch
#
# Examples:
# if $game_timer.has_timer?(17) # determines whether there's a timer for
# switch 17
# if $game_timer.has_timer?([15, 3, 'B']) # determines whether there's a
# timer for self switch B of event 3 on map 15
#--------------------------------------------------------------------------
It would be better if you'd shown me your conditional branch and the condition you entered.

When you do an 'if' test in the conditional branch, you don't actually include the word 'if'. So in your conditional branch, you would enter:



Code:
$game_timer.has_timer?(17)
or



Code:
$game_timer.has_timer?([15, 3, 'B'])
goodness! I'm sorry, I'm a newb. Thanks for the information. I am now fully utilizing your script and all of its features! Thank you so much! My profession system is going to be intricate and massive now 🙂
Sorry to bring this thread up after its been 6 months since the last post but I figured its better than starting a new thread for what could be a very small problem.

Basically I'm trying to learn about scripts and yours is a perfect fit for what I currently need!

I'm attempting to set a timer similar to the full example you've posted here, it starts a timer and turns off a self-switch after the time is up allowing the player to re-do the original events action. Here is the script I'm putting in the event page.

[IMG]http://i.imgur.com/2vA7rbM.png[/IMG]

Then I run the game and get this bad boy when the timer is due to start running...

[IMG]http://imgur.com/QsHgNLj.png[/IMG]

Based on suggestions in this thread I made sure to run the event on a new game file but I'm still getting the same result.

It's probably something basic that I've got wrong but I'm still a huge beginner when it comes to scripts so I don't understand what to do about the error it's throwing at me.
What is @14 and @9? They are nothing the script would recognize.


If you mean event 9 on map 14, then you write it as [14, 9, 'B'], not [@14, @9, 'B'].
What is @14 and @9? They are nothing the script would recognize.

If you mean event 9 on map 14, then you write it as [14, 9, 'B'], not [@14, @9, 'B'].
Well don't I feel foolish, guess it's all part of the learning process.

The issue was I took the example in the original post here

$game_timer.set_timer(15, [@map_id,

@event_id, 'A'], false)

and carbon copied it in.

Maybe a little more common sense on my part would have sorted things out. Thanks for clearing it up though  😀
@map_id and @event_id are variables in the Interpreter class. Using those lets you say "THIS map, and THIS event" (the event your set_timer call is on), so you can have the same timer on many different events but not have to key in the map number and event id on each one.


I suggest you use those, unless you want to set a timer on a DIFFERENT event (which may or may not be on a different map).

Original thread: https://forums.rpgmakerweb.com/threads/extended-game-timers.1516/