Page 1 of 1

Bad LUA script bug...

Posted: 16 Oct 2008, 00:30
by TheThinker
Well, the engine is wonderful and all save for a few minor bugs that detract from the experience. For one, the DrawFormation LUA script is unwanted, and routinely crashes. On mods like CA, the script is done-for after 5 minutes, but seems to take the rest of the LUA scripts with it. The result being the entire LUA being chucked out, and no longer loaded during the game and a de-resolutionized game menu. On M.A., it's even worse. Not only does it clearly not like DrawFormation, but eventually the game crashes when you a sizable army at your doorstep or the enemy's with KAIK running as your A.I.

On a sidenote, I do wish I could get AAI and KAI to work on my Ubuntu Hardy machine. I understand why AAI doesn't work, but not KAI? Ugh.

Well, it seems as if I should just do a complete re-install of the game, but I was wondering if there was more to it than that. Do I need to copy the LUA folder from the engine to the same folder SpringLobby uses for Spring content? Thanks for any help.

Re: Bad LUA script bug...

Posted: 16 Oct 2008, 08:39
by imbaczek
/luaui reload will fix the gui after it unloads itself.

Re: Bad LUA script bug...

Posted: 16 Oct 2008, 18:43
by TheThinker
Thanks imbaczek. So, it'll help reload the LUA, but will there be a bugfix for this? It doesn't make sense for DrawFormation to crash like it does.

Re: Bad LUA script bug...

Posted: 16 Oct 2008, 18:47
by imbaczek
it's a bug in the widget I believe, you could install a newer version and disable mod-provided one.

Re: Bad LUA script bug...

Posted: 16 Oct 2008, 22:07
by TheThinker
Okay, so I followed your directions imbaczek, except for I can't disable the DrawFormation widget since it doesn't exist anymore for some strange reason. I'm now using the customformation widget, but the bug is still there. Here's relevant pieces of the logfile:

[ 0] Failed to load: unit_customformations.lua (duplicate name)

But there is no duplicate file of unit_customformations.lua in the widget folder! Ugh.

[ 2397] false
[ 2397] Error in MousePress(): [string "/usr/share/games/spring/LuaUI/Widgets/unit_..."]:72: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 2397] Removed widget: CustomFormations

Okay, I'm a very-amateur coder and even I think this means that the engine doesn't like a particular line of code.

Furthermore, the defenserange widgets are also bad it seems:

[ 1258] Loading: LuaUI/Widgets/gui_defenserange.lua
[ 1259] false
[ 1259] Error in Update(): [string "LuaUI/Widgets/gui_defenserange.lua"]:442: attempt to call field 'mod' (a nil value)
[ 1259] Removed widget: Defense Range v3.6
[ 1500] Loading: /usr/share/games/spring/LuaUI/Widgets/gui_comm_ends.lua

[ 2829] false
[ 2829] Error in UnitCreated(): [string "/usr/share/games/spring/LuaUI/Widgets/gui_d..."]:902: attempt to perform arithmetic on local 'damage' (a nil value)
[ 2829] Removed widget: Defense Range v4.13

I know I didn't have both versions of DefenseRange on at the same time; what's going on here? Is the engine suddenly being picky about the code from these widgets?

Re: Bad LUA script bug...

Posted: 16 Oct 2008, 22:16
by TheThinker
By the way, even without the unit_customformations.lua in the widgets folder, the LUA list is still listing it and giving the same error whenever I try to draw a formation:

[ 1686] Error in MousePress(): [string "LuaUI/Widgets/unit_customformations.lua"]:72: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 1686] Removed widget: CustomFormations

However, the "duplicate name" error is gone when the file is absent.

Re: Bad LUA script bug...

Posted: 16 Oct 2008, 22:46
by TheThinker
Okay, one final report. The past log-excerpts I posted are from my previous games with M.A. V.1.1. However, the same "nil-value" bug with the CustomFormations widget plays a different role in C.A. V.2951. While I could easily draw a formation on the field, I cannot use the minimap to do this without this happening:

[ 3640] LuaUI::RunCallIn: error = 2, MouseMove, [string "LuaUI/Widgets/unit_customformations.lua"]:199: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 3640] LuaUI::RunCallIn: error = 2, MouseMove, [string "LuaUI/Widgets/unit_customformations.lua"]:199: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 3640] LuaUI::RunCallIn: error = 2, MouseMove, [string "LuaUI/Widgets/unit_customformations.lua"]:199: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 3641] LuaUI::RunCallIn: error = 2, MouseMove, [string "LuaUI/Widgets/unit_customformations.lua"]:199: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 3641] LuaUI::RunCallIn: error = 2, MouseMove, [string "LuaUI/Widgets/unit_customformations.lua"]:199: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 3641] LuaUI::RunCallIn: error = 2, MouseMove, [string "LuaUI/Widgets/unit_customformations.lua"]:199: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 3641] LuaUI::RunCallIn: error = 2, MouseMove, [string "LuaUI/Widgets/unit_customformations.lua"]:199: attempt to call field 'GetMouseMiniMapState' (a nil value)
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] 5 errors deep in LuaUI, disabling...
[ 3643] Reloaded cmdcolors with: cmdcolors.tmp
[ 3643] Disabled LuaUI

And, of course, there is no unit_customformation.lua listed in the widget folder, so I can't replace the file if I can't find it and without avoiding that "duplicate name" error listed before.

Re: Bad LUA script bug...

Posted: 17 Oct 2008, 00:20
by imbaczek
you've got out-of-date core Lua files, at least that's my guess. reinstall/purge your LuaUI dir.

Re: Bad LUA script bug...

Posted: 17 Oct 2008, 03:30
by TheThinker
I purged my system of the engine, then reinstalled it, and still the same bugs. What do I do? Sigh. It could be worse.

Re: Bad LUA script bug...

Posted: 17 Oct 2008, 18:22
by TheThinker
Okay, this issue has finally been resolved, and it turns out that a simple mod change is all that was needed. As of CA version 3043, the CF widget bug is gone completely; everything works fine. Good job CA team!

As for M.A., I can live without the CF widget turned on. Here's hoping for the next version to come out soon. :)

Thanks to Kloot for informing me of the changes.

Re: Bad LUA script bug...

Posted: 17 Oct 2008, 18:25
by imbaczek
good to know. the error messages should look different (such errors are usually intercepted by the default widget handler and do not cause unload of LuaUI.)