Requests for new components (and features)

First grab the option object (not its value). Here "ANewDawnSettings" is the <mod>'s id attribute--not a Python module name. Notice there are no ()s after the option ID, and you don't use a getter function name. Next create your list as you did above. Finally call setValues() on the option.

You completely lost me here. Could you give me a rough example?


On an unrelated topic; I've noticed that some BULL options in MP only work when everyone has the same setting. Couldn't you create list of all players and their selected settings for those options, and get the option for each unique player, to ensure full MP support?
 
You completely lost me here. Could you give me a rough example?

I did. :confused: What part didn't you understand? The code I posted shows everything except calling updateAliveCivsOption() from several event handlers, but that should be old hat for you by now.

I've added comments pointing out the three steps to the code in my previous post. Does that help?
 
I did. :confused: What part didn't you understand? The code I posted shows everything except calling updateAliveCivsOption() from several event handlers, but that should be old hat for you by now.

Do you have any idea how much that confused smiley annoys me? :trouble:

Anyway, I understood the python just fine. It was this bit that was short on the description:

Next create your list as you did above. Finally call setValues() on the option.

So is my list supposed to look like this? Or is it supposed to be set="updateAliveCivilizationsdesc"? Or something completely different...

Code:
 				<list   id="AliveCivilization" key="AliveCivilization" 
					type="int" default="0" listType="string" 
					get="getAliveCivilization" set="setAliveCivilization">
				</list>
 
You don't need to change your <list> element at all.

"Next create your list as you did above" is the code that you posted that loops over all of the alive players, appending their descriptions to a list. That's the list. It's unfortunate they are the same word (list), but they are different things, but the <list> you create uses the (Python) list that you create. ;)

"Finally call setValues() on the option" is the code that I posted commented now by 3. Literally call the setValues() function on the ListOption object that you stored in aliveCivsOption under comment 1.

The code I posted should work as I wrote it save for the one thing I mentioned: You must change "ANewDawnSettings" to match the id attribute of your <mod>/<bug> element in the config XML that contains the "AliveCivilization" <list> option. And you need to add the event handlers, but they are one-liners that call the function I wrote; you can even use a single event handler function and register it for each event type since you don't care about its arguments.

BTW, my confused smiley was not to say, "You should understand all of this," but rather, "I know that you understood some of it because I've seen you use it, but you said you didn't understand any of it, so I am forced to read your mind which I cannot do." When you don't understand, please specific (as you were in your next post) so I can help you.
 
Thanks for the explanation; I understand now.

BTW, my confused smiley was not to say, "You should understand all of this," but rather, "I know that you understood some of it because I've seen you use it, but you said you didn't understand any of it, so I am forced to read your mind which I cannot do." When you don't understand, please specific (as you were in your next post) so I can help you.


I hated the confused smiley long before you used it. I wasn't inferring any malice on you; just stating an opinion. :p
 
Thanks for the explanation; I understand now.

Famous last words.

Anyway; I think I did everything correctly, but I get a python traceback that originates from BUG.

Here's the Python Code:
Spoiler :
Code:
def updateAliveCivsOption():
	descs = []
	for i in range(0,gc.getMAX_PLAYERS()):
		player = gc.getPlayer(i)
		if (player.isAlive()):
			BugUtil.debug("Adding Player %s to Civilization Value", player.getCivilizationShortDescription(0))
			descs.append(player.getCivilizationShortDescription(0))
	descs.sort()
	ANewDawnOpt.AliveCivilization.setValues(descs)

The XML:

Spoiler :
Code:
				<list   id="AliveCivilization" key="AliveCivilization" 
					type="int" default="0" listType="string" 
					get="getAliveCivilization" set="setAliveCivilization">
				</list>

I put that Debug(...) call in trying to figure out if I was setting an empty list. I'm not though:

Spoiler :
Code:
01:33:12 DEBUG:Adding Player Ottomans to Civilization Value
01:33:12 DEBUG:Adding Player India to Civilization Value
01:33:12 DEBUG:Adding Player Rome to Civilization Value
01:33:12 DEBUG:Adding Player Aztec to Civilization Value
01:33:12 DEBUG:Adding Player Byzantium to Civilization Value
01:33:12 DEBUG:Adding Player America to Civilization Value
01:33:12 DEBUG:Adding Player Celtia to Civilization Value
01:33:12 DEBUG:Adding Player Barbarians to Civilization Value

