MV Can I make this plugin work only if a switch is enabled?

When the player pauses and chooses to quit to title, it fades out and sends it back to the title, which also resets the game.

I do this manually at times via the Send to Title command. My issue is that I use a plugin that allows players to hold a key to speed the game up. I also use Galv's cam control plugin.

The speedup plugin + Galv's cam control causes an error when I send to title while speeding up and it crashes. If I do it through the menu, it doesn't crash, I think because the speedup plugin doesn't work in menus.

Is there a way I could make the speedup plugin only work if a switch is turned on or something? I could then turn it off when I manually send to title and then turn it back on during my title screen event.

SRD Speedup plugin here: http://sumrndm.site/debug-speed-up/
A couple of notes: for readability, please don't post entire plugins into your posts. Attach the plugin file, or (preferably) just link to where we can get it.

And when you do post code, put it inside CODE tags (the </> on the edit bar) - just pasting it in removes all indentation formatting and the BBCode can eat brackets.

It would help if you provided information on the crash - press F8, go to the Console tab, and take a screenshot of the full error trace. I don't see any inherent reason why the cam control should have anything to do with sending to the menu or this.

You've tested that using the Send to Menu command with this plugin works fine, and you only get the crash when Galv's is also installed?
A couple of notes: for readability, please don't post entire plugins into your posts. Attach the plugin file, or (preferably) just link to where we can get it.

And when you do post code, put it inside CODE tags (the </> on the edit bar) - just pasting it in removes all indentation formatting and the BBCode can eat brackets.

It would help if you provided information on the crash - press F8, go to the Console tab, and take a screenshot of the full error trace. I don't see any inherent reason why the cam control should have anything to do with sending to the menu or this.

You've tested that using the Send to Menu command with this plugin works fine, and you only get the crash when Galv's is also installed?

Sorry. I fixed the OP and attached all 3 plugins that are not working together.

The ZeroSpeedup one I use is actually a different version of the SRD speedup plugin, but I use both in-game. They both cause the issue with Galv's cam control.

Is this the full error trace below?

1717041749544.png
Is this the full error trace below?
No, you did not click over to the Console tab. Luckily, most of it is visible in the mini-console at the bottom.

The error is saying the map has no camTarget property, which seems curious because if you're going to the menu there should be no map - are you using a pre-titles event or some other such plugin?

The Speedup plugin is only referenced once way down in the stack, and it's for the Scene_Map.update method which isn't in Galv's cam control at all - so that's not overwriting anything that the cam control relies on.

Sorry. I fixed the OP and attached all 3 plugins that are not working together.
As I said previously, the preferred thing is to provide links to the plugins.

The Zero thing may be fine, and Galv's plugins allow redistribution, but redistributing SRD's plugins is against his terms of use.
No, you did not click over to the Console tab. Luckily, most of it is visible in the mini-console at the bottom.

The error is saying the map has no camTarget property, which seems curious because if you're going to the menu there should be no map - are you using a pre-titles event or some other such plugin?

The Speedup plugin is only referenced once way down in the stack, and it's for the Scene_Map.update method which isn't in Galv's cam control at all - so that's not overwriting anything that the cam control relies on.


As I said previously, the preferred thing is to provide links to the plugins.

The Zero thing may be fine, and Galv's plugins allow redistribution, but redistributing SRD's plugins is against his terms of use.

Ah, okay. Fixed the SRD plugin in OP.

And crap, yeh, I'm using a pre-title event plugin. it's HIME_preTitleEvents.

I don't use the in-built Title menu at all. It's all just evented through a custom map.

I didn't realize the issue was with that somehow as it wasn't showing up in the console.

EDIT: just testing, and it's not even these original plugins at all. I tried it with a fresh project and they all work fine. So, I guess it's something wrong with the way I'm using those plugins with the pre-title plugin.

But yeh, it only happens when I'm using the fast forward plugins with Galv's cam control on. I can have all the plugins turned on, but it's when I actually enable either of the speedup plugins in-game that it causes the crash.
And as an answer to your original title question:

ONLY if the plugin developer has given you that option.

Because you cannot turn an entire plugin off, only functions of it - for example if the plugin stores data in savefiles then turning the entire plugin off would make savefiles incompatible for the same reason we say you have to start a new game when adding or removing plugins.

Or a comparison that I like to give to such questions: Turning plugins off while the game is running is like trying to work on the engine of your car while driving 50 miles per hour on the highway...
And as an answer to your original title question:

ONLY if the plugin developer has given you that option.

Because you cannot turn an entire plugin off, only functions of it - for example if the plugin stores data in savefiles then turning the entire plugin off would make savefiles incompatible for the same reason we say you have to start a new game when adding or removing plugins.

Or a comparison that I like to give to such questions: Turning plugins off while the game is running is like trying to work on the engine of your car while driving 50 miles per hour on the highway...
Ah, yep. I'm aware that it's like this. I wasn't trying to turn off the entire plugin, just disable some of it's functions via a switch.

I just wondered if there was something I could do with the code to easily add that functionality. I really thought it would be as easy as adding basic code to check if a switch was true and then it would br turned off.
The speedup plugin + Galv's cam control causes an error when I send to title while speeding up and it crashes. If I do it through the menu, it doesn't crash, I think because the speedup plugin doesn't work in menus.
True, if you want to change that, open the speedup plugin, look for

Code:
var _Scene_Map_update = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Scene_Map_update.call(this)
        }
    };

    var _Spriteset_Base_update = Spriteset_Base.prototype.update;
    Spriteset_Base.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Spriteset_Base_update.call(this);
        }
    };

    var _Scene_Battle_prototype_update = Scene_Battle.prototype.update;
    Scene_Battle.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Scene_Battle_prototype_update.call(this);
        }
    };

