Website Launch from Title

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
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


Code: [Select]
#==============================================================================
#    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


  • modern algebra

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.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: May 04, 2010, 08:49:13 PM by modern algebra »

********
Furry Philosopher
Rep:
Level 93
Rawr?
2013 Best RPG Maker User (Creativity)Randomizer - GIAW 11Gold - GIAW 11 (Hard)Secret Santa 2013 ParticipantFor frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Mapping)2012 Best RPG Maker User (Programming)Secret Santa 2012 ParticipantGold - GIAW 9Project of the Month winner for September 2008For taking a crack at the RMRK Wiki2011 Best RPG Maker User (Programming)2011 Best Veteran2011 Kindest Member2010 Best RPG Maker User (Story)2010 Best RPG Maker User (Events)
Pretty cool. o.o




********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Whoa O.O

THAT'S COOL.

I suppose those with a website for their game would be interested in this for sure, or perhaps a puzzle game that has answers online that the player could cheat with if they're dumb (as an option)

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Thanks guys :)

*
Meet me in the middle
Rep:
Level 89
or left of the dial.
For frequently finding and reporting spam and spam botsSecret Santa 2012 Participant
you're welcome

**
Rep:
Level 81
?????????????
:dreamcast: Modern Algebra... It is cool... Your idea is very exciting...  :dreamcast:
遠い銀河からのスーパー戦士。
本は、セバスチャンです。
これは強力で、手に負えない。
彼の物理レベルのスキルは驚嘆です。[/b]

**
Rep: +0/-0Level 81
There is no end to learning!
That's a really good script.Is there anyway where we can add more than one link?I mean add two different websites on the title screen in two different rows.e.g. one saying 'Buy now' which leads to the game purchase page and the other 'Help' which shows game help on another web page?
"A thing of beauty is a joy forever" - Keats

**
Rep:
Level 82
Berka (another scriptor) suggest to change :
  system("start #{MAWLT_URL}")
by
  Thread.new{system("start #{MAWLT_URL}")}

By doing this , the webpage will come faster .
You can use my scripts freely . but not for commercial use .
:ccbync:
Don't encrypt your game !!!
Want to give me credit ? Easy ,add me in your game :

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
He's right - that's a great idea. I didn't think of it at the time, but that makes a lot of sense. Anyway, updated the script to version 1.1

**
Rep: +0/-0Level 81
GAMING IS FUN!!!!!!!!!! *throws ps3 pad at HD tv*
 :blizj:

I am loving the link. It is amazing.

I'm still new to rpg maker vx. Can i inquire on how to open the script for the quest? because i have downloaded it but i cant see the script or run it. Do i need a separate rpg editor to view it?
one does not just simply walk into Mordor

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Umm, how do you mean, and are you referring to my Quest Journal? If you are, then you can retrieve the script from the demo by going into the Script Editor (F11) and scrolling down to the bottom and copy and paste both the paragraph formatter and Quest Journal entries.

**
Rep: +0/-0Level 81
GAMING IS FUN!!!!!!!!!! *throws ps3 pad at HD tv*
Oh no worries :D thanx anyways.

i've found what i was looking for and the script is on POINT! lol. It works quite well...

Next task: making a very good quest (^_^)
one does not just simply walk into Mordor

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Zero to Hero2014 Best IRC Quote2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Necroposting = legal in scripting boards :D
I hope you don't mind, but I decided to add in a second URL function for your script. The configuration is mildly the same, with an added boolean to check if you want the second URL. I did this because I saw it earlier on in this thread and though it would be cool. So:
Code: [Select]
#==============================================================================
#    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

MAWLT_2 = true                # Use second URL?
MAWLT_COMMAND2 = "Modern Algebra"
MAWLT_INDEX2 = 3
MAWLT_URL2 = "http://rmrk.net/index.php?action=profile;u=2930"

#==============================================================================
# ** 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
    if MAWLT_2 == true
      @command_window.mawlt_add_command (MAWLT_INDEX2, MAWLT_COMMAND2)
      @command_window.index += 1 if @command_window.index >= MAWLT_INDEX2
    end
  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
    if Input.trigger? (Input::C) && @command_window.index == MAWLT_INDEX2
      Sound.play_decision
      Thread.new { system("start #{MAWLT_URL2}") }
    end
  end
end

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
I don't mind at all. Thanks for doing it.

I think you need to modify the index method there too though.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Zero to Hero2014 Best IRC Quote2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
To do what? It works fine without any editing of that method. In fact, if I do edit it, the game closes if you open the second URL for reasons that should be obvious to me, but are not.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
With your version, have you tried pressing the Shutdown option? It won't work. Also, the game already closes when you open the second URL without modifying, and the reason is that that method is returning 2 when the override boolean is true and the player selects the second URL, and so that tells the original update method that the Shutdown option was selected. Hence why it needs to be modified. Admittedly, it's a little tricky since the way I chose to do it was pretty weird to begin with. But I think you can do it.

I would have actually chosen a different method of adding to the command window if I wanted 2. That method kind of falls apart as the two indices interact strangely, especially if MAWLT_INDEX is greater than MAWLT_INDEX2). You should try to experiment a little bit and choose a better way to do it when adding mutiples. It would be a good little exercise.
« Last Edit: May 08, 2011, 02:28:45 AM by modern algebra »

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Zero to Hero2014 Best IRC Quote2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Doh.
Well, I have things to do at the moment, but I'll look at it later. Let's just hope nobody uses that.

*
Rep: +0/-0Level 63
RMRK Junior
It's Great!!
but i have some question..
if i want show it other place not in the menu

what should i do??

sorry i bad at english

**
Rep:
Level 66
Eternal Newbie
Super nice script. I personally will probably not use it (you never know though), but I'm wondering if you could use the same script to maybe create a script call to call a website in-game (like some kind of extras NPC for easter egg hunters).

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
You wouldn't need the whole script. The following in a script call would do itwould do it:

Code: [Select]
Thread.new { system("start http://rmrk.net") }

mind you, almost any website would make that too long for an event script call, but you could split it up like so:

Code: [Select]
w = "http://rmrk.net"
Thread.new { system("start #{w}") }

If even that would be too long, you can split w up further like this:

Code: [Select]
w = "http://rm"
w += "rk.net"
Thread.new { system("start #{w}") }

*
Rep: +0/-0Level 63
RMRK Junior
This a cool script for commercial games to give a website to your homepage in the demo. Only one problem: if your game is hosted on another site, they might not like it. I'll just have to ask around.