Here's the traceback:

Spoiler :
Code:
Traceback (most recent call last):

  File "CvScreensInterface", line 935, in handleInput

  File "CvMainInterface", line 6144, in handleInput

  File "BugOptionsScreen", line 44, in showOptionsScreen

  File "BugOptionsScreen", line 144, in interfaceScreen

  File "BugOptionsScreen", line 151, in createTabs

  File "RoMOptionsTab", line 77, in create

  File "BugOptionsTab", line 308, in addTextDropdown

TypeError: iteration over non-sequence
ERR: Python function handleInput failed, module CvScreensInterface

I must be missing something simple... I'm not sure what though.
 
Looks like getDisplayValues() expects that you'll call setValues() only once. The values are supposed to be fixed upon initialization. However, you may be able to trick BUG by adding a line after your call to setValues():

Code:
ANewDawnOpt.AliveCivilization.setValues(descs)
ANewDawnOpt.AliveCivilization.translated = False

Also, you cannot call sort() on the list as it doesn't sort the list in place--it returns a sorted copy. You can either assign the result back to descs

Code:
descs = descs.sort()

or call the global function as I wrote it

Code:
sort(descs)

Finally, why not use PlayerUtil.players(alive=True) as I had?
 
Okay; It works as in I don't get Python errors anymore. But It doesn't show the list of civilizations; it shows that I'm missing the LIST text-key.
 
Hmm, guess I'll have to handle this properly when I get home. For now you can skip setValues() and translated and instead set displayValues directly. I don't know if this will work, though.

Code:
ANewDawnOpt.AliveCivilization.displayValues = descs

It may still see that the list isn't translated and try to find the <Text> element.
 
No dice. I appreciate all the help you given me so far. If I have to wait until the next release of BUG for the feature, it's okay, no rush. ;)
 
I'm a big fan of BUG, and I am also a big fan of screenshots. Is there perhaps a way to incorporate the Flying Camera Mode into BUG? Perhaps with some nice interface functions and so to make it understandable and easily accessed. And maybe a function to vary "flying speed" and so, to really get those screenshots perfectly aligned!

It would make screenshooting much more fun. I do 99% of my screenies in Flying Camera, however, it needs to be activated in the .ini.
 
I haven't used the flying camera, but I have seen the setting in the INI and some functions in the code. Why doesn't it work with BUG? If you have BUG installed in multiplayer mode, you should be able to modify BUG's INI the same as BTS's. If you are using singleplayer mode, it should work if you already have modified BTS's INI.

If it doesn't work, what more is needed? Also, what exactly would you like to see. I did see a modcomp once that had a bunch of keyboard shortcuts for the flying camera I think; that was several years ago unless I'm just thinking of CvCameraControls in Civ4 itself. Actually, I think that's what I'm thinking of.
 
No. It works alright with BUG. I just think a nice new feature would be more integration of it into BUG; with speedcontrols and so on.
 
Could you please make the scroll wheel work in the Foregin Advisor "Resource" and "Tech" screens? (like it does in some other screens)

Also, the scrolling in the Foreign Advisor "Active" screen is not satisfactory since it stops scrolling every time your mouse pointer is over one of the active deals.
EDIT: Found 2 more screens where scrolling doesn't work: Military Advisor "Sit-Rep" and "Strategic Advantages".

I guess the fix would be to add a scrollbar like some other screens have. (instead of the arrows)
 
the scrolling on those screens is a function of the method we are using to create the layout. It doesn't allow scroll bars.
 
So it's not possible to add scrolling on those screens? It's a big advantage in my book. Makes things go a lot quicker.
 
I tried unsuccessfully to add scrollwheel capability to those screens, but nothing I tried worked. Civ4's GUI toolkit just doesn't pass the events through in some cases. And the scrollable area in that toolkit limits the things you can draw inside it. :(
 
I discovered an error in the Foreign Advisor "Info" screen. The total attitude number of a leader doesn't take into account the "A first impression is a lasting one" factor. The Glance screen does, and so these two screens have different values. In most cases, the Info screen shows a better relation than I really have.
 
I discovered an error in the Foreign Advisor "Info" screen. The total attitude number of a leader doesn't take into account the "A first impression is a lasting one" factor.

Fixed. BUG no longer ignores attitude modifiers it doesn't understand on the INFO tab.
 
Top Bottom