View topic - Help with widget "Show build"



All times are UTC + 1 hour


Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 23 Jul 2012, 11:13 

Joined: 02 Jul 2012, 12:16
Hello After upgrade to version 89 I have a problem with the widget Show build. After a while the widget exits with an error on line 82

local r,g,b = Spring.GetTeamColor(Spring.GetUnitTeam(myCmd.uid))

The console shows that the argument GetTeamColor is null.
I need your help or advice to fix the problem.
Here is the entire text of the program to this point.

function widget:DrawWorld()
for key, myCmd in pairs(command) do
local cmd = myCmd.id
local params = myCmd.params
cmd = math.abs( cmd )
local x, y, z, h = params[1], params[2], params[3], params[4]
if(h ~= nil) then
local degrees = h * 90
if Spring.IsAABBInView(x-1,y-1,z-1,x+1,y+1,z+1) then
local r,g,b = Spring.GetTeamColor(Spring.GetUnitTeam(myCmd.uid))


Top
 Offline Profile  
 
PostPosted: 23 Jul 2012, 12:45 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Could you please paste the whole error message from the console? It is also stored in infolog.txt.


Top
 Offline Profile  
 
PostPosted: 23 Jul 2012, 15:55 

Joined: 02 Jul 2012, 12:16
Beherith wrote:
Could you please paste the whole error message from the console? It is also stored in infolog.txt.


[f=0011495] Error in DrawWorld(): [string "LuaUI\Widgets\unit_showbuild.lua"]:82: bad argument #1 to 'GetTeamColor' (number expected, got no value)


Attachments:
infolog.txt [66.42 KiB]
Downloaded 83 times
Top
 Offline Profile  
 
PostPosted: 25 Jul 2012, 13:35 

Joined: 02 Jul 2012, 12:16
I’ve solved the problem by adding the line:

if (Spring.GetUnitTeam(myCmd.uid) ~= nil) then

after the start of the cycle. The Widget now does not fail but I have an unexpected effect. There are unfinished objects left on the map without any constructors assigned to construct them.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.