Info Addict

You DO need the logger and saveutils in *my* InfoAddict component because I modified the logger to add a TRACE level and saveutils was being changed quite often at the time. Does that clear things up?

Makes sense! If anything such an hybrid toolset helps a lot with "interactive" components while maintaining control of successive version integration(s).

As for the DiploCorner.lua indirect solution you seem to be proposing, i'd have to test it later but not now - just tooooooo busy with Z-UI mod beta phase assembly.
 
How are you adding InfoAddict? I load as an InGameUIAddin and it works flawlessly with SaveUtils

Right now, the bulk of the code is being loaded through InGame.xml. I'm trying to get everything working through InGameUIAddin but I'm having problems using ContextPtr:LookUpControl() to get the control table for my main screen.
 
Right now, the bulk of the code is being loaded through InGame.xml. I'm trying to get everything working through InGameUIAddin but I'm having problems using ContextPtr:LookUpControl() to get the control table for my main screen.

What does the function do?

Edit: Ah, I see. At which use do you have problems? There is also a LeaderHeadAddIn iirc although I forgot when it's loaded
 
What does the function do?

I use it in the leader discussion screens to pop up the info addict screen. It's a really nice, clean way to reference other lua contexts.

Code:
function OnInfoAddict()
  local InfoAddictControl = ContextPtr:LookUpControl("/InGame/InfoAddictScreen");
  UIManager:PushModal(InfoAddictControl);
end;
Controls.InfoAddictButton:RegisterCallback( Mouse.eLClick, OnInfoAddict );

When I use the UIAddin method, however, I can't find the InfoAddictScreen context. It's no longer underneath /InGame and I can't find another name for it. In fact, when you're in a lua context in the tuner, you can do:

Code:
ContextPtr:GetID()
ContextPtr:LookUpControl(".."):GetID()
ContextPtr:LookUpControl("../.."):GetID()

... etc, to look figure out the "path" of your context. When I use UIAddin, the path that shows up cannot be directly referenced through LookUpControl(). It's like it goes into noman's land or something. I even tried to create an xml file with "InGame" as the main context, hoping it would append my luacontexts to /InGame, but I still couldn't reference those with an absolute path.

I did notice that InGame.lua adds the LuaContext to a global g_uiAddins table but I have no idea how to reference that from another context.
 
I use it in the leader discussion screens to pop up the info addict screen. It's a really nice, clean way to reference other lua contexts.

Code:
function OnInfoAddict()
  local InfoAddictControl = ContextPtr:LookUpControl("/InGame/InfoAddictScreen");
  UIManager:PushModal(InfoAddictControl);
end;
Controls.InfoAddictButton:RegisterCallback( Mouse.eLClick, OnInfoAddict );

When I use the UIAddin method, however, I can't find the InfoAddictScreen context. It's no longer underneath /InGame and I can't find another name for it. In fact, when you're in a lua context in the tuner, you can do:

Code:
ContextPtr:GetID()
ContextPtr:LookUpControl(".."):GetID()
ContextPtr:LookUpControl("../.."):GetID()

... etc, to look figure out the "path" of your context. When I use UIAddin, the path that shows up cannot be directly referenced through LookUpControl(). It's like it goes into noman's land or something. I even tried to create an xml file with "InGame" as the main context, hoping it would append my luacontexts to /InGame, but I still couldn't reference those with an absolute path.

I did notice that InGame.lua adds the LuaContext to a global g_uiAddins table but I have no idea how to reference that from another context.

Ok, let me give it a look.
 
One way to pass references between lua contexts is to simply add a value to shared tables like Player, by the way. It's a bit messy but works fine.

Can't really get what the LookUpControl does. I feel like it should allow you to get the control for each loaded lua context but it doesn't
 
One way to pass references between lua contexts is to simply add a value to shared tables like Player, by the way. It's a bit messy but works fine.

I thought about that but I would have to make edits to InGame.lua to share g_uiAddins and that defeats the purpose of trying to get out of making edits to InGame.xml.

