[resolved] Scripting error involving MapInfos.rxdata

I am trying to create the scripts needed for non-scripters to make their own Harvest Moon style crops. I got as far the script for checking if plants are watered overnight, and I am getting an error that is well out of my league. I tried googling it, but I got nothing. I needed to cycle through every event on every map, and the only solution I found involves the rxdata, which I have avoided like the plague up to now. I don't even know a good tutorial for learning that, I just know that some people know it well, and I don't.
I am using the Self Variables from DrakoShade, as well as an original code I put together.
Here's the error:
Image
And just to be thorough, here's the "bedtime" event with the script call:
Content Hidden Show
Image


The game starts fine, but when I try to call the Overnight script, that error comes up. Here's my script:
Content Hidden Show
  1. class Overnight
  2.  
  3.   def initialize
  4.   @maps = []
  5.   @farm = 1
  6.  
  7.   map_data = load_data('MapInfos.rxdata')
  8.  
  9.     for i in map_data.keys
  10.       @maps.push(load_data(sprintf("Data/Map%03d.rxdata", i)))
  11.     end
  12.  
  13.   end
  14.  
  15.  
  16.   def water_check
  17.     for f in 0...@maps[]
  18.  
  19.       @farm = @maps[f]
  20.       for e in [email hidden][]
  21.  
  22.         if $game_self_vaiables[[@farm, e, 1]] > 3
  23.  
  24.           if $game_self_switches[[@farm, e, "A"]] == on
  25.             $game_self_switches[[@farm, e, "A"]] = off
  26.             $game_self_variables[[@farm, e, 1]] += 1
  27.  
  28.           else if $game_self_switches[[@farm, e, "B"]] == off
  29.             $game_self_variables[[@farm, e, 1]] = 3
  30.           end
  31.         end
  32.       end
  33.     end
  34.   end
  35. end
  36. end
Expand to see the code.

(I feel like there's one too many "ends" in there, but it won't run with any less or more.)
Self variable 1 is the main control for the crop event page.
Self switch A is used to check whether the crop has been watered.
Self Switch B checks if the crop is done growing.
If you want to look at the actual game, it can be downloaded from here: https://uploadfiles.io/xqshg
Apparently, the script needed a total overhaul. It's been resolved.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=79411