Save-Point
Name Game Switch & Variable RG - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+--- Thread: Name Game Switch & Variable RG (/thread-8773.html)



Name Game Switch & Variable RG - kyonides - 06-27-2023

Name Game Switch & Variable RG
The Scripting Tool

by Kyonides

Introduction

This script was made for all of the RGSS based RPG Makers available out there!

Are you bored of getting a Game Switch or a Game Variable by using a Number that's easy to forget?
Don't worry about! Grinning I've got the perfect solution for you!

Use the script posted below and you'll be able to set or access its contents scriptwise.

It has several script calls you can manage at any given moment.

Take in consideration that my script is not for everyone, especially not for novice Sculptor game developers!

The Script

Code:
# * Name Game Switch & Variable RG * #
#  Scripter : Kyonides Arkanthes
#  2023-06-27

# * Basic Scripting Tool * #
# * Not Intended for use by Novice Game Developers * #
# * Never use Old Save Files! * #

# Please set a Game Switch or Game Variable Name before calling its get method.

# $game_switches.set("Name", ID)
# $game_switches.set("Name", ID, true)
# $game_switches.get("Name")  - Identical to on?
# $game_switches.on?("Name")  - Identical to get
# $game_switches.names        #=> Lists All Names Used So Far
# $game_switches.total_names  #=> Returns Hash Size

# $game_variables.set("Name", ID)
# $game_variables.set("Name", ID, 100)
# $game_variables.get("Name")
# $game_variables.names      #=> Lists All Names Used So Far
# $game_variables.total_names #=> Returns Hash Size

module NameGameSV
  def get(name)
    data_id = @names[name]
    @data[data_id]
  end

  def set(name, data_id, value=NAMES_DEFAULT)
    @names[name] = data_id
    @data[data_id] = value
  end

  def clear_names
    @names = {}
  end

  def total_names
    @names.size
  end
  attr_reader :names
end

class Game_Switches
  include NameGameSV
  NAMES_DEFAULT = false
  alias :kyon_name_gs_gv_gm_swi_init :initialize
  def initialize
    kyon_name_gs_gv_gm_swi_init
    clear_names
  end
  alias :on? :get
end

class Game_Variables
  include NameGameSV
  NAMES_DEFAULT = 0
  alias :kyon_name_gs_gv_gm_var_init :initialize
  def initialize
    kyon_name_gs_gv_gm_var_init
    clear_names
  end
end

Terms & Conditions

Free for use in any game. Gamer
Due credit is optional.
That's it!