Oooh, just had an idea: I might be able to add the context pointers themselves to Player and reference them that way. I'll have to try that out. I could set a reference in my init function to Player.InfoAddictScreenContext or something like that.

Can't really get what the LookUpControl does. I feel like it should allow you to get the control for each loaded lua context but it doesn't

Not sure what you're saying there because, at least when I use InGame.xml to load my lua contexts, I can do exactly that. I use LookUpControl("/InGame/InfoAddictScreen") to get the context pointer for InfoAddictScreen and then pass that to PushModal() to pop up the mod from just about any context. Of course, if the idea above works, then I won't need LookUpControl since I'll be saving the reference in the Player table and can just get to it that way.
 
Not sure what you're saying there because, at least when I use InGame.xml to load my lua contexts, I can do exactly that. I use LookUpControl("/InGame/InfoAddictScreen") to get the context pointer for InfoAddictScreen and then pass that to PushModal() to pop up the mod from just about any context. Of course, if the idea above works, then I won't need LookUpControl since I'll be saving the reference in the Player table and can just get to it that way.

It doesn't work with custom defined contexts unless they are subcontext of something the C++ loads. I don't know where it gets the keys for the LookUpControl functions from is what I meant.

Sharing the context pointer should work I think, alternatively you should be able to dump a control directly by accessing the Controls table in your context.
 
It doesn't work with custom defined contexts unless they are subcontext of something the C++ loads. I don't know where it gets the keys for the LookUpControl functions from is what I meant.

Sharing the context pointer should work I think, alternatively you should be able to dump a control directly by accessing the Controls table in your context.

Oh ok, I totally agree. It seems like the /Ingame reference is hard coded from game engine and we can't define our own top level reference.

And ... sharing the context pointer works! :cool: I'm loading an Init file through the UIAddin and saving the context pointer returned from LoadNewContext() to the Player table. I'll post details in the get-rid-of-InGame.xml thread for reference.

I should be able to load SaveUtils properly now.
 
Oh ok, I totally agree. It seems like the /Ingame reference is hard coded from game engine and we can't define our own top level reference.

And ... sharing the context pointer works! :cool: I'm loading an Init file through the UIAddin and saving the context pointer returned from LoadNewContext() to the Player table. I'll post details in the get-rid-of-InGame.xml thread for reference.

I should be able to load SaveUtils properly now.

Glad you solved your problem and that I will be able to use InfoAddict in my test games again :D
 
Hey Baleur,

Can you tell me the circumstances around that one image in your post where the selection highlight was economic but the relationship graph was showing the political view? I poked around the code a little but I couldn't find where that might happen. I want to make sure that doesn't happen again if I can prevent it.
 
Is there a historical display in game of buildings built, units killed & units lost ?
If not can it be added to Infoaddict ; )

Would be nice ta see how efficient one is versus the A.I. !!
 
Info Addict v8 is now available for download. There are a lot of changes with this version, including the addition of an options screen and some neat features that were suggested several weeks ago.

Mod integrators please note: InGame.xml and NotificationLogPopup.lua have been removed from the mod and are no longer needed. You should remove any references to InfoAddictScreen from InGame.xml to prevent all the lua contexts from getting loaded twice. Also, check to make sure you change the InGameUIAddin from InfoAddictCollector.lua to InfoAddictInit.lua.



New Features:
  • Added empire's number of cities to historical graphs and the world factbook.
  • In the empire view of the factbook, each row title is now a link to the ranking view for the category. Also, each empire name in the ranking view is now a link to the empire view for that civ.
  • New options panel available from the main Info Addict screen.
  • Historical graph hover boxes highlight the turn and displays a tooltip with that turn's values when the mouse is hovering over the graphing field. [optional, default is off]
  • Added a y-axis for the historical graphs. [optional, default is off]
  • Number of labels on the x-axis and y-axis of the historical graphs can be set from slider in the option screen. [optional, default is 4 labels per axis]

