Load/unload a script in game?

So I'm not sure if this should be here or in scripts help, but anyway, here we go.

Might be a little ambitious, but I'm looking for a way to deactivate or reactivate a script entierely in-game, via a script call. Is that possible?
You probably could do this by tying the entire script to a switch, then if that switch is on, the script runs, if not the script doesn't. Probably would require an if statement at the start of all the def commands in the script though for it to work well, with it running the original command if the switch is off.

As for via a script call, maybe if that script call was set to turn on/off the switch I suggested? Otherwise no idea. Will be interested to see if there is another way to do this.
I have done something similar with my Autosave/system script where it checks to see if yanfly's save script is added and if so will use my full script else it uses the basic version.

I am thinking (checked should work) that what you want would be something like the following:

Edit: forgot when testing it that I removed the return in the script_status definition

Code:
$imported = {} if $imported.nil?#for the script call to turn on/off the scriptmodule Shut_Off #script call Shut_Off.script_status("Script_Name_Here", true/false) #script name can be any string but must match the script you want to turn on/off may want to keep it different  # from actual script name though. # note that I am not certain if you will run into any bugs if you turned a script off  #that was currently being used with this. def self.script_status(name, state)    $imported[name] = state endendif $imported["Script_Name_Here"]   #script goes hereend
It is not possible generally speaking.

Show us the specific scripts you want to have this ability for and we may be able to help you implement in those specific scripts.

*hugs*

 - Zeriab
I'm looking for a way to deactivate or reactivate a script entierely in-game, via a script call. Is that possible?
The key is that only the script itself can deactivate it, and that only if the scripter programmed that option into it.


Some scripts already have that option, usually by switch or variable configuration.


Some scripts may be able to have that function added with a little reprogramming and rewriting of themselves.


Most scripts that don't have that option will require a big rewrite before that is possible.


And with "big rewrite" I'm talking about something that can take a programmer up to several weeks to work...
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Yep, it'll need to be done on a script-by-script basis, where the script is conditioned to run or not run based on some rules - might be as simple as a switch or variable (if you want it to be set on a game-by-game basis). You'll need to provide details of the individual scripts - meaning links to them.
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
Looks like I have a hard time figuring out what topic goes where. Apologies for that.

But yeah I think it's a little too ambitious for what it's worth, so I'm gonna drop the idea. Thanks for the help everyone.

Original thread: https://forums.rpgmakerweb.com/threads/load-unload-a-script-in-game.39682/