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

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

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

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

Post 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
Last edited by jamerlan on 27 May 2012, 15:27, edited 1 time in total.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

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

Post by knorke »

try Spring.GetMyPlayerID
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

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

Post 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
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

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

Post by jamerlan »

knorke, thank you for GOOD answer!! :-D I will try!
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

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

Post by jamerlan »

knorke, you was right! It works!
Post Reply

Return to “Lua Scripts”