CyberForte

DoW Website Launch

Oct 10th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.95 KB | None | 0 0
  1. #==============================================================================
  2. #    Website Launch from Title
  3. #    Version: 1.1
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: May 4, 2010
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #    This simple script adds the option to launch a website from a command on
  9. #   the title screen. Only works in Windows, but RMVX only runs in Windows
  10. #   anyway, so that shouldn't be a problem.
  11. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  12. #  Instructions:
  13. #    Just go down to the configurable constants area at line 17 and read the
  14. #   instructions there to see what each constant is for. Set them accordingly
  15. #==============================================================================
  16. # ** CONFIGURABLE CONSTANTS
  17. #==============================================================================
  18. MAWLT_COMMAND = "Support Dev"        # The name of the new command
  19. MAWLT_INDEX = 3               # Where the new command appears in the window
  20. MAWLT_URL = "https://www.patreon.com/sierralee" # The full URL of the website to be launched
  21. MAWLT_Y_OFFSET = -24          # Pixels Y coordinate of the window is offset by
  22.  
  23. #==============================================================================
  24. # ** Window Command
  25. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  26. #  Summary of Changes:
  27. #    new accessor variable - mawlt_index_override
  28. #    new method - mawlt_add_command
  29. #    aliased method - draw_item
  30. #==============================================================================
  31.  
  32. class Window_Command
  33.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34.   # * Public Instance Variables
  35.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36.   attr_accessor :mawlt_index_override
  37.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38.   # * Add Command
  39.   #    index   : the position to add the command in
  40.   #    command : the command to add
  41.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42.   def mawlt_add_command (index, command)
  43.     return unless @commands
  44.     @commands.insert (index, command)
  45.     @item_max += 1
  46.     self.y += MAWLT_Y_OFFSET
  47.     self.height = self.height + WLH
  48.     create_contents
  49.     disabled = []
  50.     @wlt_disabled_commands = [] unless @wlt_disabled_commands
  51.     @wlt_disabled_commands.each { |x| disabled.push (x >= index ? x + 1 : x) }
  52.     @wlt_disabled_commands.clear
  53.     refresh
  54.     disabled.each { |x| draw_item (x, false) }
  55.   end
  56.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  57.   # * Draw Item
  58.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  59.   alias mal_wlt_drwitm_8yh1 draw_item unless $@
  60.   def draw_item (index, enabled = true, *args)
  61.     mal_wlt_drwitm_8yh1 (index, enabled, *args) # Run Original Method
  62.     @wlt_disabled_commands = [] unless @wlt_disabled_commands
  63.     @wlt_disabled_commands.push (index) if !enabled && !@wlt_disabled_commands.include? (index)
  64.   end
  65.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  66.   # * Index
  67.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68.   alias malg_wlt_indxovrd_8km1 index unless $@
  69.   def index (*args)
  70.     indx = malg_wlt_indxovrd_8km1 (*args) # Run Original Method
  71.     return indx if !@mawlt_index_override || !Input.trigger? (Input::C) || indx < MAWLT_INDEX
  72.     return indx - 1 if indx > MAWLT_INDEX
  73.     return -1
  74.   end
  75. end
  76.  
  77. #==============================================================================
  78. # ** Scene Title
  79. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  80. #  Summary of Changes:
  81. #    aliased methods - create_command_window, update
  82. #==============================================================================
  83.  
  84. class Scene_Title
  85.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86.   # * Create Command Window
  87.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88.   alias malgbr_wsitelaunch_crtcmmnd_9ol2 create_command_window unless $@
  89.   def create_command_window (*args)
  90.     malgbr_wsitelaunch_crtcmmnd_9ol2 (*args) # Run Original Method
  91.     @command_window.mawlt_add_command (MAWLT_INDEX, MAWLT_COMMAND)
  92.     @command_window.index += 1 if @command_window.index >= MAWLT_INDEX
  93.   end
  94.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95.   # * Update
  96.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  97.   alias mawlt_update_7uj2 update unless $@
  98.   def update (*args)
  99.     @command_window.mawlt_index_override = true
  100.     mawlt_update_7uj2 (*args)
  101.     @command_window.mawlt_index_override = false
  102.     if Input.trigger? (Input::C) && @command_window.index == MAWLT_INDEX
  103.       Sound.play_decision
  104.       Thread.new { system("start #{MAWLT_URL}") }
  105.     end
  106.   end
  107. end
Advertisement
Add Comment
Please, Sign In to add comment