Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==============================================================================
- # ▼▼▼▼▼▼ TroyZ - Theo Dual Language Chooser ▼▼▼▼▼▼
- # ==============================================================================
- # Script by : Agung Prasetyo(TroyZ)
- # Contact me by : - Email agung.endisnear.xyz@gmail.com
- # - Forum RPGMakerID, username TroyZ
- # - Forum RPGMakerWeb.com, username TroyZ
- # - Forum RPGMakerVXAce.net, username TroyZ
- # - Forum rmrk.net, username TroyZ
- # Engine : VXAce
- # Level : Easy
- # Version : 1.0
- # ------------------------------------------------------------------------------
- # Change Logs :
- # 23 May 2015 : Version 1.0 released
- # ------------------------------------------------------------------------------
- # How this work :
- # Addon for Theo Script, TheoAllen - Dual Language. Now you can switch language
- # at the very beginning of the game, right before the title screen popup. This
- # also work for his Dual Command and Dual Terms script (you can use it together
- # with this script).
- # ------------------------------------------------------------------------------
- # How to use :
- # Place it between material and main. Notice the right order of the script or
- # it won't work :
- #
- # Theo - Dual Language
- # Theo - Dual Command
- # Theo - Dual Terms
- # TroyZ - Theo Dual Language Chooser
- #
- # Also, if you use it together with Theo - Splash Screen, the script order will
- # be like this :
- #
- # Theo - Dual Language
- # Theo - Dual Command
- # Theo - Dual Terms
- # Theo - Splash Screen
- # TroyZ - Theo Dual Language Chooser
- # ------------------------------------------------------------------------------
- # Compatibility issues :
- # None yet. If you found some, let me know, and bug fixes will come out soon.
- # ------------------------------------------------------------------------------
- # Who to credit :
- # - Allah swt. : For the chance of living that he has given to me.
- # - Nabi Muhammad saw. : As a leader and messenger and prophet of Muslim.
- # I'm proud to be your follower. :)
- # - Theo Allen : It's his script, credit him.
- # - Agung Prasetyo(TroyZ) : Thats me, of course, the ones that made this script. :P
- # ------------------------------------------------------------------------------
- # License :
- # - Free Game : For this script, just credit those names above. For Theo's
- # Script, follow his credit rules
- # - Commercial Game : Same as free game's license.
- # ------------------------------------------------------------------------------
- $imported = {} if $imported.nil?
- $imported[:TroyZ_TheoDualLanguageChooser] = true
- # ------------------------------------------------------------------------------
- # Configuration of scripts start here
- # ------------------------------------------------------------------------------
- module AGUNG
- module DUAL_LANG_CHOOSER
- DEFAULT_LANG = "English" # set to this language when the switch is OFF
- SECOND_LANG = "Indonesia" # set to this language when this switch is ON
- HELP_TEXT = "Pilih bahasa / Choose language" # description of language chooser
- end
- # ------------------------------------------------------------------------------
- # End of Configuration
- # ------------------------------------------------------------------------------
- # ------------------------------------------------------------------------------
- # There is nothing to config beyond this line
- # ------------------------------------------------------------------------------
- @var = false
- def self.var=(var)
- @var = var
- end
- def self.check_var
- return @var
- end
- def self.set_dual_lang_switches
- $game_switches[Theo::DualLang::Switch_ID] = true
- $game_switches[Theo::Dual_Switch] = true if $imported[:Theo_DualCMD]
- $game_switches[THEO::BASEITEM::DUAL_SWITCH] = true if $imported[:Theo_DualTerms]
- end
- def self.set_title_lang
- $game_switches = Game_Switches.new
- $game_switches[THEO::BASEITEM::DUAL_SWITCH] = true if $imported[:Theo_DualTerms]
- end
- end
- module SceneManager
- def self.first_scene_class
- $BTEST ? Scene_Battle : Scene_Lang_Chooser
- end
- end
- module DataManager
- class << self
- alias dual_setup_new_game setup_new_game
- end
- def self.setup_new_game
- dual_setup_new_game
- AGUNG.set_dual_lang_switches if AGUNG.check_var
- end
- end
- class Window_DualLang < Window_Command
- include AGUNG::DUAL_LANG_CHOOSER
- def initialize(x,y)
- super(x, y)
- self.openness = 0
- open
- end
- def window_width
- return 160
- end
- def make_command_list
- add_command(DEFAULT_LANG, :default_lang)
- add_command(SECOND_LANG, :second_lang)
- end
- end
- class Window_DualLang_Help < Window_Base
- include AGUNG::DUAL_LANG_CHOOSER
- def initialize(x, y)
- super(x, y, 300, fitting_height(1))
- refresh
- end
- def refresh
- draw_text(5,0,contents.width,contents.height,HELP_TEXT)
- end
- end
- class Scene_Lang_Chooser < Scene_Base
- def start
- super
- SceneManager.clear
- create_dual_lang_window
- create_dual_lang_help
- end
- def create_dual_lang_window
- @command_window = Window_DualLang.new(190, 200)
- @command_window.set_handler(:default_lang, method(:default_lang))
- @command_window.set_handler(:second_lang, method(:second_lang))
- end
- def create_dual_lang_help
- @duallang_help_window = Window_DualLang_Help.new(130,0)
- end
- def default_lang
- close_command_window
- AGUNG.var = false
- return SceneManager.goto(Splash_Screen) if $imported[:Theo_Splash]
- return SceneManager.goto(Scene_Title)
- end
- def second_lang
- close_command_window
- AGUNG.var = true
- AGUNG.set_title_lang
- return SceneManager.goto(Splash_Screen) if $imported[:Theo_Splash]
- return SceneManager.goto(Scene_Title)
- end
- def close_command_window
- @command_window.close
- update until @command_window.close?
- end
- def terminate
- @duallang_help_window.dispose
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement