pigu_6

Modern algebra| Website Launch from Title

Nov 24th, 2012
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. #==============================================================================
  2. # Website Launch from Title [VXA]
  3. # Version: 1.0
  4. # Author: modern algebra (rmrk.net)
  5. # Date: December 11, 2011
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. # Description:
  8. #
  9. # This simple script adds the option to launch website from a command on
  10. # the title screen. Only works in Windows, but RMVXA only runs in Windows
  11. # anyway, so that shouldn't be a problem. With this script, you can add
  12. # multiple commands that open different websites.
  13. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  14. # Instructions:
  15. #
  16. # Paste this script into its own slot above Main and below Materials.
  17. #
  18. # Just go down to the configurable constants area at line 27 and read the
  19. # instructions there to see how to set up a new website launch command.
  20. #==============================================================================
  21.  
  22. $imported = {} unless $imported
  23. $imported[:MAWebsiteLaunchTitle] = true
  24.  
  25. MAWLT_TITLE_WEBSITE_COMMANDS = [
  26. #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  27. # EDITABLE REGION
  28. #``````````````````````````````````````````````````````````````````````````````
  29. # For each website launching command you want to include, simply add an
  30. # array at line 45 with the following data, in the following order:
  31. #
  32. # ["Command Name", index, "url address"]
  33. #
  34. # "Command Name" is what will show up in the command window itself.
  35. # index is an integer and it determines in what order the command appears
  36. # "url address" is the URL opened when the command is pressed.
  37. #
  38. # If you wish to add more than one website command, you may, but remember to
  39. # add a comma after all but the last array. It would look like this:
  40. #
  41. # ["Command Name 1", index, "url address 1"],
  42. # ["Command Name 2", index, "url address 2"],
  43. # ["Command Name 3", index, "url address 3"]
  44. #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  45. ["Titulo del link que llevara a tu web", 2, "http://Url de tu web/"]
  46. #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  47. # END EDITABLE REGION
  48. #//////////////////////////////////////////////////////////////////////////////
  49. ]
  50.  
  51. #==============================================================================
  52. # ** Window_TitleCommand
  53. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  54. # Summary of Changes:
  55. # aliased method - make_command_list; update_placement
  56. #==============================================================================
  57.  
  58. class Window_TitleCommand
  59. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. # * Make Command List
  61. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  62. alias ma_wlft_mkcommands_7yh8 make_command_list
  63. def make_command_list(*args, &block)
  64. ma_wlft_mkcommands_7yh8(*args, &block) # Run Original Method
  65. MAWLT_TITLE_WEBSITE_COMMANDS.each_index { |i|
  66. website = MAWLT_TITLE_WEBSITE_COMMANDS[i]
  67. add_command(website[0], "website_launch_#{i}".to_sym)
  68. @list.insert(website[1], @list.pop)
  69. }
  70. end
  71. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  72. # * Update Placement
  73. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74. alias ma_wlft_updplace_5fh2 update_placement
  75. def update_placement(*args, &block)
  76. ma_wlft_updplace_5fh2(*args, &block) # Run Original Method
  77. # Make sure title window doesn't go off screen
  78. self.y = Graphics.height - height if self.y + height > Graphics.height
  79. end
  80. end
  81.  
  82. #==============================================================================
  83. # ** Scene_Title
  84. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  85. # Summary of Changes:
  86. # aliased method - create_command_window
  87. #==============================================================================
  88.  
  89. class Scene_Title
  90. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  91. # * Create Command Window
  92. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  93. alias ma_wlft_crtcmmndwin_3kj9 create_command_window
  94. def create_command_window(*args, &block)
  95. ma_wlft_crtcmmndwin_3kj9(*args, &block) # Run Original Method
  96. MAWLT_TITLE_WEBSITE_COMMANDS.each_index { |i|
  97. website = MAWLT_TITLE_WEBSITE_COMMANDS[i]
  98. @command_window.set_handler("website_launch_#{i}".to_sym,
  99. lambda {
  100. Thread.new { system("start #{website[2]}") }
  101. @command_window.activate
  102. })
  103. }
  104. end
  105. end
Advertisement
Add Comment
Please, Sign In to add comment