Behavior Changes:
  • Dead civs now record nil values instead of 0. Historical graphs will not graph nil values so it should appear that the lines representing dead civs stop when they died. If a civ is liberated, it should reappear in the historical graphs from the time it is brought back to life.
  • Dead civs show a "-" instead of a "0" for each category in the world factbook. Also, their rank is always the lowest possible, even if live civs have negative values.
  • Factbook initializes to active player at the start of the game.
  • X-axis labels and averaged data are more accurate in the historical graphs.
  • X-axis labels no longer move with the x-axis when negative values are being graphed. They always stay at the bottom now.
  • The values in the Military and Land Area historical graphs now exactly match the values in the factbook and demographics instead of just being proportional.

Bug Fixes and Coding Changes:
  • Liberated civs no longer have dimmed icons in the Global Relations screen.
  • Bumped up the vertical size of the header row in the empire factbook view so that long names don't get their tops shaved off.
  • Reliance on InGame.xml to load Info Addict lua contexts has been removed.
  • Changes to NotificationLogPopup.lua are no longer needed. Instead of using the notification log event from the diplocorner menu, PushModal() is called directly to open up the main Info Addict panel.
  • SaveUtils upgraded to 07.2010.11.30.0000. Also, renamed to "SaveUtils" so it can be used in conjunction with other mods using the same library.
  • Performance enhanced by opening one, persistent connection to the mod user database per lua context.

All changes should be compatible with saved games.

Spoiler mod integrators: file changes and additions to v8 :
Code:
M      InfoAddict/InfoAddictReadMe.txt
M      InfoAddict/XML/InfoAddictHistoricalData.xml
A      InfoAddict/XML/InfoAddictOptions.xml
M      InfoAddict/XML/InfoAddictScreen.xml
M      InfoAddict/XML/InfoAddictText.xml
M      InfoAddict/XML/InfoAddictFactBook.xml
D      InfoAddict/XML/InGame.xml
D      InfoAddict/Lua/InfoAddictSaveUtils.lua
D      InfoAddict/Lua/NotificationLogPopup.lua
A      InfoAddict/Lua/SaveUtils.lua
M      InfoAddict/Lua/DiploCorner.lua
M      InfoAddict/Lua/InfoAddictHistoricalData.lua
A      InfoAddict/Lua/InfoAddictOptions.lua
M      InfoAddict/Lua/DiscussionDialog.lua
M      InfoAddict/Lua/InfoAddictScreen.lua
M      InfoAddict/Lua/DiploTrade.lua
M      InfoAddict/Lua/InfoAddictCivRelations.lua
A      InfoAddict/Lua/InfoAddictInit.lua
M      InfoAddict/Lua/DiscussLeader.lua
M      InfoAddict/Lua/InfoAddictCollector.lua
M      InfoAddict/Lua/InfoAddictLib.lua
M      InfoAddict/Lua/InfoAddictFactBook.lua
 
Really dunno if you're interested by "flaw" reports from users who have used v8 above already, but here goes anyway...

-- GreatPersons & AgS Resources mods were invalidated as soon as i loaded up a previous save with v8 active instead of the previous v6. I had skipped v7.

-- Haven't tried a reset by new game sessions, which may actually re-activate both the above.

-- DK's Rankings mod still conflicts with Info-Addict slot on the usual DiploCorner listing... or vice-versa!

Nice Options tab, btw.
 
Hi rob, nice new release and it also finally works with my mod :)

I get this in Database.log, however:

Database::XMLSerializer (XML/InfoAddictScreen.xml): 'Row' or 'Delete' expected, got 'Label'

Edit: Hmm, does this mean we can update the info from UI XML files from somewhere else?
 
Is there a historical display in game of buildings built, units killed & units lost ?
If not can it be added to Infoaddict ; )

Would be nice ta see how efficient one is versus the A.I. !!

Wasn't that a table available in civ4? I can't remember if that was civ4 or civ3 but I distinctly remember it at some point. I'll poke around and see if that kind of data is available and, if so, what it would take to put in there.
 
Top Bottom