RPG Maker
 

 Username:
 Password:
   Not a member? Register!

Home > RGSS Script Reference > Game_Variables

Game_Variables


Inherits from: None

Description: This class holds the game variables and has methods for assigning and getting data from variables.

Code


class Game_Variables
# ------------------------------------
  def initialize
    @data = []
  end
# ------------------------------------  
 def [](variable_id)
    if variable_id <= 5000 and @data[variable_id] != nil
      return @data[variable_id]
    else
      return 0
    end
  end
# ------------------------------------
def []=(variable_id, value)
    if variable_id <= 5000
      @data[variable_id] = value
    end
  end
end    

Properties


Data: The array of game variables. Contains 5000 integer variables that can have a value between -99999999 and 99999999.

Methods


Initialize

Arguments: None
Local Variables: None

How it Works: Initializes the variable array to an empty array.

[]

Arguments:
Variable_ID: The array index of the variable value to return.
Local Variables: None

How it Works: This method returns the current value associated with the variable ID passed to it. If the variable ID is 5000 or less and isn't nil, the current value of the variable is returned. Otherwise, the method returns 0 because a value hasn't been assigned to the variable yet.

[]=

Arguments:
Variable_ID: The array index of the variable to set.
Value: An integer representing the value to assign to that variable.
Local Variables: None

How it Works: This method sets the current value associated with the variable ID passed to it to the value passed to the method. If the variable ID is 5000 or less, the variable is set to that value. Otherwise, the method does nothing because the variable ID isn't valid. 
Syntax
@
@@
$
alias
[array index]
attr_accessor
attr_reader
attr_writer
class
def
do
ensure
for
if
[iterator]
key => value
new
next
nil
redo
require
return
rescue
self
super
undef
unless
until
while
yield

Classes
Arrow_Actor
Arrow_Base
Arrow_Enemy
Game_Actor
Game_Actors
Game_BattleAct
Game_Battler
Game_Character
Game_Common
Game_Enemy
Game_Event
Game_Map
Game_Party
Game_Picture
Game_Player
Game_Screen
Game_SlfSwitch
Game_Switches
Game_System
Game_Troop
Game_Variables
Interpreter
Scene_Debug
Scene_End
Scene_Equip
Scene_File
Scene_Gameover
Scene_Item
Scene_Load
Scene_Map
Scene_Menu
Scene_Name
Scene_Save
Scene_Shop
Scene_Skill
Scene_Status
Scene_Title
Sprite_Battler
Sprite_Character
Sprite_Picture
Sprite_Timer
Spriteset_Battle
Spriteset_Map
Window_Base
Window_Battleresult
Window_Battlestatus
Window_Command
Window_DebugLeft
Window_DebugRight
Window_EquipItem
Window_EquipLeft
Window_EquipRight
Window_Gold
Window_Help
Window_InputNumb
Window_Item
Window_MenuStatus
Window_Message
Window_NameEdit
Window_NameInput
Window_PartyCom
Window_PlayTime
Window_SaveFile
Window_Selectable
Window_ShopBuy
Window_ShopCom
Window_ShopNum
Window_ShopSell
Window_ShopStatus
Window_Skill
Window_SkillStatus
Window_Status
Window_Steps
Window_Target

Other
Class Hierarchy
Global Variables


RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the Terms of Use.
©2004 - 2008 RPG RPG Revolution, All Rights Reserved. Contact Us · Privacy Policy · Legal Disclaimer
eXTReMe Tracker