[VX Ace] modern algebra's Global Text Codes error

I know what's causing this issue, but not WHY it's causing this issue. The Global Text Codes script by modern algebra is giving me the error

"undefined method 'gsub' for nil:NilClass", and I've found that it's due to a snippet of code I found and edited.


Ruby:
class Scene_Battle < Scene_Base
  alias gam_aakreq_use_item use_item
  def use_item
    gam_aakreq_use_item
    @help_window.refresh
  end
end


In my game, the item description of a specific item is suppose to update every time it's used via variables, though without this snippet of code, it requires the player to manually refresh the description of the item by viewing another item and coming back. This snippet of code works perfectly fine outside of causing the Global Text Codes script to crash. The crash always occurs after an action, and I've tested it a few times. It doesn't matter what action is taken, it always crashes. As for what the edit was, I simply changed it so that occurs in battle instead of in the menu.

I've also looked into what gsub actuallyis, and considering the nature of the code snippet, I guess I can see why it would crash, but I think it would be better if someone more experienced with ruby helped me out here, because after searching around, I can't really find any solutions, myself.

Thank you in advance.
Basically nothing of your edits sounds as if it has anything to do with the error. They might still be connected, but NOT directly.

"undefined method x of nil:nilclass" basically says that you tried to call a method for a data object that does not exist.
that can only happen if either there is a typo in the call, or if the data object has been deleted.

so either you really messed up the edits by creating non-functional code, or your edits removed or renamed a complete object/class, or the error comes from somewhere else than you imagined.

I strongly suggest you follow the link of "how to use a script" in my signature to the bughunting section, download and install the backtracer, and get the error again but this time with a screenshot of the backtracer output so that we can check what really happened in your game.
Basically nothing of your edits sounds as if it has anything to do with the error. They might still be connected, but NOT directly.

"undefined method x of nil:nilclass" basically says that you tried to call a method for a data object that does not exist.
that can only happen if either there is a typo in the call, or if the data object has been deleted.

so either you really messed up the edits by creating non-functional code, or your edits removed or renamed a complete object/class, or the error comes from somewhere else than you imagined.

I strongly suggest you follow the link of "how to use a script" in my signature to the bughunting section, download and install the backtracer, and get the error again but this time with a screenshot of the backtracer output so that we can check what really happened in your game.

First, I have the one from my current project:
(the slight edits I've made to some scripts change the line slightly)
vxaceError0.png


Second, I made a new project and only put the three scripts, proving my slight edits thankfully are not related: (only code snippet, global text codes, and backtracer were included)
vxaceError1.png


It's times like these where I'm happy I organize and properly name scripts.
I got impatient and tried to fix it myself. I completely and 100% blindly guessed what I should do, and made it so that the help window, when refreshing, converted the text to a string with .to_s, and it worked. I am in genuine shock. Thank you to anyone trying to help, but it seems the problem has been solved with a simple blind guess from me.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-modern-algebras-global-text-codes-error.137926/