Save-Point
Enable/Disable Scripts Easily + Script Exist? - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: Enable/Disable Scripts Easily + Script Exist? (/thread-6783.html)



Enable/Disable Scripts Easily + Script Exist? - Tsunokiette - 12-08-2005

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.


This is for enabling/disabling scripts with ease, as well as returning whether or not a script exists in your editor.

Warning from TsunokietteHas not been tested yet.


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

* How to Use *




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)

Warning from TsunokietteThat should be all you need, If it doesn't work, please say so, as well I'd like any scripting 'Gurus' to help me develope this into something even simplar. Thank you for your time and interest.