From what I know external lobbies use unitsync.dll to get needed information about available maps, games, etc.. . My question is how would I get similar information, for maps, from within lua?
I'm guessing I would need to basically replicate it using the VFS.
I can get a map list with VFS.DirList("maps","*.sd*"). Then I assume I would have to use VFS.UseArchive() to load each map and get the necessary data/info. Though I'm not quite clear on how to use a function within VFS.UseArchive.
Any guidance would be greatly appreciated; Am I way off base or is this close to what needs to be done?
Information on Available Maps
Moderator: Moderators
Re: Information on Available Maps
I would rather extend Spring's Lua to provide a list of loaded maps and games since spring itself certainly has this list (as can be seen when you start spring.exe).Funkencool wrote: I'm guessing I would need to basically replicate it using the VFS.
I guess the idea with UseArchive is that you can load files with VFS.LoadFile within the function supplied to it. Example:Funkencool wrote: I can get a map list with VFS.DirList("maps","*.sd*"). Then I assume I would have to use VFS.UseArchive() to load each map and get the necessary data/info. Though I'm not quite clear on how to use a function within VFS.UseArchive.
Any guidance would be greatly appreciated; Am I way off base or is this close to what needs to be done?
Code: Select all
VFS.UseArchive(archive, function() VFS.LoadFile(someFile, VFS.ZIP) end)
However I'm not sure how this will work in reality since you already have a map loaded while in-game, and you can't override its files (you can have only one file with the same name loaded by any mod or map(?)) by using VFS.UseArchive (since VFS doesn't discern between VFS.ZIP and VFS.MAP).
Someone correct me on this?
- Funkencool
- Posts: 542
- Joined: 02 Dec 2011, 22:31
Re: Information on Available Maps
Hmm fair point, not much use if you can't differentiate between loaded map and loaded map archive.
As it is now any lua lobby or ingame map selection interface will be fairly useless for single player if it can't even get basic map info or at least a minimap.
I think your right that this would be better off as a feature request to make game, map, and AI info available to lua.
As it is now any lua lobby or ingame map selection interface will be fairly useless for single player if it can't even get basic map info or at least a minimap.
I think your right that this would be better off as a feature request to make game, map, and AI info available to lua.