Need help creating a Class Variable - Endless loop results

Hi - I'm doing some tests, at trying to use Scene_Base to have it's own "event" when a game starts, I'm doing that using an aliased update method. But the results seem to loop constantly.

Code:
class Scene_Base
 
  attr_accessor :doOncetest
  @@doOncetest = 0
 
  alias do_Once_alias update
  def update
  do_Once_alias
   
     if @@doOncetest == 0
      @@doOncetest == 1
      $game_message.add("*It's looping forever!! Panic!!*")
    end
   
  end
   
end

I think I understand why - it's because the @@doOnce is constantly being set to 0 - so it's stuck in a loop of going to 0, then setting itself to 1 and playing the text. But I'm unsure how else I'd set it to a number - just once.



(I'm sure I'll get advice to do an easier method, using events, etc. but I am trying to understand the code better - so I'd still like to understand what to do in a situation where it had to be done this way.)
You're not setting @@doOncetest to 1; you're testing if it's equal to one.
i.e. SET: @@doOncetest = 1 vs TEST: @@doOncetest == 1
It's always something really simple and something that should be obvious to me - thanks a lot though! It was driving me crazy I couldn't figure that out before work.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-creating-a-class-variable-endless-loop-results.97793/