Undefined method error

so im trying to compile a bot for a video game and it gives me undefined
method error for a certain script and i have no idea who to fix it.

im getting this build_tools/process_files.rb:70:in generate_version': undefined method[]’ for nil:NilClass (NoMethodError)
from build_tools/process_files.rb:61:in generate_build_information' from build_tools/process_files.rb:142:inblock in ’
from build_tools/process_files.rb:55:in initialize' from build_tools/process_files.rb:139:innew’
from build_tools/process_files.rb:139:in `’
build_tools/process_files.rb Starting…
Command /bin/sh failed with exit code 1

the piece of code is

def generate_version
game_version =
(@build_information[:kind] == “CVS”) ?
%x("#{TOP_LEVEL}/batch/make/version"
“#{TOP_LEVEL}”).chomp :
File.read("#{TOP_LEVEL}/src/macosx/config_common.h.in").scan(/"#define
VERSION “(.*)”/)[0][0]
@build_information[:version]
= game_version
end

if anyone could help that was be awesome.

You didn’t posted where is the row Nr. 70 but from the code I’d suspect
the issue is with @build_information instance variable is not
initialized - ie its value is nil, therefore sending `[]’ method fails
with exception.

oh sorry line 70 is
File.read("#{TOP_LEVEL}/src/macosx/config_common.h.in").scan(/"#define
VERSION “(.*)”/)[0][0]

So it’s clear now. File /src/macosx/config_common.h.in does
not contain expected pattern "#define VERSION “(.*)” .

First I’d make sure whether all double-quotes in /"#define VERSION
“(.*)”/ are correct. I’d bet the first one before #define is accidental
and may need to be removed.
Second open the `common.h.in’ file in an editor and look for a row
containing VERSION macro definition and check the current format and
adjust the regexp pattern accordingly. If in troubles you may paste the
corresponding line here.

Test the output of this:
File.read("#{TOP_LEVEL}/src/macosx/config_common.h.in").scan(/"#define
VERSION “(.*)”/)

It looks like it isn’t finding any matches, so when you try to access
the object in index zero with [0][0], it tells you that #[] is not
defined on NilClass, because there’s nothing in the array.