Multi Timers

It's such a long time since I wrote this - I thought I'd gotten into the habit of eval'ing all arguments so variables could be used. I'll take a look, but not sure how soon it'll be.

Thanks,
I noticed that when you try to use a variable to set the timer rather than manually setting it, it instead always sets it to 0 seconds.

I'm just looking at this now, and it does cater for variables. If you want to use whatever is in variable 15, you would put \v(15)

Is that how you called it?
I can confirm that's how I called the timer.
and what was in variable 160 prior to the call?
The variable starts at 5400, so an hour and a half.
However whenever a cutscene happens I write the current timer value to that variable using the TimeLeft function, then delete the timer.
After the cutscene finishes it re-calls the timer using that variable.
It wasn't until after I edited the code to make it eval that it started working as you would expect it to.
Reason for this is that I want the timer to be paused during a cutscene, so the player doesn't have to rush through it to make up for the fact the timer is still ticking down. 😛
Thanks.

I've just added this plugin to my own converted project, so I will be re-testing at some point. However, I've got a lot of script calls to convert first before I can even begin to play without any errors. So it might be a while, but it's on my list. You've got a solution though, so at least you're not waiting for me 🙂
Yep yep! 😀
I have been trying to make a day-night system with this, but so far it seems as if nothing is happening.

anyways here is my parallel process
Code:
#If : dawn is ON
  #Common Event : Daily Event
  #Wait : 6 frames
  #Control Switches : #0015 dawn = OFF
  #
:End
#If : time = 1
  #Plugin Command : addTimer Day 1200 \setV(67, 1)
  #Control Variables : #0068 tint = 0
  #
:Else
  #If : time = 1
    #Plugin Command : addTimer Dusk 180 \setV(67, 2)
    #Control Variables : #0068 tint = 1
    #
  :Else
    #If : time = 2
      #Plugin Command : addTimer Night 1200 \setV(67, 3)
      #Control Variables : #0068 tint = 2
      #Plugin Command : addTimer Untildawn 180 \setS(15, true)
      #
    :Else
      #If : time = 3
        #Plugin Command : addTimer dawn 180 \setV(67, 0)
        #Control Variables : #0068 tint = 1
        #
      :End
      #
    :End
    #
  :End
  #
:End
#
What sets time to 1?

You have two conditions for if time = 1. Maybe the first one should be if time = 0?
Hi there!
I 'm trying to use this, but i have a hard time to get it to work.
I cant understand it very well.

So i have an event of two pages.

In page 1, when the event touch the player, it will start a timer of 10 seconds.

AddTimer resting 10

Then it will turn on the self switch A.

Then, in the page 2 activated by the SELF SWITCH A, i like to put a conditional branch that checks if the resting timer = 0 the it turn the self switch a off.


PAGE 1
◆Plugin Command:AddTimer resting 10
◆Plugin Command:HasTimer resting A

PAGE 2
???? How can i do that?
No, that's not how you use it. On page 1 you add your timer, and tell it to turn off self switch A after 10 seconds. You've added the timer, but you don't tell it what to do. You don't put anything on page 2. The plugin turns the self switch off when the time is up.
No, that's not how you use it. On page 1 you add your timer, and tell it to turn off self switch A after 10 seconds. You've added the timer, but you don't tell it what to do. You don't put anything on page 2. The plugin turns the self switch off when the time is up.
I manage to get it to work with a normal switch.

◆Plugin Command:AddTimer resting 10 sets(43,false)

But i cant get it to work with a selfswitch :/
I put setss(A, false) and dont work.
Can you please give one example of how i make it with a self switch?
I put setss(A, false) and dont work.
Can you please give one example of how i make it with a self switch?

From the instructions on the first page:
Keywords that can be used anywhere in the plugin command are:
<thismap> - current map's id
<thisevent> - current event's id
\setSS - set a self switch - format is \setss([map, event, 'A'], true)
\ss - the value of a self switch - format is \ss([map, event, 'A'])

So if it is this map and this event, your plugin command will be

Code:
Plugin Command: AddTimer resting 10 \setSS([<thismap>, <thisevent>, 'A'], false)

Also, if you have 10 events and want to do this to all of them, you can't call them all resting because they have to have unique names - otherwise they'll all overwrite each other and only the last one's command will actually run.
OHHHH i seee!!! i try similar, but i forgot the "[ ]" and the "SS" upper case.
Thanks a lot Shaz! *____*
This is what i achieve, its for a sort of abs battle that i'm trying to do ^^

Spoiler: Event
wFufiMD.png
WZbTesE.png
@Eliaquim the SS doesn't have to be uppercase. Yes, you forgot the [], but the important thing you forgot was the map and event number.
Does this plugin work with fractions of a second?

EDIT: One more thing, how would I get the timer to set a variable to a random value between 1 and 7 inclusive?
@mads_in_zero if you change line 67 from this:
Code:
seconds = parseInt(args.shift());
to this:
Code:
seconds = Number(args.shift());
you might be able to get fractions of a second.

Code:
Math.floor(Math.random(7)+1)
will give you a random number between 1 and 7, inclusive.

I don't recall if I set it up to evaluate or not, and I don't know if Number() or parseInt() will evaluate what's in the brackets either. Give it a go and see.

If you want the number of seconds to be random, don't put any spaces in that snippet of code, or it'll take the bit before the space as the number of seconds, and the bit after the space as part of the command, and you'll end up either with an error/crash, or it just won't work properly.
Thank you! That seems to have worked so far.

Alright, I'm still having some problems with the timer, so I might as well explain what I'm trying to do with it.

Shin Megami Tensei Nocturne's main battle theme has 7 variations of the chorus of the song, the game choosing which one to play next randomly. I want to implement this song, random choice included. (That's why I needed that number from 1-7 inclusive thing, to set the variable, thank you again).

I think the easiest way to do that would be to start a timer at the start of the song, then choose another variant from 1-7 and start a new timer for the length of that. However, I haven't been able to get the variable setting to work with your variable setting Plugin Command, so I was wondering if it would be possible to tell the Battle Event to not execute any of the remaining code until the timer was finished.

Is this possible with this plugin? And if not, could I request it be added as a feature? Thanks regardless.
This plugin would not pause a battle event in the middle of its list of commands, and I would not make a change for it to do so. That's not its function, and the request is far too specific.

Instead, you could experiment with using a switch to activate the battle event, and set the switch with the timer. In fact, I wouldn't use a timer for the random number either - I'd do that with a Control Variables which already has random number selection built in.

Original thread: https://forums.rpgmakerweb.com/threads/multi-timers.50474/