Page 1 of 1

Mod unit list tool?

Posted: 05 Sep 2010, 13:07
by tyran_nick
Has anyone created a tool to automatically generate a list of the units contained in a mod along with some basic info? Something like a small offline Modinfo. The units are in fbi.

Re: Mod unit list tool?

Posted: 05 Sep 2010, 15:14
by zwzsg

Code: Select all

	for id,unitDef in pairs(UnitDefs) do
		Spring.Echo("----------------------------------------")
		for name,param in unitDef:pairs() do
			Spring.Echo(name,param)
		end
		Spring.Echo("----------------------------------------")
	end

Re: Mod unit list tool?

Posted: 09 Sep 2010, 12:37
by tyran_nick
Thanks, I ll keep this in mind when I get more into lua coding. I was actually looking for a way to do this outside spring. I managed to do it with autoit. I ve attached an alpha output. If anyone is interested I can post the code here, though as you can see its more or less primitive...

http://rapidshare.com/files/418024553/unitlist.pdf

Re: Mod unit list tool?

Posted: 09 Sep 2010, 20:28
by knorke
there is also http://modinfo.adune.nl/ so such a tool must already exist in some form.

Re: Mod unit list tool?

Posted: 10 Sep 2010, 13:29
by slogic
Is there a source code for http://modinfo.adune.nl/ ? I don't like it contains too old and too many mods, and does not contain the most recent mods. I would like to set up it locally if maintainer is busy.

Re: Mod unit list tool?

Posted: 10 Sep 2010, 13:37
by zwzsg
TradeMark's http://modinfo.adune.nl/ worked by parsing the FBI, and he got mightly annoyed when mods started using Lua'ed unitDefs.

That reminds me I promised him a Lua replacment I never delivered....

Re: Mod unit list tool?

Posted: 10 Sep 2010, 13:53
by slogic
Ah, that is why data updating has been stuck.

Re: Mod unit list tool?

Posted: 10 Sep 2010, 21:42
by yuritch
tyran_nick wrote:I was actually looking for a way to do this outside spring.
Keep in mind that it's perfectly possible to create unitdefs dynamically on game load (but hardly any projects utilize that yet). So any info you gather outside of game can in theory have little resemblance to what is in game. The code zwzsg provided will still work, no matter how the unitdefs were produced (fbi/lua/dynamic creation).

Re: Mod unit list tool?

Posted: 11 Sep 2010, 10:03
by tyran_nick
Indeed, though the reason I got into this was to be able to provide an informative list of units for a mutator mod that I m building. So for my case and, as you said, potentially for most cases, dynamically specified unitdefs is not a problem. I guess its much better for someone who downloads a mod to have a bit of details (with pics) of what to expect! Personally I find it boring to do the list manual... so I prefer to write an algorithm to do that for me

EDIT: how can I use zwzsg's code to output the result to a file instead of the console? Getting a list with the units and their attributes from spring and then automatically formatting it outside would be the most general solution I guess. That should handle both static and dynamic unitdefs and both fbi and luas, etc.

Re: Mod unit list tool?

Posted: 11 Sep 2010, 11:44
by yuritch
Anything that went to the console will be in the infolog.txt, so you can get it from there. That's the fastest way.
It's also possible to modify the code so that it writes output to some other file.

Re: Mod unit list tool?

Posted: 30 Dec 2017, 12:41
by albator
Anyone know where did this go ?

http://modinfo.adune.nl/

Re: Mod unit list tool?

Posted: 30 Dec 2017, 12:47
by Silentwings
That link went dead about 8 years ago when TradeMark left.

Newer version of the code was last seen on viewtopic.php?f=44&t=35306&p=578741&hil ... fo#p578741

Re: Mod unit list tool?

Posted: 30 Dec 2017, 13:13
by Jools
yuritch wrote:
tyran_nick wrote:I was actually looking for a way to do this outside spring.
Keep in mind that it's perfectly possible to create unitdefs dynamically on game load (but hardly any projects utilize that yet). So any info you gather outside of game can in theory have little resemblance to what is in game. The code zwzsg provided will still work, no matter how the unitdefs were produced (fbi/lua/dynamic creation).
The very point of having config files isolated is that they should be static.

Re: Mod unit list tool?

Posted: 30 Dec 2017, 13:30
by hokomoko
Jools wrote:The very point of having config files isolated is that they should be static.
Did you just argue with a post from 2010?

Also, this really isn't the point.
https://github.com/spring1944/spring1944/pull/7 wouldn't have been possible with static defs a-la fbi.

defs are isolated for organisation reasons, that you generally know where to look in order to make a change. Staticness is very very unnecessary.

Re: Mod unit list tool?

Posted: 30 Dec 2017, 15:27
by albator
Silentwings wrote:That link went dead about 8 years ago when TradeMark left.

Newer version of the code was last seen on viewtopic.php?f=44&t=35306&p=578741&hil ... fo#p578741
Thanks. Maybe that will be used for BA 10.XX as well ?