script/coding issue

I've been following this tutorial but I've been modifying it so it could fit a dart board minigame instead.

Issue is that I've been hit by a code error saying:
"
'Game_Interpreter' line 450: NoMethodError occurred.

undefined method 'value' for nil:NilClass"

the error happens when I reach this part of the code:
$gameVariables.value(61) >= $gameVariables.value(64) && $gameVariables.value(61) <= $gameVariables.value(65)
1696829053050.png


Which is the same as the tutorial except their variables are in the 20s
That tutorial is for MV/MZ. VXAce's code is different, and uses a different script call list. You can check the script call list at https://forums.rpgmakerweb.com/index.php?threads/script-call-collection-for-vxace.25759/

Try using $game_variables[n] instead of $gameVariables.value(n), where n is the variable number.
That said, it might also help you to learn how to read an error message.
undefined method 'value' for nil:NilClass"

This error message means that the "parent" to value does not exist, it has nothing to do with value itself.
So it basically tells you "I have no idea what $gameVariables is when I try to get $gameVariables.value
That tutorial is for MV/MZ. VXAce's code is different, and uses a different script call list. You can check the script call list at https://forums.rpgmakerweb.com/index.php?threads/script-call-collection-for-vxace.25759/

Try using $game_variables[n] instead of $gameVariables.value(n), where n is the variable number.


OHHH, THANK YOU
that makes a lot more sense. I thought it might have to do with MV/Ace incompatibility stuff. I'll be using that link for future references!
That said, it might also help you to learn how to read an error message.


This error message means that the "parent" to value does not exist, it has nothing to do with value itself.
So it basically tells you "I have no idea what $gameVariables is when I try to get $gameVariables.value
Yeah! I understood a bit of it when i first got the message but wasn't sure what it was fully. Thanks for explaining it more in-depth!
Perhaps this new methods can make it a lot easier to use them in script condition boxes.
Yeah, this scriptlet belongs to a brand new section in the script editor window.
By the way, this code works in RMXP, VX and VX ACE.

Ruby:
class Game_Variables
  def equal?(m, n)
    @data[m] ||= 0
    @data[m] == @data[n] ||= 0
  end

  def first_higher?(m, n)
    @data[m] ||= 0
    @data[m] > @data[n] ||= 0
  end

  def first_lower?(m, n)
    @data[m] ||= 0
    @data[m] < @data[n] ||= 0
  end

  def greater_or_equal?(m, n)
    @data[m] ||= 0
    @data[m] >= @data[n] ||= 0
  end

  def less_or_equal?(m, n)
    @data[m] ||= 0
    @data[m] <= @data[n] ||= 0
  end
end

Example:

Ruby:
$game_variables.equal?(10, 20)
Thank you for the suggestion! I'll check it out

Original thread: https://forums.rpgmakerweb.com/threads/script-coding-issue.161849/