Page 1 of 1

[SOLVED] Bug in Spring.GetPlayerInfo(Spring.GetMyTeamID())

Posted: 27 May 2012, 01:39
by jamerlan
BA has widget: "gui_center_n_select.lua"

It has these lines:
local t = Spring.GetGameSeconds()
_, _, spectator = Spring.GetPlayerInfo(Spring.GetMyTeamID())
if (spectator or t > 10) then
... remove this widget...
This widget should detect that I am not a spectator and select my commander when game started.

BUT for some people it works and for some people - it does not work! For me it does not.

I logged "spectator" variable and it contains "true". So widget removed and did not selects my commander at game start.

I removed this "spectator" variable from this "if" statement and my commander selected on game start.

So.. Why Spring.GetPlayerInfo(Spring.GetMyTeamID()) function returns that I am a spectator? I guess that my spring running too fast.. Other people connected to game after me and they are not "spectators" in this case.

I tested it on BA 7.68

Re: Bug in Spring.GetPlayerInfo(Spring.GetMyTeamID())

Posted: 27 May 2012, 02:17
by knorke
try Spring.GetMyPlayerID

Re: Bug in Spring.GetPlayerInfo(Spring.GetMyTeamID())

Posted: 27 May 2012, 03:03
by jamerlan
Can't collect statistics... only few people answering me :-) don't know why

3:51:02] <[teh]decay> !!!!!! Is there anybody who has that problem: game started, commander does not selected automatically?
[03:51:42] <[LOeT]Zinn> decay: on my old system i hat it with about 1/3 of my starts
[03:51:45] <[teh]decay> I need to know: should I commit my change to BA or not
[03:52:10] <[LOeT]Zinn> new system, new install, no special widget, no problem with autoselection

Re: Bug in Spring.GetPlayerInfo(Spring.GetMyTeamID())

Posted: 27 May 2012, 03:06
by jamerlan
knorke, thank you for GOOD answer!! :-D I will try!

Re: Bug in Spring.GetPlayerInfo(Spring.GetMyTeamID())

Posted: 27 May 2012, 14:02
by jamerlan
knorke, you was right! It works!