I want to log all players in a game with their Allyteam, colors etc. to a textfile.
For human players that works already. For bots it does not.
code so far:
http://pastebin.org/448406
It logs some bots, but not all. Cant see a system to it though.
Compare the "Result:" with the real setup: http://www.abload.de/img/clipboard02md2f.jpg
Ais called "ca_Drei" and "Vier" are missing.
Does not matter if CA's Lua AI "CAI" or Nullai its never quite correct.
I want the real name of the AIs not the ones of their hosters.
If someone can have a look at this that would be cool :)
I do not even know if .dll or Lua AI makes a difference?
Reason I need this is so that Bots can show up in game stats image thingies just like human players:
http://img13.abload.de/img/2v2icyrunkomplettp4ty.jpg
logging playerlist including bots (half done but bugged)
Moderator: Moderators
Re: logging playerlist including bots (half done but bugged)
GetPlayerInfo takes a playerID
GetAIInfo takes a teamID
GetAIInfo takes a teamID
Re: logging playerlist including bots (half done but bugged)
Try looking at the shard stats widget
Re: logging playerlist including bots (half done but bugged)
Oh. They can both take it up their .. for all I care!zwzsg wrote:GetPlayerInfo takes a playerID
GetAIInfo takes a teamID
Thanks, will be helpful.
But then this would be incorrect as well?
Code: Select all
for p = 0,31 do
local name,active,spec,teamID,allyTeamID,pingTime,cpuUsage = Spring_GetPlayerInfo(p)
if name == nil then
teamID, skirmishAIID, name, hostingPlayerID, shortName, version = Spring.GetAIInfo(p)
pingTime,cpuUsage = 100 end
end
It is done like this AdvPlayerlist as well:
http://sl.pastebin.com/JSsqUDxg
line 1813 and 1816
2000 lines for a playerlist Oo
What file would I find this in, I downloaded Shard.0.29SpikeyAF wrote:Try looking at the shard stats widget
game:SendToConsole("OHAI DER")
---
wtf.
Here is the latest version:
http://pastebin.org/449217
It tries to write to whateverfolderspringuses\replaylogs\[somename].txt
function get_playerlist_s () is the problem.
Its called at gamestart but you can retrigger it by typing
openlogfile
getplayerlist
into chat.
I want it to output something like:
But including AIplayers.[PlayerInfo]name=<[RoX]knorke> playerID=<1> allyTeamID=<0> teamID=<0> spectator=<true> playercolor_r=<248> playercolor_g=<6> playercolor_b=<223>
[PlayerInfo]name=<[Sin]Thogram> playerID=<2> allyTeamID=<0> teamID=<0> spectator=<false> playercolor_r=<248> playercolor_g=<6> playercolor_b=<223>
[PlayerInfo]name=<[SNTT]lfing> playerID=<3> allyTeamID=<0> teamID=<0> spectator=<true> playercolor_r=<248> playercolor_g=<6> playercolor_b=<223>
[PlayerInfo]name=<[CoX]jimjoe> playerID=<4> allyTeamID=<1> teamID=<1> spectator=<false> playercolor_r=<25> playercolor_g=<255> playercolor_b=<0>
Maybe with botplayer=<yes> but I dont care for that.
Re: logging playerlist including bots (half done but bugged)
The shard stats widget has its own thread in this forum
Re: logging playerlist including bots (half done but bugged)
AF: Was that the thing used for the AI kp tourney?
Did not find that thread again but still thanks.
Also many thanks to smoth and zwsg for their efforts.
Seperate loops for
Spring.GetAIInfo(i) and Spring.GetPlayerInfo (i)
solved it. I hope.
Did not find that thread again but still thanks.
Also many thanks to smoth and zwsg for their efforts.
Seperate loops for
Spring.GetAIInfo(i) and Spring.GetPlayerInfo (i)
solved it. I hope.
Re: logging playerlist including bots (half done but bugged)
For me shortName is empty since Spring 0.82RC in the following line:
script.txt does contain ShortName keys. Strange.
Code: Select all
teamID, skirmishAIID, name, hostingPlayerID, shortName, version = Spring.GetAIInfo(p)
Re: logging playerlist including bots (half done but bugged)
slogic, version is not empty?
they will have default values/be empty if the AI is not local, cause shortName and version are not synced info.
they will have default values/be empty if the AI is not local, cause shortName and version are not synced info.
Re: logging playerlist including bots (half done but bugged)
Ouch, my wrong. I fixed it. Number of items in return list of GetAIInfo() is reduced by one. Long ago i was surprised that practical result does not correspond what i've read in source code. May be that time source code was from upcoming 0.82.x.
Anyway, i can't tell what exactly was removed currently.
Anyway, i can't tell what exactly was removed currently.