Have to say, creating a hash table of symbols (or if you are wary of typos, an array/hash with constants for indices/keys) does also sound like a good solution here.
Edit: You could also use a Struct instead of a hash table.
Otherwise I would gravitate to kyonides's solution (although you could do something like
Another option would be to use
(documentation) which allows you to access random methods of $game_system, the method name can be a symbol or string (although at this point I would probably prefer the hash table method).
E.g.
Another option would be to make a wrapper object that you can modify as you like:
Edit: You could also use a Struct instead of a hash table.
Otherwise I would gravitate to kyonides's solution (although you could do something like
$game_system.settings.dup to single out your settings only)Another option would be to use
$game_system.send( methodname, argument1, argument2, ... )(documentation) which allows you to access random methods of $game_system, the method name can be a symbol or string (although at this point I would probably prefer the hash table method).
E.g.
Ruby:
class Game_System
attr_accessor :dungeon_size
end
# ...
$game_system.send("dungeon_size") # nil
$game_system.send("dungeon_size=", 17) # 17
$game_system.send("dungeon_size") # 17
Another option would be to make a wrapper object that you can modify as you like:
Ruby:
class Setting
attr_accessor :value
def initialize(initial_value = nil)
@value = initial_value
end
end