Jump to content
TheDreamWriter

How to Easily Turn Scripts On or Off in the Script Editor

Recommended Posts

Hey, all!

 

This is a tiny little snippet that I use to disable scripts that I don't want running when I play-test my game from RMVXA.

 

For example, my game project currently has a splash screen that is 1 minute long. I don't want to watch this every time I play-test the game, so I disabled it using this simple snippet. It is just as easy to enable it, too.

 

Okay, here goes. At the top of the script, below the comments (green bits) but before the actual script, write the following bit of code

 

Note: I am using the Splash Screen script as my example. Where it says SplashScreenOn, write whatever you want. But NEVER repeat this in any other script.

 

module SplashScreenOn
 Script = false # true = on, false = off
end

if [splashScreenOn::Script] == true

 

Then have your script below this. At the bottom of the script, there will be an end. ABOVE this end, write the following code:

else
end

 

The bottom three lines will now read:

else
end
end

 

Simply change the "Script =" in the first codebox to true to turn the script on and false to turn it off.

 

This snippet is fully explained in the spoiler below for those who are interested in how it works. Otherwise, feel free to use! :

 

This snippet works with ALL scripts as long as it is placed correctly :)

 

 

"module SplashScreenOn"

This is defining what module you want to place the following line (Script = ...) in. By placing the "Script =" in the module, it can be called later on in the script.

 

"Script = ..."

This is defining whether you want the script to be on (true) or off (false) using the boolean expressions true and false.

 

"end"

This ends the module, meaning everything below is no longer included in the module. This "end" MUST be put here.

 

"if [splashScreenOn::Script] == true"

This is, essentially, a conditional branch in script form. It is saying that if the "Script" definition inside the "SplashScrenOn" module (that's what the "::" means) is set to true (on), then the script will run. If it is not set to true (i.e. false i.e. off) then it will jump to the else at the bottom of the script.

 

"else"

Like a conditional branch, if the "Script" inside the "SplashScreenOn" module is off (false), then the system will skip over the script and jump to this else.

 

"end"

By placing the end straight under the else, it means if that if [splashScreenOn::Script) is set to false, then the script will simply not run anything, because there is nothing in the "else" branch.

 

I hope that makes it clearer for you and have fun play-testing :)

 

 

Share this post


Link to post
Share on other sites

Script OFF:


=begin

 

msgbox 'active!'

 

"

=end #"

 

Script On:


#=begin

 

msgbox 'active!'

 

"

=end #"

Edited by Cidiomar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted