getting some debug data

Joined
Jul 31, 2002
Messages
705
hi

anyone know if there's some already released scripts that can print out some data from games? i'm about to dive into the available lua but I have to admit something that exists already would make the job a lot easier.

heck i'm not even sure if i can get the game to print hello world!

does anyone know? ;)

but for example, i'd like to be able to print out in the tuner turn reports such as civ x researched y, cix x traded y with civ a for b .. generally stuff to see what the AI is doing

i saw in the automationstartup.lua there's a reference to print out desired report, but it's just comments or at least I can't find any report examples to build off of

thanks
 
Code:
print("This is something I wanted printed");
 
well yeah, thanks for that :p

what i meant about not knowing how to print was where to put that in? use modbuddy and create a project and all that? or can't i just make my own file and stick in the mods
 
The safest way would be to copy any existing file you wanted to print data from into a new ModBuddy project, then add your print statements where ever you feel necessary.
 
okay but how about not recreating existing files and just making my own?

for example, helloworld.lua in my new modbuddy project, loaded in game, seeing tuner loading it with the new md5 string with this code:

Code:
function HelloWorld()
	print("Hello World");
end
Events.ActivePlayerTurnStart.Add( HelloWorld );

doesn't work? when looking at other stuff in the mainstate panel, like the print from OnCityCreated, it uses the same syntax to add the function to the events

i must be missing something incredibly clear here printing that line shouldn't be so hard to figure out
 
You need to tell the game about you new file. Update InGame.xml to include your new file.
 
You need to tell the game about you new file. Update InGame.xml to include your new file.
I have been using new lua files without adding them to InGame.xml. Is there some specific reason to add them there?
 
If you create an entirely new file, and don't add it there, the game will never know about it, so callbacks will never be registered. If it doesn't use callbacks, you don't need to, but if it does, you will.
 
If you create an entirely new file, and don't add it there, the game will never know about it.
And yet, as I said, I have been using new lua files without ever touching (or realizing the existence of) InGame.xml.

Sneaky bugger, adding another line to your post after I already responded. :p
 
You need to tell the game about you new file. Update InGame.xml to include your new file.

thanks for that, finally got it to print hello world, so many steps to this :crazyeye:

i was just under the impression i could keep dumping files into my modbuddy project and it would just load them all up. i see now it's a bit more cleaner than that

but on the topic of InGame.xml, is it required to copy the original file over? it seems redundant to have the same data copied over can't we just have a shorter version of what we've added?
 
You need the entire file, I tried a shortened version, it didn't work.
 
You need the entire file, I tried a shortened version, it didn't work.

i tried it also a bit, and it just crashed, on a side note i'm getting some decent test results with this:

Code:
include( "IconSupport" );
include( "InfoTooltipInclude" );
include( "InstanceManager" );

include( "SupportFunctions"  );

include( "TechButtonInclude" );
include( "TechHelpInclude" );

function info()
	for lnum = 0, GameDefines.MAX_CIV_PLAYERS-1, 1 do

		local player = Players[ lnum ];
		local team = player:GetTeam();

		local civtype = player:GetCivilizationType();
		local civinfo = GameInfo.Civilizations[civtype];

		local ctech = player:GetCurrentResearch();
		local techinfo = GameInfo.Technologies[ctech];

		if( player:IsAlive() and not player:IsMinorCiv() ) then

			print("---");

			local tech = Locale.ConvertTextKey( techinfo.Description );
			local civ = Locale.ConvertTextKey( civinfo.Description);
			print("civ: " .. civ);
			print("tech: " .. tech);

		end

	end
	
	print("---");

end

not sure how many of those libraries i need to include, and sure, it only shows civ and their current research, but it's getting there.

I can see now how it can all get added into the game itself as well in a fancy table, although i really don't mind doing it out of the console tbh.
 
Back
Top Bottom