and replace it with

Code:
var _Scene_Base_update = Scene_Base.prototype.update;
    Scene_Base.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Scene_Base_update.call(this)
        }
    };

    var _Spriteset_Base_update = Spriteset_Base.prototype.update;
    Spriteset_Base.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Spriteset_Base_update.call(this);
        }
    };

If that doesn't help and you want to try it with the Switch instead, look for

Code:
if($gameTemp){
(2 occurrences)

and replace both with

Code:
if($gameTemp && $gameSwitches.value(1)){
and replace 1 with your Switch ID.
you can try this:

JavaScript:
PluginManager.setStatus("pluginName", false);
SceneManager.push(Scene_PluginManager);

just keep in mind that if you do that, plugin commands used in event throw
errors if existed which is also not what you want, but if it stays on on new boot
is a question, but I wont recommend this approach though.

some use it as action button and 2nd page to turn it back in parallel
if there is a image glitch to fix it or redraw something correctly.

you can try re-order the plugin between the 2 to swap above or below.
JavaScript:
PluginManager.setStatus("pluginName", false);
SceneManager.push(Scene_PluginManager);
Where on Earth did you get that code from? None of that is core functionality. 😅
I really thought it would be as easy as adding basic code to check if a switch was true and then it would br turned off.
yes and no.

the problem is finding where in a plugin to place the basic code for checking a switch.
as I mentioned above if you place the switch on the wrong section of the code, you'll make the savefiles incompatible.
and if you place it around the setup sectiopn you'll need to invert the switch because by default all switches are still off during setup.
and a few other places where it becomes tricky.

especially for complex plugins usually only the programmer knows enough about the internal code and logic to know where to place such switches. It is rare for other people to analyse a plugin to that point (although it does happen)
If you say the crash only happens when the game is sped up and that needs a button, make your send to title into conditionals:
LOOP:
IF player holding button -> show text: release the button!
ELSE -> to title
Where on Earth did you get that code from? None of that is core functionality. 😅
PluginManager.parameters => calls the list you have, it might used to work,
but PluginManager exist.

maybe less so for setStatus, as it doesn't find it in 1.6.
you can call their names in different ways to check the settings you
have or what is available in the plugin that is installed.

some are under $plugins but not exactly sure PluginManager is drawed from though.
but at least somewhere.

maybe it was something in 1.5 version of MV but never used it as I don't see the
use of it, but it gives reference error on my end.

I saved it from an old thread somewhere some years ago, I can try to find it.

Edit: it does work, but it require a plugin in order to do that 😀
here is a thread on it, but the site is dead though.

edit 2: here is the plugin required to make it work.
but PluginManager exist.
caethyril didn't say that the PluginManager doesn't exist - both that and the SceneManager absolutely exist. But none of the other things you said do. There's no setStatus() method, and there's no Scene_PluginManager (not to mention the many undesirable behaviors that would typically be caused by randomly going to another scene).

I took a look at the thread you linked to, and aside from the download being dead, both the OP and the person recommending the plugin are saying it doesn't actually work. The last post from the author says "it has a lot of problems."
@ShadowDragon
The biggest problem is that switching off and on a plugin that way has the same problem as switching a plugin on and off in the plugin manager itself: if the plugin stored specific data in the savefiles, the savefiles become incompatible to the current state of the engine.

this method does prevent the setup problem of plugin manager changes because it guarantees that at setup all plugins are active, but it will still cause problems if a save is done while a critical plugin is off.
because that save will likely cause problems on load from title when all plugins are on.
Code:
if($gameTemp){
(2 occurrences)

and replace both with

Code:
if($gameTemp && $gameSwitches.value(1)){
and replace 1 with your Switch ID.

Oh, this almost worked. It does turn off the speedup, but the issue is that the player needs to release the speedup key for the change to have any effect. Only then does the speedup get turned off.

That first part of code you suggested makes the speedup only work in menus, which isn't what I want. What's interesting about that though, is that if I use the exit to title option from the menu, while holding the speedup key it doesn't crash. Maybe that's because when you hit that option, it closes the menu, where the speedup now is not active.

If you say the crash only happens when the game is sped up and that needs a button, make your send to title into conditionals:
LOOP:
IF player holding button -> show text: release the button!
ELSE -> to title

The issue with that is that holding the speedup button also advances text as well. So, it just flies right through that show text telling players to let go of the key.

I can do a Show Options command that will stop everything, but then I need to tell players to stop holding the key somehow, which I can't do because I can't do a show text and an options box at the same time. Might be able to do it with a centered name box instead or something, I guess. Or a show Picture.
You can also show it as a picture with giant letters across the screen and make a huge airhorn SE.
You can also show it as a picture with giant letters across the screen and make a huge airhorn SE.

Yeh, that's what I meant when I said "Or a Show Picture."

The only issue with that is that a player can let go of the key, hit the choice to continue saying they've let go, and then immediately hold it down again and create the crash lol.
try this one:
JavaScript:
if($gameTemp && Input.isPressed("ok") || Input.isPressed("ok"))){
    return;
}else{
    //rest of code
}
this should stop the code if OK button is pressed or triggered.
so it isn't bound to a switch.

there might be other way around, you can still add the switch

JavaScript:
if($gameTemp && $gameSwitches.value(1) && Input.isPressed("ok") || Input.isPressed("ok"))){
    return;
}else{
    //rest of code
}

if switch is ON and the input is triggered/pressed, it should return true, otherwise false.

Original thread: https://forums.rpgmakerweb.com/threads/can-i-make-this-plugin-work-only-if-a-switch-is-enabled.169113/