Multi Timers
JS Plugin Releases (RMMV)Hmm also i tested it and i think your plugin kills the normal timer. The normal timer will apear but the countdown will not happend.
Mabye you can do anything? 🤔
Mabye you can do anything? 🤔
I haven't used a timer in my game proper yet, but I can agree with @styx92 that with your plugin on the default game timer doesn't count down, but with it off it does. Made a random timer to see after reading this and it just sits there without any counting.
Thank you both. It was a minor omission on my part. Fixed and re-uploaded 🙂
Thanks for the fast fix 😀 I wasn't to the part of my game design where I wanted to use timers yet, but it was coming soon. Tested and working perfectly!
Very fast! Thanks you!
At the last time i dont need the timer too. But now i need it and yeah if it works than ist perfekt *.*
Thanks shaz 🙂
At the last time i dont need the timer too. But now i need it and yeah if it works than ist perfekt *.*
Thanks shaz 🙂
I'm trying to set-up a cooldown for a detect skill that will show traps for a limited amount of time and then turn off.
I'm achieving this with Yanfly's Button Common Events plugin.
The common event is setup like this:
However, when activating the skill I get the TypeError: Cannot read property 'toUpperCase' of undefined.
I'm achieving this with Yanfly's Button Common Events plugin.
The common event is setup like this:
However, when activating the skill I get the TypeError: Cannot read property 'toUpperCase' of undefined.
That's very strange. I'm not sure the error is coming from that common event.
That line of the plugin is simply converting the plugin command to uppercase. For this common event, the plugin command is addTimer, so it can't be undefined as indicated by the error message.
Do you have any events anywhere that you've added a plugin command to, and then decided not to go ahead, but still left the plugin call there with no arguments? If you can't be sure, go to my plugin and add a new line just before 63, with this:
Save then play again and see what comes out in the console. Event Id might be empty if it's a common event that's running, and I would expect command to show as undefined.
Also, can you show a screenshot of the skill?
That line of the plugin is simply converting the plugin command to uppercase. For this common event, the plugin command is addTimer, so it can't be undefined as indicated by the error message.
Do you have any events anywhere that you've added a plugin command to, and then decided not to go ahead, but still left the plugin call there with no arguments? If you can't be sure, go to my plugin and add a new line just before 63, with this:
Code:
console.log('Map: ' + this._mapId + '; Event: ' + this._eventId + '; command: ' + command + '; args: ' + args);
Save then play again and see what comes out in the console. Event Id might be empty if it's a common event that's running, and I would expect command to show as undefined.
Also, can you show a screenshot of the skill?
@Shaz looks like I found the culprit. It's Camera Scroll EX by Raizen/SoulPour.
Not sure how they conflicted but it works perfectly fine when the plugin is disabled.
Here's the latest console log.
Not signed in
Not sure how they conflicted but it works perfectly fine when the plugin is disabled.
Here's the latest console log.
because when he's called the aliased method, he hasn't passed through the arguments.
Go to line 85 of that plugin and change it to this:
I am surprised a lot of people haven't complained about that, because that would likely conflict with ANY other plugin (that has plugin commands). Maybe it's just because I'm trying to do something with the command prior to checking its value (most people might just use a switch, which might be okay with an undefined object, but I'm converting to upper case first, which isn't - guess that's what I get for trying to make mine more flexible). But still - not passing through the arguments would mean any plugin command that's higher in the list (or lower?) would not be executed. I could just be misunderstanding the apply function.
Go to line 85 of that plugin and change it to this:
Code:
Soulpour777.CameraScrollEx.pluginCommand.call(this, command, args);
I am surprised a lot of people haven't complained about that, because that would likely conflict with ANY other plugin (that has plugin commands). Maybe it's just because I'm trying to do something with the command prior to checking its value (most people might just use a switch, which might be okay with an undefined object, but I'm converting to upper case first, which isn't - guess that's what I get for trying to make mine more flexible). But still - not passing through the arguments would mean any plugin command that's higher in the list (or lower?) would not be executed. I could just be misunderstanding the apply function.
Yay! It's all working now!
Thanks a bunch. Hopefully he updates his plugin to fix this issue or others see this method to fix it.
Thanks a bunch. Hopefully he updates his plugin to fix this issue or others see this method to fix it.
Unlikely - the page you linked says it's unsupported.
Now that my main problem is fixed.
Could you help me with adding a 30 second cooldown timer to my common event?
So when they turn the common event on via a key it will turn on the detect switch.
The detect switch allows them to see various traps around the area.
After 10 seconds it will turn off.
I have all that setup but is it possible to make it so they can't use it again for 30 seconds with another timer?
Not signed in
Not signed in
Could you help me with adding a 30 second cooldown timer to my common event?
So when they turn the common event on via a key it will turn on the detect switch.
The detect switch allows them to see various traps around the area.
After 10 seconds it will turn off.
I have all that setup but is it possible to make it so they can't use it again for 30 seconds with another timer?
Not signed in
Do you want the 30 seconds to start after the skill is used, or after it's depleted (so 40 seconds after the skill is used)?
I'd use a second switch for Cooldown and turn it on at the same time as switch 1. Then the second plugin command will just turn it off, and it'll be 40 seconds (if you want the cooldown to start after the 10 seconds is up) or 30 seconds (if you want the cooldown to start from the time the skill is used).
Then modify your common event to check for both cooldown and detect in effect:
And noticing that you're using switch 1, I should advise you to check your other plugins and see if any of those are also using switch 1 by default, as you might need to change one or the other. A lot of people report problems when they have plugins and they use switch 1 for stuff in events.
I'd use a second switch for Cooldown and turn it on at the same time as switch 1. Then the second plugin command will just turn it off, and it'll be 40 seconds (if you want the cooldown to start after the 10 seconds is up) or 30 seconds (if you want the cooldown to start from the time the skill is used).
Then modify your common event to check for both cooldown and detect in effect:
Code:
If: Detect is ON
Text: Detect is currently active.
Else
If: Cooldown is ON
Text: Detect is currently on cooldown.
Else
Control Switches: Detect = ON
Control Switches: Cooldown = ON
Plugin Command: addTimer detect 10 \setS(1, false)
Plugin Command: addTimer cooldown 30 \setS(2, false)
End
End
And noticing that you're using switch 1, I should advise you to check your other plugins and see if any of those are also using switch 1 by default, as you might need to change one or the other. A lot of people report problems when they have plugins and they use switch 1 for stuff in events.
Thanks a ton! 1 was just a temp switch placement until I figured out what was breaking it earlier.
It's working flawlessly now! Thanks for such a great plugin and help!
It's working flawlessly now! Thanks for such a great plugin and help!
@Shaz
hi
i have i little question about your timer.
if i use your timer like thas.
// (key, seconds, command);
$gameTimer.addTimer('test1', 10, x='blabla');
Command I guess, the command is for execute at the end of the time?
It seems to initialize the variable from the beginning.
If you have a trick or advice to share me.
Here other example
function BonusMalus(ID,Time,CommandAfterTimer) {
$gameTimer.addTimer(String(ID), Time, CommandAfterTimer);
}
//execution
var timer1 = 1;
var T=120
BonusMalus(timer1,T,StatusMenue('SHOW'));
There is a syntax to adopt to prevent that command initializes at the beginning, but at the end.
tanks
hi
i have i little question about your timer.
if i use your timer like thas.
// (key, seconds, command);
$gameTimer.addTimer('test1', 10, x='blabla');
Command I guess, the command is for execute at the end of the time?
It seems to initialize the variable from the beginning.
If you have a trick or advice to share me.
Here other example
function BonusMalus(ID,Time,CommandAfterTimer) {
$gameTimer.addTimer(String(ID), Time, CommandAfterTimer);
}
//execution
var timer1 = 1;
var T=120
BonusMalus(timer1,T,StatusMenue('SHOW'));
There is a syntax to adopt to prevent that command initializes at the beginning, but at the end.
tanks
The command has to be a string. You're running a function and passing in the result.
$gameTimer.addTimer('test1', 10, "x='blabla'");
BonusMalus(timer1, T, "StatusMenue('SHOW')");
$gameTimer.addTimer('test1', 10, "x='blabla'");
BonusMalus(timer1, T, "StatusMenue('SHOW')");
Ok yes i just see .
You plugin are MIT license ? .
I would like to add some line in Game_Interpreter.prototype.subst = function(args) { ?
You plugin are MIT license ? .
I would like to add some line in Game_Interpreter.prototype.subst = function(args) { ?
I don't use any licence. You are free to modify it as you like. Just leave the header intact and don't say you made it.
Hey, 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 went in and did a bit of code to fix this!
case 'ADDTIMER':
args = this.subst(args);
key = args.shift();
uneval_time = args.shift();
uneval_time = eval(uneval_time);
seconds = parseInt(uneval_time);
command = args.join(' ');
$gameTimer.addTimer(key, seconds, command);
break;
I'm not that sure if this is the best way to fix this as I do not have that much experience with JavaScript.
In anycase, I hope that you're able to fix the issue, with or without the code I provided! 😀
I went in and did a bit of code to fix this!
case 'ADDTIMER':
args = this.subst(args);
key = args.shift();
uneval_time = args.shift();
uneval_time = eval(uneval_time);
seconds = parseInt(uneval_time);
command = args.join(' ');
$gameTimer.addTimer(key, seconds, command);
break;
I'm not that sure if this is the best way to fix this as I do not have that much experience with JavaScript.
In anycase, I hope that you're able to fix the issue, with or without the code I provided! 😀
Original thread: https://forums.rpgmakerweb.com/threads/multi-timers.50474/