Jump to content
Sign in to follow this  

Recommended Posts

KOpenWeb
XP + VX + ACE

by Kyonides Arkanthes

Introduction

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

XP Script

Spoiler

# * KOpenWeb XP * #
#   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_NEW = "New Game"
  COMMAND_WEB = "Save-Point"
  COMMAND_CONTINUE = "Continue"
  COMMAND_END = "Shutdown"
  COMMANDS = [COMMAND_NEW, COMMAND_CONTINUE, COMMAND_WEB, COMMAND_END]
  WEBSITE_URL = "https://www.save-point.org/"
end

class Scene_Title
  include KOpenWeb
  alias :kyon_open_website_scn_title_up :update
  def load_data_files
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
  end

  def main
    if $BTEST
      battle_test
      return
    end
    load_data_files
    $game_system = Game_System.new
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    make_command_window
    check_saved_games
    handle_audio
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    terminate
  end

  def make_command_window
    @command_window = Window_Command.new(192, COMMANDS)
    @command_window.back_opacity = 160
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 288
    @continue_enabled = false
    @new_cmd_pos = COMMANDS.index(COMMAND_NEW)
    @load_cmd_pos = COMMANDS.index(COMMAND_CONTINUE)
    @web_cmd_pos = COMMANDS.index(COMMAND_WEB)
    @end_cmd_pos = COMMANDS.index(COMMAND_END)
  end

  def check_saved_games
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
        break
      end
    end
    if @continue_enabled
      @command_window.index = @load_cmd_pos
    else
      @command_window.disable_item(@load_cmd_pos)
    end
  end

  def handle_audio
    $game_system.bgm_play($data_system.title_bgm)
    Audio.me_stop
    Audio.bgs_stop
    Graphics.transition
  end

  def terminate
    Graphics.freeze
    @command_window.dispose
    @sprite.bitmap.dispose
    @sprite.dispose
  end

  def update
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when @load_cmd_pos
        command_continue
      when @new_cmd_pos
        command_new_game
      when @web_cmd_pos
        command_open_url
      when @end_cmd_pos
        command_shutdown
      end
    end
  end

  def command_open_url
    $game_system.se_play($data_system.decision_se)
    Thread.new{ system("open " + WEBSITE_URL) }
  end
end

 


VX Script

Spoiler

# * 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

 


VX ACE Script

 

# * 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.

kopenweb_ace.rb

kopenweb_vx.rb

kopenweb_xp.rb

Edited by kyonides

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted