Zeriab's Autoswitcher
by Zeriab
Introduction
This is Zeriab's much better version of the Autoswitcher. It totally pwns my version and it's very easy to use. I was posting my Autoswitcher in Seph's forums and then Seph and Zeriab thought of much better solutions to do it. I liked Zeriab's solution because it was a short piece of code yet it did what it was supposed to do which was activate certain switches and adjust certain variables before the game began.Punk":2c0jpefc said:After years of creating event systems, one thing I had grown tired of was having to make a map event activate some switch just to start a couple of my common events. No more having to activate the switch via some random map! *celebrates*
This script allows the game creator to activate the switches they want to activate AND alter the values of the variables they want altered.
Features
- Very easy to use.
- Activates switches you want activated.
- Alters variables you want altered.
- Activates and adjusts before your game starts
- You no longer have to rely on an event in a particular map to activate a few switches and change the variables.
No screenshots or demos needed. Instructions are easy to follow, the script is easy to use.
Script
XP users
You could create a new script above main and then copy/paste the code from the spoiler below!
VX users
Create a new script inside "Materials" and then copy/paste the code from the spoiler below!
Code:
class Game_Switches
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@data = []
@data[1] = true # Switch 1 = true
@data[6] = true # Switch 6 = true
end
end
class Game_Variables
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@data = []
@data[1] = 20 # Variable 1 = 20
@data[4] = -3 # Variable 4 = -3
@data[2] = 42 # Variable 2 = 42
end
end
Instructions
Let's take a look at a couple of things you may not be so sure of.
Switch ID.class Game_Switches
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@data = []
@data[1] = true # Switch 1 = true
@data[6] = true # Switch 6 = true
end
end
true (switch is ON) or false (switch is OFF)
I'm definitely no scripting genius but this part of the script does the game switch related stuff. Now I'm sure you'd like to know, what are those?
As you can see, the code highlighted in green is the switch ID. The code highlighted in red decides whether the switch is either on or off by default with a true or false.
You can turn on an additional switch in your game by adding this code somewhere after "@data =[]" and before the first "end"
Code:
@data[[COLOR=green]id[/COLOR]] = [COLOR=red]true[/COLOR]
Variable IDclass Game_Variables
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@data = []
@data[1] = 20 # Variable 1 = 20
@data[4] = -3 # Variable 4 = -3
@data[2] = 42 # Variable 2 = 42
end
end
Value of the Variable ID
I'm definitely no scripting genius but this part of the script does game variable related stuff. Now I'm sure you'd like to know, what are those?
As you can see, the code highlighted in orange is the variable ID. The code highlighted in yellow will be the default value of the variable ID. It could be a negative or positive integer.
FAQs
Awaiting question.
Compatibility
It is compatible with RPG Maker VX!
It's very likely that it is SDK compatible. I've not checked yet.
Author's Notes
Zeriab":2c0jpefc said:If you get any issues at all when inserting and using this script then make an evented solution instead.
Should you get any issues or have any problems using this script? Event it instead.
There is no reason to ask, because that would be my answer.
Punk":2c0jpefc said:I recommend this script as it's much better than my attempt at a script which could activate switches and adjust variables when the game starts.
Credits
Credit Zeriab for the script.
Credit Punk for the idea.