My question is why is it that when I call getValue(name) in the code below, that 0 returns when I'm expecting an array. Thanks for reading
Note: I have two events on the map that each activate with action button. The first one calls "anotherMethod" while the second one calls getValue(name). First I talk to the first event than I talk to the second event but getValue(name) returns 0. I am unsure why that is.
More details: http://www.mediafire.com/?zca21o16sutpgxz
class exampleClass
attr_accessor :variableName
def initialize()
@variableName = {}
end
def someMethod()
@variableName["example"] = [1,2,3,4]
end
end
class Game_Interpreter
alias original_initialize initialize
def initialize(depth = 0)
original_initialize(depth)
$global_variable = exampleClass.new
end
def anotherMethod()
$global_variable.someMethod()
end
def getValue(name)
return $global_variable.variableName[name]
end
end
attr_accessor :variableName
def initialize()
@variableName = {}
end
def someMethod()
@variableName["example"] = [1,2,3,4]
end
end
class Game_Interpreter
alias original_initialize initialize
def initialize(depth = 0)
original_initialize(depth)
$global_variable = exampleClass.new
end
def anotherMethod()
$global_variable.someMethod()
end
def getValue(name)
return $global_variable.variableName[name]
end
end
Code:
More details: http://www.mediafire.com/?zca21o16sutpgxz