User widgets with "[GetUnitCommands] called too often" errors

User widgets with "[GetUnitCommands] called too often" errors

Classic game design, maintained to please you...

Moderator: Content Developer

Post Reply
Flash
Posts: 36
Joined: 12 Dec 2010, 18:03

User widgets with "[GetUnitCommands] called too often" errors

Post by Flash »

since V98 widget is broken for me

Code: Select all

Error in Update(): [string "LuaUI\Widgets\gui_idle_builders_new.lua"]:59: [GetUnitCommands] called too often without a 2nd argument to define maxNumCmds returned in the table, please check your code!
Especially when you only read the first cmd or want to check if the queue is non-empty, this can be a huge performance leak!
Broker
Posts: 156
Joined: 02 Jul 2012, 13:16

Re: Does anyone use the IdleBuildersNEW widget?

Post by Broker »

Flash wrote:since V98 widget is broken for me

Code: Select all

Error in Update(): [string "LuaUI\Widgets\gui_idle_builders_new.lua"]:59: [GetUnitCommands] called too often without a 2nd argument to define maxNumCmds returned in the table, please check your code!
Especially when you only read the first cmd or want to check if the queue is non-empty, this can be a huge performance leak!
Hi All.
I have this problem and
unit_waypoint_dragger_2.lua
unit_obedient_constructors.lu
unit_showbuild.lua
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: User widgets with "[GetUnitCommands] called too often" e

Post by Silentwings »

These are errors in your user widgets (that you have put in your spring/luaui/widgets folder) and are not related to BA.

You will need to update these widgets yourself, or find their authors/maintainers to update them.

The problem is that the widgets are trying to call Spring.GetUnitCommands(unitID) or Spring.GetCommandQueue(unitID) very often without a second argument. This is a potential performance drain and crashbug - 98.0 prevents it and gives the error you see. The second argument can be used to limit the size of the table returned. So you should replace e.g.

Code: Select all

Spring.GetUnitCommands(unitID) -> Spring.GetUnitCommands(unitID, 20)
All BAs widgets have already had this done (http://imolarpg.dyndns.org/trac/balatest/changeset/3324).
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: User widgets with "[GetUnitCommands] called too often" e

Post by jamerlan »

unit_obedient_constructors.lua was fixed: link to updated obient constructors widget
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: User widgets with "[GetUnitCommands] called too often" e

Post by jamerlan »

fixed unit_showbuild.lua url to widget
Broker
Posts: 156
Joined: 02 Jul 2012, 13:16

Re: User widgets with "[GetUnitCommands] called too often" e

Post by Broker »

Hi All

What does this parameter and how to understand what value must be set?
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: User widgets with "[GetUnitCommands] called too often" e

Post by Silentwings »

See my post above.
Broker
Posts: 156
Joined: 02 Jul 2012, 13:16

Re: User widgets with "[GetUnitCommands] called too often" e

Post by Broker »

Silentwings wrote:See my post above.
I see it. but i don't understand way in cmd_commandinsert.lua GetCommandQueue(unit_id,100)
and cmd_customformations2.lua spGetCommandQueue(uID,5000) . what different?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: User widgets with "[GetUnitCommands] called too often" e

Post by Jools »

Broker wrote:Hi All

What does this parameter and how to understand what value must be set?
The second parameter sets a maximum of number of commands you request. Without the second parameter you request all commands, which is not needed if you just are going to use the first one. Well, the same information is present in the error code.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: User widgets with "[GetUnitCommands] called too often" e

Post by Silentwings »

i don't understand way in cmd_commandinsert.lua GetCommandQueue(unit_id,100)
and cmd_customformations2.lua spGetCommandQueue(uID,5000) . what different?
Sometimes there is a value to getting a longer section of the command queue and sometimes there isn't. For your own widget, you should make your own judgement.
Post Reply

Return to “Balanced Annihilation”