The unless $@
was a snippet I picked up from a tutorial ages ago.
As far as I can tell, it basically says
alias new_method_name original_method_name unless new_method_name.exists?
You need the unless $@
for when you're dealing with the hidden scripts, such as Window and Audio, because when you do a soft reset (hit F12 during gameplay) it doesn't reload the hidden scripts, only the ones in the script editor.
And it becomes a problem because since it didn't reload the hidden scripts, the hidden scripts never remade original_method_name, so when you try and alias it problems occur
@> stripe103: A fair chunk of the hidden scripts can be found in the Pokemon Starter Kit, but since I just aliased the method I didn't have to look at it to figure out what I needed to change (you're the one who mentioned that the window needs to be set to self.active = false
for the update for class window)