KOpenWeb VX

KOpenWeb VX

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 VX * #
#   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"
  # Options: :new, :load, :web, :shut
  COMMAND_ORDER = [:new, :load, :web, :shut]
  WEBSITE_URL = "https://forums.rpgmakerweb.com/index.php"
end

class Scene_Title
  include KOpenWeb
  def next_command(sym)
    case sym
    when :new
      @new_game_pos = @options.size
      @options << Vocab.new_game
    when :load
      @continue_pos = @options.size
      @options << Vocab.continue
    when :web
      @website_pos = @options.size
      @options << COMMAND_TEXT
    when :shut
      @shutdown_pos = @options.size
      @options << Vocab.shutdown
    end
  end

  def create_command_window
    @options = []
    COMMAND_ORDER.each{|cmd| next_command(cmd) }
    @command_window = Window_Command.new(172, @options)
    @command_window.x = (544 - @command_window.width) / 2
    @command_window.y = 248
    if @continue_enabled
      @command_window.index = @continue_pos
    else
      @command_window.draw_item(@continue_pos, false)
    end
    @command_window.openness = 0
    @command_window.open
  end

  def update
    super
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when @new_game_pos
        command_new_game
      when @continue_pos
        command_continue
      when @website_pos
        command_open_url
      when @shutdown_pos
        command_shutdown
      end
    end
  end

  def command_open_url
    Sound.play_decision
    Thread.new{ system("open " + WEBSITE_URL) }
  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-vx.154415/