The Code is correkt, but seemingly $game_switches is not an object of Game_Switches Class, but an object of True-Class.
You can check it with
p $game_switches.class
Maybe you have written anywhere
$game_switches = true
instead of
$game_switches[1] = true
Nevertheless I wouldn`t use switches for your script. Use ruby-variables.
class Quest
attr_accessor(:need_update)
def initialize
@need_update = false
end
end
Now you can write
if @need_update
@quest_window.update
@quest_rewards.update
end
You can change the variable @need_update in the object or in a higher instance with @quest_object.need_update = true
@Altorn:
a = b #means: create a reference between a and b (or by booleans and integers: a get the value of b)
a == b #means: return true if the condition is correct. Return false if the condition is false
if a then do_something end #means: do_something if a is not false or nil
unless a then do_somethin end #means: do_something if a is not true