KOpenWeb ACE

KOpenWeb ACE

by Kyonides Arkanthes

​
Introduction

Did you ever want to let your gamers open your official website?
Now you can do it! 😀
Just read the instructions embedded in the script and you are good to go!

Ruby:
# * KOpenWeb ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-01-25

# This script is FREE as in BEER.
# It is distributed AS IS.
# No further changes will be added.

# Since most developers will only include a link to their own webiste,
# I crafted this scriptlet to let them open the default web browser via
# triggering the custom "Open My Website" command.
# The player will not notice any changes till the web browser finally opens.
# Feel free to customize the CONSTANTS found in the KOpenWeb module.

module KOpenWeb
  COMMAND_TEXT = "RMW Forums"
  COMMAND_INDEX = 2
  COMMAND_SYMBOL = :open_website
  WEBSITE_URL = "https://forums.rpgmakerweb.com/index.php"
end

class Window_TitleCommand
  include KOpenWeb
  alias :kyon_open_website_mk_cmd_list :make_command_list
  def make_command_list
    kyon_open_website_mk_cmd_list
    place_command(COMMAND_TEXT, COMMAND_SYMBOL)
  end

  def place_command(name, symbol)
    cmd = { name: name, symbol: symbol, enabled: true, ext: nil }
    @list.insert(COMMAND_INDEX, cmd)
  end
end

class Scene_Title
  include KOpenWeb
  alias :kyon_open_website_scn_title_ccw :create_command_window
  def create_command_window
    kyon_open_website_scn_title_ccw
    @command_window.set_handler(COMMAND_SYMBOL, method(:open_url))
  end

  def open_url
    Thread.new{ system("open " + WEBSITE_URL) }
    @command_window.activate
  end
end

Terms & Conditions

Free for any kind of projects.
Distributed AS IS. No further changes will be made.
Include my nickname in your game credits!
Do not repost it! Leave a link to this website instead.

Original thread: https://forums.rpgmakerweb.com/threads/kopenweb-ace.154406/