[SOLVED][RULES] Error since patch 2.0

I haven’t touched one of my mods since before the 2.0 patch.

Now when I try to start the game, I get this error:

Thu Jun 16 19:32:30 2016
Version 2.1, Build Number 31, Changelist Number 1237961 
Loaded Archive: 'Homeworld2.big' 
Failed to Load Archive '..\..\DATAUPDATES\UpdateHomeworld2.big' 
Loaded Archive: 'HW1Ships.big' 
Failed to Load Archive '..\..\DATAUPDATES\UpdateHW1Ships.big' 
Loaded Archive: 'HW2Ships.big' 
Failed to Load Archive '..\..\DATAUPDATES\UpdateHW2Ships.big' 
Loaded Archive: 'HWBackgrounds.big' 
Failed to Load Archive '..\..\DATAUPDATES\UpdateHWBackgrounds.big' 
UTIL -- filepath failure, path doesn't exists 'E:\SteamLibrary\steamapps\common\Homeworld\HomeworldRM\data\locale\English' 
Loaded Archive: 'English.big' 
Failed to Load Archive '..\..\DATAUPDATES\UpdateEnglish.big' 
Failed to Load Archive '..\..\DATAUPDATES\Compatibility.big' 
Uing ..profiles\ for profiles folder 
LUA 'data:Scripts\Rules\HWCLASSICMAPS.LUA' -- parameter: attempt to call global `HW2_Letterbox' (a nil value)
stack traceback:
1:  main of string "" at line 360 
Error parsing 'HWCLASSICMAPS.LUA' -- FATAL EXIT -- gameruleslibrary/134:! --stack trace--   

The error claims the function HW2_Letterbox() is not defined. But the function exists in “data:scripts/SCAR/SCAR_Util.lua”, and I am using dofilepath() to read that file into HWCLASSICMAPS.LUA.

What gives? I can’t even get to the main menu.

Treat the Rules file as config data (that is, NOT executed/functional script), during boot/discovery. dofilepath is disabled to speed load times (because some people like to load a TON of external script when all HWRM wants to do is know some tags and the names of the rules…).

Then, when the Rule is used, it will allow use of dofilepath, etc.

Ideally (check out what we did) - place the MAJORITY of your Rules code in a sub-folder lua file, and dofilepath that - have what is in the base rule be just the bare stuff required to open it and read in config/static data (name, paths, tags, etc).

That worked, thanks!!

Next error:

LUA 'data:Scripts\Rules\HWCLASSICMAPS\UnitCaps\DEFAULT.LUA' -- parameter: `=' expected;
last token read: `<eof>' at line 4 in string "" 

I copied the unitcap files directly from the 2.0 patch. Here’s what the file looks like:

supplyLimit("LayoutFighter", 180);
supplyLimit("LayoutCorvette", 180);
supplyLimit("LayoutFrigate", 180);
supplyLimit("LayoutDestroyer", 180);
supplyLimit("LayoutBattleCruiser", 180);
supplyLimit("LayoutResource", 180);

-- Display Rules
supplyShow("LayoutFighter", "Never");
supplyShow("LayoutCorvette", "Never");
supplyShow("LayoutFrigate", "Never");
supplyShow("LayoutDestroyer", "Never");
supplyShow("LayoutBattleCruiser", "Never");
supplyShow("LayoutResource", "Never");

I don’t see any mistakes in that file.


Disregard the above. This error is not producing the crash. I will look for some other cause.

Update: The second error was due to some kind of problem in the level file. Rounding the ship coordinates to the nearest integer seems to have fixed it. But why didn’t it appear in the log? I had to step through every line myself until the problem was fixed.

Is there maybe a limit of how many errors Lua can throw? I.e. the first error is thrown, but any subsequent errors are ignored?

This almost broke my mod because my mod uses scripts to fill the GameSetupOptions table, using data stored in external files. For whatever reason, it still functions despite the changes made.

It likely disables dofilepath on startup to provide the list of available gametypes, then when that gametype is selected, dofilepath is re-enabled.

My remaining errors seem to be HOD related. So I await HODOR along with everyone else. :slight_smile: