Jump to content

MCM Log errors: Array Index is out of range


Xander9009

Recommended Posts

I have a mod called Reading List. It's designed to show you a list of all the books in Skyrim and display whether or not they've been read. Today, I expanded the mod to include Dawnguard, Dragonborn, and the Books Books Books mod. Everything seems to be working fine, and my testing hasn't revealed any issues except one: my log has a bunch of errors. There are two types that seem to be showing up: "Array index # is out of range" and "Passing NONE to non-object argument #". The second appears 11 times. I could handle that, but it's preferable to prevent it. The other, though, appears 155 times. Each of these (for both errors) appears with at least 6 other lines, so the log file is... a bit long. The two errors as they appear the first time for each of them are:

 

 

  Reveal hidden contents

 

 

  Reveal hidden contents

 

There are three custom scripts I'm using, but two aren't relevant (though I'll post them anyway, just in case). The full script I'm using for the menu is this:

 

  Reveal hidden contents

 

The two irrelevant scripts are->

On player alias for detecting books in their inventory:

 

  Reveal hidden contents

 

On a separate quest's book alias. The quest is restarted repeatedly (by the very bottom functions in the main script) to detect books in the area.

 

  Reveal hidden contents

 

 

The log file as it appears is:

 

  Reveal hidden contents

 

For the record, that's 1156 lines and the vast majority of it is from just these two errors.

 

For some final information that may or may not be relevant, the only array that's pre-filled (despite what the separate sections suggest; they were made previously but are no longer accurate) is the ActivePages array, which has 0-6 and 21 = True, all others (24 total) are false.

 

There are no compilation errors, and like I said, the mod runs fine. I don't know enough about how the MCM system's scripts are set up to know if this is a problem with my script or if it's simply an unavoidable result of changing the Pages array or something of the sort. If any help is needed understand how the script works, just ask. I can simply warn about the log file if necessary, but if anyone could help me figure out these two log errors, I'd greatly appreciate it.

 

For the record, the reason it's using GetFormFromFile and GetModByName is to avoid having to a) modify the arrays from an external script which has, in my experience, very commonly resulted in unexpected and impossible-to-use behavior and b) to avoid having to either make the entire mod require both DLC and the Books Books Books mod or make the patches have their own MCM menus. And yes, there are three patches, one per supported file (DLC1, DLC2 and BBB), and those patches do nothing more than create the formlists of books.

Link to comment
Share on other sites

#1

 

Pages = New String[7]

=>

Pages[7] = DetectedBooksText

 

Indexing starts at 0, so that has to be

Pages = New String[8]

 

 

#2

Hard to guess without the actual line numbers, but I assume it's

 

Int Function FillArray(Book[] Array, Book[] Array2 = None, Int ArrayStartIndex = 0, FormList List = None, Int MaxFill = 128, Int ListStartIndex = 0)

 

the "Book[] Array2 = None" part. Pretty sure an array can't be none, or any default parameter for that matter.

Link to comment
Share on other sites

So it is in fact with the script and not mcm, thank you. I'll definitely check those (don't know how I missed the first one). I wasn't aware arrays couldn't have default values. I'll just separate it into two functions then and that should fix it.

 

Did I mention you're awesome :)

Edited by Xander9009
Link to comment
Share on other sites

Okay, final update for those interested (which is probably no one), I spoke too soon before. I continued to get the error that repeated 128 times. After filling in the first element of Pages with the CK so it didn't start off completely empty, the errors finally disappeared.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...