12-08-2005, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
This is for enabling/disabling scripts with ease, as well as returning whether or not a script exists in your editor.
EDIT: see later post
add this attribute accessor to each script you want to be able to enable/disable-
Code:
attr_accessor :status
and then under the initialize method, add this -
Code:
#-----------------
# alias initialize
#-----------------
alias :initialize_original :initialize
def initialize
@status = 'enabled'
initialize_original
end
#---------
# Status
#---------
def status
return @status
end
To call a script with the newly added enable/disable ability, simply use this line
Code:
Script.new(script_name)
eg.
Code:
Script.new(Scene_Menu)
even if it's a scene
To disable it, use this line
Code:
Script.disable(script_name)
eg.
Code:
Script.disable(Scene_Menu)
To enable a script once it's been disabled, use this line
Code:
Script.enable(script_name)
eg.
Code:
Script.enable(Scene_Menu)
To return whether or not a script exists in the editor, use this line
Code:
Script.exist?(script_name)
eg.
Code:
Script.exist?(Scene_Menu)