Extended Game Timers

Status
Not open for further replies.

navybofus

Transcendent
Member
Joined
Jan 7, 2013
Messages
19
Reaction score
0
First Language
English
Primarily Uses
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!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,969
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
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: ( [ / ,
 

navybofus

Transcendent
Member
Joined
Jan 7, 2013
Messages
19
Reaction score
0
First Language
English
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,969
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
what code comments? You'll have to be more specific, as this is not meant to be used within a conditional branch.
 

navybofus

Transcendent
Member
Joined
Jan 7, 2013
Messages
19
Reaction score
0
First Language
English
Primarily Uses
I tried using the code below in a script conditional branch. I received an error about and expected $end I believe.

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
#--------------------------------------------------------------------------
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,969
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
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'])
 

navybofus

Transcendent
Member
Joined
Jan 7, 2013
Messages
19
Reaction score
0
First Language
English
Primarily Uses
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 :)
 

KyleW17

Villager
Member
Joined
Jun 23, 2013
Messages
5
Reaction score
0
First Language
English
Primarily Uses
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.



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



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.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,969
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
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'].
 

KyleW17

Villager
Member
Joined
Jun 23, 2013
Messages
5
Reaction score
0
First Language
English
Primarily Uses
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  :D
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,969
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
@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).
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts



I've been experimenting with improved memory management again, which allowed me to include items to increase player path length. These are both 44 grid spaces long, and stable. :LZSexcite:
I FINALLY DID IT! 5 years making my very first game and I just officially released it on STEAM..... OMG..... I can say I finished a game! The feelings!!!!!
Stream will be live shortly! I am going to be playing some Among Us! Feel free to drop by!
Ami
tv program always get the ratings (it's the reason why drama series has 1000+ episode),also full and nonsense of censorship (weird blur, a scene getting cut because the unconvenient viewer,but it unconvenient to me either. you never see what the original is)

i know the reason is to take cover the viewer from the negative thing,but i just laughing and mocking of them that they're always suck :guffaw:
Star Chart Idea - Just something I am working on.

Forum statistics

Threads
104,459
Messages
1,006,434
Members
135,966
Latest member
Kleik
Top