NoMethodError Occured. Undefined Method: 'empty?' for nil:NilClass

Discussion in 'RGSSx Script Support' started by Zion774, Feb 22, 2018.

  1. Zion774

    Zion774 Veteran Veteran

    Messages:
    37
    Likes Received:
    1
    First Language:
    English
    Hello I'm using Szyu's Crafting System script, and it was working just yesterday but today I go in and I haven't changed a thing, but every time I try to craft something I get this error. It gives me the error on line 175. I'm really bummed out about this and would like some help. Thanks.
    # Pastebin:
    #
     
    #1
  2. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,598
    Likes Received:
    349
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    You should put links to scripts. In this case a link to the post by Szyu, not the script itself.
    This is also script support not general help.
    I have no idea how this crafting script works. I don't know what I'm suppose to set up. The instructions are very confusing to me.
    Can't tell where the information is suppose to go.
    Can you provide info on your setup so I may test?
     
    #2
  3. Zion774

    Zion774 Veteran Veteran

    Messages:
    37
    Likes Received:
    1
    First Language:
    English
    I'm so sorry I'm new to the forums.. I'm not sure where anything goes.. And I put the paste bin link, Next time ill provide a link to a forum.

    So first I set up a recipe book. Which is an item. Then I add its recipes. This is all under the notes of the item.
    <recipe book>
    <recipes>
    w: 13 <-- this means it contains the recipes of weapon ID 13
    </recipes>

    Then under weapon ID 13 I set the ingredients.
    <ingredients>
    i: 1x 4 <- it costs 1 of item ID 4.
    </ingredients>

    Then I set up an event to call the script.

    SceneManager.call(Scene_Crafting, -1)

    ^ this calls the script and opens up the crafting menu.

    then to craft things it is fairly straight forward from there.

    I also set up an event to give the player the RECIPE BOOK and the materials needed to craft say weapon 13.

    That's it.
     
    #3
  4. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,714
    Likes Received:
    730
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    go into the Main script and replace the SceneManager.run part for
    Code:
    def report_exception(error)
      scripts_name = load_data('Data/Scripts.rvdata2')
      scripts_name.collect! {|script|  script[1]  }
      backtrace = []
      error.backtrace.each_with_index {|line,i|
        if line =~ /{(.*)}(.*)/
          backtrace << (scripts_name[$1.to_i] + $2)
        elsif line.start_with?(':1:')
          break
        else
          backtrace << line
        end
      }
      error_line = backtrace.first
      backtrace[0] = ''
      err_class = " (#{error.class})"
      back_trace_txt = backtrace.join("\n\tfrom ")
      error_txt = sprintf("%s %s %s %s %s %s",error_line, ": ", error.message, err_class, back_trace_txt, "\n" )
      print error_txt
      return error_txt
    end
    begin
      rgss_main do
        begin
          SceneManager.run
        end
      end
    rescue SystemExit
      exit
    rescue Exception => error
      error_txt = report_exception(error)
      print "Submit the file \"ErrorLog.txt\" in your project folder to the upper most script creators noted in the message.\n"
     
      filename = "ErrorLog.txt"
     
      File.open(filename, 'w+') {|f| f.write(error_txt + "\n") }
      raise  error.class, error.message, [error.backtrace.first]
    end
    bunch of code

    make sure you have the console enabled, and go trigger that error again.
    then, go to the console and screenshot the error track.
     
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,149
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    .empty? is not called on line 175 of that script. If you are getting that error on that line, then you have made modifications to the script or you have not pasted it into your project correctly. I suggest you remove the script and re-add it, making sure you're copying the full thing and pasting it in its entirety.

    In fact, that script doesn't use .empty? at all! Are you SURE it's that script that's giving the error message? You don't have two script slots with the same name, do you?
     
    #5
  6. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,405
    Likes Received:
    10,415
    First Language:
    English
    Primarily Uses:
    RMVXA

    I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

     
    #6
  7. Zion774

    Zion774 Veteran Veteran

    Messages:
    37
    Likes Received:
    1
    First Language:
    English
    I am positive It is that script giving me the message. I was confused on this too. It turns out, by removing line 175 my problem was fixed. Everything works correctly but it jsut won't play the sound effect anymore. which sucks.
     
    #7
  8. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,714
    Likes Received:
    730
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    you are both correct.
    the line in question could be triggering a sequence of events that run behind the scenes and cause that error.

    that's why I posted that code, which will dump the entire trace of the error
     
    #8
  9. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,212
    Likes Received:
    4,668
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    I fail to understand how RPG::SE.new(....).play would yield a such error.
    I'm intrigued to learn the error backtrace from gstv87 script snippet if that particular line was the cause, but I'm sure it wasn't the cause
     
    #9
  10. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,149
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    If you don't understand what's going on, you definitely don't want to be removing lines.

    What have you set up as your CUSTOM_CRAFT_SOUNDS_BY_TYPE on line 66?
     
    #10
  11. Sixth

    Sixth Veteran Veteran

    Messages:
    2,122
    Likes Received:
    792
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    It's simple, it's one of the many useless and faulty checks the default code makes.
    This particular one checks if the filename of the sound effect is empty or not. They could have easily used another check which would not yield such an error, but they choose this empty? check which is prone to cause errors when the thing checked is actually a nil value instead of a string.

    You either removed one sound effect settings from the item/weapon/armor SE settings, or you didn't setup new ones for the category SE settings.

    If you don't want to bother with your settings (but you should...), you can just put this line:
    Code:
    csf = ""
    Above this one:
    Code:
        if @cr_category != -1
    This will prevent the error from triggering, but if you miss an SE setting, no SE will be played.
     
    #11
  12. Zion774

    Zion774 Veteran Veteran

    Messages:
    37
    Likes Received:
    1
    First Language:
    English

    Okay so I did that... I'm not quite sure what the "console" is at all.

    I ended up pinpointing the error to the "Basic Options Menu" Script that I have implemented.

    I'm also getting another error in the Game Interpreter.

    It says wrong number of arguments, 2 for 1.

    This is fixed when I use the script call Scene_Manager.call(Scene_Crafting) But this means that the player can create any sort of weapon/armor/potion/food anywhere I call the scene, and not just specific ones.

    So apparently this new error is because I have an invalid number of arguments.

    If all else fails I will just remove the crafting at specific stations entirely, and have them all be from the menu.

    Thank you everyone for your help!
     
    #12
  13. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,149
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    that's a different issue and you should post it in its own thread. If THIS issue is resolved, you can then report the post and ask the mods to close it.
     
    #13
  14. Zion774

    Zion774 Veteran Veteran

    Messages:
    37
    Likes Received:
    1
    First Language:
    English
    Will do
     
    #14

Share This Page