Website Launch from Title
Version: 1.1
Author: modern algebra
Date: April 5, 2010
Version History
- <Version 1.1> 05.04.2010 - Website loads much faster now
- <Version 1.0> 04.05.2010 - Original Release
Description
This script allows you to launch a website from the title screen. It will show an ugly command screen though.
Features
- Allows you to launch the website of your choice from the title screen.
- Gives you the option of what you want the command to be called and where it shows up in the command window.
Screenshots Instructions
See the header of the script.
Script
#==============================================================================
# Website Launch from Title
# Version: 1.1
# Author: modern algebra (rmrk.net)
# Date: May 4, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
# This simple script adds the option to launch a website from a command on
# the title screen. Only works in Windows, but RMVX only runs in Windows
# anyway, so that shouldn't be a problem.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
# Just go down to the configurable constants area at line 17 and read the
# instructions there to see what each constant is for. Set them accordingly
#==============================================================================
# ** CONFIGURABLE CONSTANTS
#==============================================================================
MAWLT_COMMAND = "RMRK" # The name of the new command
MAWLT_INDEX = 2 # Where the new command appears in the window
MAWLT_URL = "http://rmrk.net" # The full URL of the website to be launched
MAWLT_Y_OFFSET = -24 # Pixels Y coordinate of the window is offset by
#==============================================================================
# ** Window Command
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new accessor variable - mawlt_index_override
# new method - mawlt_add_command
# aliased method - draw_item
#==============================================================================
class Window_Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :mawlt_index_override
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add Command
# index : the position to add the command in
# command : the command to add
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def mawlt_add_command (index, command)
return unless @commands
@commands.insert (index, command)
@item_max += 1
self.y += MAWLT_Y_OFFSET
self.height = self.height + WLH
create_contents
disabled = []
@wlt_disabled_commands = [] unless @wlt_disabled_commands
@wlt_disabled_commands.each { |x| disabled.push (x >= index ? x + 1 : x) }
@wlt_disabled_commands.clear
refresh
disabled.each { |x| draw_item (x, false) }
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mal_wlt_drwitm_8yh1 draw_item
def draw_item (index, enabled = true, *args)
mal_wlt_drwitm_8yh1 (index, enabled, *args) # Run Original Method
@wlt_disabled_commands = [] unless @wlt_disabled_commands
@wlt_disabled_commands.push (index) if !enabled && !@wlt_disabled_commands.include? (index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Index
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_wlt_indxovrd_8km1 index
def index (*args)
indx = malg_wlt_indxovrd_8km1 (*args) # Run Original Method
return indx if !@mawlt_index_override || !Input.trigger? (Input::C) || indx < MAWLT_INDEX
return indx - 1 if indx > MAWLT_INDEX
return -1
end
end
#==============================================================================
# ** Scene Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - create_command_window, update
#==============================================================================
class Scene_Title
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create Command Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malgbr_wsitelaunch_crtcmmnd_9ol2 create_command_window
def create_command_window (*args)
malgbr_wsitelaunch_crtcmmnd_9ol2 (*args) # Run Original Method
@command_window.mawlt_add_command (MAWLT_INDEX, MAWLT_COMMAND)
@command_window.index += 1 if @command_window.index >= MAWLT_INDEX
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mawlt_update_7uj2 update
def update (*args)
@command_window.mawlt_index_override = true
mawlt_update_7uj2 (*args)
@command_window.mawlt_index_override = false
if Input.trigger? (Input::C) && @command_window.index == MAWLT_INDEX
Sound.play_decision
Thread.new { system("start #{MAWLT_URL}") }
end
end
end
Credit
Thanks
- Berka, for the idea to use a thread
- pelican1015, for the request
Support
Post here at RMRK.net for support.
Known Compatibility Issues
Won't work with any Title scripts that don't use a command window or are dramatically different. Otherwise should be fine. Will only work on Windows, but RMVX games only work in Windows anyway so I think you're OK on that front.
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.