Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

HBGames

HTML Link
Version: 1.05

Introduction

This script will allow you to include links to webpages within your game and will open these webpages in the player's default web browser. To do this, simply call the following command:
Code:
A.href('name.of.webpage')
and replace 'name.of.webage' with the address of the webpage. Make sure it is entered as a string.
Examples:
Code:
A.href('www.google.com') #Opens Google's homepage in the default browser
A.href('http://www.google.com') # does the same
A.href('http://google.com') # and again
A.href('google.com') # yep, still Google's homepage

Screenshots

You open a webpage from within a game using the player's default web browser. You can see it, can't you?

Demo

Hosted by Geocities
Hosted in the Download Manager

Script

Code:
#=============================================================================
# ** HTML Link
#-----------------------------------------------------------------------------
# Draycos Goldaryn
# 1.05
# 07/02/07
# SDK Version : 2.2 - Part 1
#-----------------------------------------------------------------------------
# This script will allow you to include links to webpages within your game
# and will open these webpages in the player's default web browser.
# To do this, simply call the following command:
#    A.href('name.of.webpage')
# and replace 'name.of.webage' with the address of the webpage. Make sure it
# is entered as a string.
# Examples:
#   A.href('www.google.com') #Opens Google's homepage in the default browser
#   A.href('http://www.google.com') # does the same
#   A.href('http://google.com') # and again
#   A.href('google.com') # yep, still Google's homepage
#=============================================================================

#-----------------------------------------------------------------------------
# * SDK Log Script
#-----------------------------------------------------------------------------
SDK.log('HTML Link', 'Draycos Goldaryn', 1.05, '07/02/07')
SDK.check_requirements(2.20, [1], {'Aleworks Library' => 1.00})

#-----------------------------------------------------------------------------
# * Begin SDK Enable Test
#-----------------------------------------------------------------------------
if SDK.enabled?('HTML Link')

module A
  #--------------------------------------------------------------------------
  # ? instance variables
  #--------------------------------------------------------------------------
  attr_reader :browser
  attr_reader :browser_path

  #--------------------------------------------------------------------------
  # ? initialize
  #--------------------------------------------------------------------------
  def initialize
    @HLM = 'HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet'
    @browser = Aleworks::Registry.read_entry(@HLM, '')
    @HLM = 'HKEY_LOCAL_MACHINE' + '\\' + @HLM + '\\'
    @HLM += @browser + '\shell\open\command'
    @browser_path = Aleworks::Registry.read_entry(@HLM, '')
  end

  #--------------------------------------------------------------------------
  # ? a.href('name.of.webpage')
  #--------------------------------------------------------------------------
  def href(link)
    if link.is_a?(String)
      Thread.start{system(@browser_path, link)}
    else
      print 'Invalid command. Webpage must be entered as a string.'
    end
  end

  #--------------------------------------------------------------------------
  # ? module functions
  #--------------------------------------------------------------------------
  module_function :initialize
  module_function :href
end
A.initialize

#-----------------------------------------------------------------------------
# * End SDK Enable Test
#-----------------------------------------------------------------------------
end
This also requires SDK 2.2 part I and Aleworks Library

Instructions
Installation:
Insert the scripts in this order:
Default Scripts
SDK
Aleworks Library
HTML Link
Main​

Usage:
Simple: just call
A.href('name.of.webpage')
Just remember to change 'name.of.webpage' with, you guessed it, the http address of the webpage.

FAQ

Q: My game crashes when I use the command!
A: Make sure you enter the webpage address as a string.

Q: Why can't I open webpages with long names?
A: If you are calling this script from an event, split the string in the following format:
Code:
A.href('http://www.google.com/' +
'search?q=RPG+Maker+XP')

Compatibility

There shouldn't be any compatablitity issues, though it does require Part 1 of the SDK 2.2 or greater, and Aleworks Library version 1.00

Credits and Thanks

Thanks to the SDK team, and to Aleworks (aka vgvgf).

Terms and Conditions

Free to use, just credit Draycos Goldaryn.
Also credit Aleworks for his library.
Yes, you can use it in a commercial game. Only credit is required.

Notes

Wow, this script has gone international! I randomly google my name at times and i found a link to a planetarpg.com.ar but the thread where my script was posted must have been deleted :( I also found a link to a polish site where they also posted my script and even provided a link to the demo located in the download manager!

If anyone else knows of other sites where this script has been posted, can you let me know? If anyone else wants to post this script on another site, feel free, just, please, let me know too. And don't forget to provide the proper credit!

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top