Load/unload a script in game?

Zentsuki

Story teller
Veteran
Joined
Mar 14, 2015
Messages
109
Reaction score
18
First Language
French
Primarily Uses
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?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
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
 
Last edited by a moderator:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,422
First Language
English
Primarily Uses
RMXP
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
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
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...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Zentsuki

Story teller
Veteran
Joined
Mar 14, 2015
Messages
109
Reaction score
18
First Language
French
Primarily Uses
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.
 

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top