Added scripts
This commit is contained in:
parent
d40ae86ba4
commit
5118df09f4
106 changed files with 15680 additions and 0 deletions
36
scripts/Game_Variables.rb
Normal file
36
scripts/Game_Variables.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
#==============================================================================
|
||||
# ** Game_Variables
|
||||
#------------------------------------------------------------------------------
|
||||
# This class handles variables. It's a wrapper for the built-in class "Array."
|
||||
# Refer to "$game_variables" for the instance of this class.
|
||||
#==============================================================================
|
||||
|
||||
class Game_Variables
|
||||
#--------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#--------------------------------------------------------------------------
|
||||
def initialize
|
||||
@data = []
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Get Variable
|
||||
# variable_id : variable ID
|
||||
#--------------------------------------------------------------------------
|
||||
def [](variable_id)
|
||||
if variable_id <= 5000 and @data[variable_id] != nil
|
||||
return @data[variable_id]
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Set Variable
|
||||
# variable_id : variable ID
|
||||
# value : the variable's value
|
||||
#--------------------------------------------------------------------------
|
||||
def []=(variable_id, value)
|
||||
if variable_id <= 5000
|
||||
@data[variable_id] = value
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue