How to add references to previous turn?

Caesium

Radiant!
Joined
Jan 14, 2006
Messages
526
Hi!

I asked myself, how to add references to the previous turn.
It would be nice to see, how the "civ values" changed since last turn.
For example romans last turn had 1056 points, this turn they have 1132 points, so I want to add an info like (+86).
How would I have to do this?

And another question:
Where can I add Informations to the "onMouseOver-info-popups"?

Thanks,
Caesium
 
Caesium said:
Hi!

I asked myself, how to add references to the previous turn.
It would be nice to see, how the "civ values" changed since last turn.
For example romans last turn had 1056 points, this turn they have 1132 points, so I want to add an info like (+86).
How would I have to do this?

And another question:
Where can I add Informations to the "onMouseOver-info-popups"?

Thanks,
Caesium

Not sure about the first one, but I know that most of the info pane can be accessed through the SDK by modifying what is returned when CvDLLWidgetData:: parseHelp is called on specific widgets. Also, these typically call functions in CvGameTextMgr.cpp, so you might find what you need there as well.
 
Thanks Gerikes :)

Now the only thing, that is missing is the first point.

Maybe TGA or TheLopez have an answer to that?
 
suchen.gif
 
You'd have to copy out the info and store it.

EG:
onBeginTurn
{
turnPrev = currentTurn;
currentTurn = playerScore;
difTurn = currentTurn - turnPrev;
}
 
What Dale said.

A problem comes when it's time to save (or more specifically, load). The data won't be saved by default - you'll have to add it to the saved data in the SDK (the read/write methods in most classes).
 
In normal I thought of something like that, but I wanted to enhance the CvMainInterfaceScreen, and this has no onBeginTurn. If it was so, I would have been able to solve the problem, but this is more complicated though I'd also have to add a variable for every player.
The problems with saving, I think, are soluble.
 
Caesium said:
In normal I thought of something like that, but I wanted to enhance the CvMainInterfaceScreen, and this has no onBeginTurn. If it was so, I would have been able to solve the problem, but this is more complicated though I'd also have to add a variable for every player.
The problems with saving, I think, are soluble.

You could probably make a seperate file that stores the data for you. Then, import that file into both the CvMainInterfaceScreen and CvEventManager. The CvEventManager will set the data within your python file, while the CvMainInterfaceScreen will get it from there. That won't solve your problem that TGA mentioned with saving and loading, but it would be a good start.

P.S. I tried out the new version of the Caesium Mod you sent me for a few different games and couldn't spawn an OOS. I had those variables to the unit allegiance mod that you were debugging all being set correctly, too.
 
Gerikes said:
You could probably make a seperate file that stores the data for you. Then, import that file into both the CvMainInterfaceScreen and CvEventManager. The CvEventManager will set the data within your python file, while the CvMainInterfaceScreen will get it from there. That won't solve your problem that TGA mentioned with saving and loading, but it would be a good start.

P.S. I tried out the new version of the Caesium Mod you sent me for a few different games and couldn't spawn an OOS. I had those variables to the unit allegiance mod that you were debugging all being set correctly, too.
I think, I'll try to use an an array for short save the values like iturnpoints[iplayer, iturn], so I can get the value iturnpoints[iplayer, iturn-1].
If this idea is right, tell it to me, and if it isn't then you should point to my error.

Thank you Gerikes for testing. I'll release a patch in the next days and post you a link. There are some minor bugs in this mod, but I think the mod's on a good way to final :)
 
Forget an array, add them as ints to CvPlayer class. Don't need to keep track of them then.

GET_PLAYER(getActivePlayer()).getPrevTurnScore();
GET_PLAYER(getActivePlayer()).getCurrTurnScore();

Then just work out the difference locally in python.

Dale
 
Dale said:
Forget an array, add them as ints to CvPlayer class. Don't need to keep track of them then.

GET_PLAYER(getActivePlayer()).getPrevTurnScore();
GET_PLAYER(getActivePlayer()).getCurrTurnScore();

Then just work out the difference locally in python.

Dale
Thanks Dale :)

My SDK/C++ skills are very low....
do these commands exist, or do I have to add code for this?
And if I'd have to add code, how would it look like?
 
Isn't this data already being stored in the game somehow, how else is the ScoreGraph being generated? I do very much like the idea :goodjob:
 
The Great Apple said:
Very true. CvPlayer::getScoreHistory(iTurn) IIRC. Should return the player's score on that turn. Forgot about that.
Yes, you're right, that doesn't work, or, if it does work I can't figure out how to use this command.
 
I just checked the python API, and I was right.

CyPlayer.getScoreHistory(iTurn) should return the player's score on turn iTurn.
 
I just wanted to let you know, that TGA was pretty right with his idea, it's working now, so have a look here for the file.

Thanks TGA.
 
Well done. :)
 
Back
Top Bottom