Game.gameID not working

Game.gameID not working

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

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Game.gameID not working

Post by knorke »

Maybe it works in multiplayer but i need it for replays and singleplayer and it doesnt seem to work there.

Code: Select all

function widget:Initialize()
Spring.Echo ("game id:" .. tostring(Game.gameID) )
end
shouldnt this display something like
game id: 994b01c0833aee69ad13f3
it only shows
game id:

Without the tostring it doesnt work either.
Lua noob mistake?
Game.version works.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Game.gameID not working

Post by knorke »

Image
oh no :(
what other way would there be to identify a game/replay?
mapname and modname can be the same as well as players.
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Game.gameID not working

Post by SirMaverick »

Parse chat or infolog? GameID is printed there.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Game.gameID not working

Post by CarRepairer »

Bump!!!
User avatar
PepeAmpere
Posts: 589
Joined: 03 Jun 2010, 01:28

Re: Game.gameID not working

Post by PepeAmpere »

Game.gameID still not working, its empty string AFTER start of the game... in frame 10 or later, too.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Game.gameID not working

Post by knorke »

https://github.com/spring/spring/commit ... c0d17d874e
---
what i used in the end to get gameid from chat:

Code: Select all

function widget:AddConsoleLine(msg, priority)
if (string.find (msg, "GameID:") ~= nil) then
	game_id = string.sub (msg, 9) -- "GameID: xxxxxxx"
(if you do not want to wait)
Post Reply

Return to “Lua Scripts”