Merging BUG with other Mods

Regarding the Technology Advisor/Chooser, BUG adds the GP Tech Prefs along the left-hand side. Make sure you copy the two new functions and the code that calls then. I don't think BUG modifies the drawArrows() function, so leave the one from RFC as-is.
 
Is there any way to turn on some debug option so that I know exacly where in python I made a mistake if I do make one?

Also, my current efforts end with an instant Game over as soon as the scenario starts.
I suspects that it is becouse it somehow interfears with the function that creates units at game start or the scenario file it self.
Witch do you think of the two is it?
 
Turn on logging and hide Python exceptions.

Code:
; Enable the logging system
LoggingEnabled = [B]1[/B]

; Set to 1 for no python exception popups
HidePythonExceptions = [B]1[/B]

Now when Python has a problem it will write it to My Games / BTS / Logs / PythonErr.log. BUG also writes logging messages to PythonDbg.log. You can change the logging level to Debug to see all the messages in that file on the BUG Options screen's System tab.
 
How do I do this? What file do I edit to enable this?
 
Does this meen anything to you?

Becouse they don't to me...
 

Attachments

  • New Folder.rar
    3.8 KB · Views: 72
It's going to be extremely difficult to debug errors by merging two large chunks of code. The only clue I see is that CvMercenaryScreensEnums initializes SdToolikit pretty early (before a game as started or loaded). Typically that's not allowed, but I don't know why it's doing that.

In the error log it says that some module (should be BugConfig) doesn't have a Handler attribute, so check that there is a line that says

Code:
class Handler:

in BUG/BugConfig.py. Instead of merging all of RFC at once, I would merge each submodule individually and test that it works. Even with tons of Python modding experience this would be a huge task to try in one sitting.

Did you read and understand the docs I linked for you? Pay special attention to the Core Events section as that explains how event managers work in BUG.
 
If you or someone else can fix SevoPediaLeader.py so that it can display multiple civilizations in a nice way, I'll gladly add it to BUG. It already loops through all the civs, but it sets a single image button, overwriting the previous one if multiple are displayed, so only the last one is visible.

You'd need to add multiple buttons when there are multiple civs, and use a scrolling list if there are too many to fit.

Thanks EF. Got it working. Keep in mind thought this is very trial and error code. I'm sure there are better ways to set it up, but basically I was cloning similar functions and tweaking things till it worked. I'll attach my SevoPediaLeader.py file as it's a simple thing of winmerge to change the code to display multiple leaders.

I also re added the function to remove the barbarian leader, which was not working with BUG, the function in CvPediaMain was being overriden by SevoPediaMain, and was listing the barbarian leader. Simply cloned the function from CvPediaMain into SevoPediaMain to fix that (this has been a longstanding issue with BUG, that always bothered me). I'm not going to attach my SevoPediaMain.py file, because it's modded to incorporate Legends Units for LoR. Instead I'll just paste the code here:

Code:
	def placeLeaders(self):
		self.list = self.getLeaderList()
		list = self.list
		listCopy = list[:]
		for item in listCopy:
			if item[1] == gc.getDefineINT("BARBARIAN_LEADER"):
				list.remove(item)
			elif gc.getDefineINT("CIVILOPEDIA_SHOW_ACTIVE_CIVS_ONLY") and gc.getGame().isFinalInitialized():
				if not gc.getGame().isLeaderEverActive(item[1]):
					list.remove(item)
		self.list = list
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_LEADER, gc.getLeaderHeadInfo)
Again trial and error coding here, so the whole self.list = list thing might not be necessary, but I just wanted to be safe here. Hopefully these two things can be incorporated into the next BUG update.
 
Can you post some screenshots of how it looks with 1, 2, and more Civs for a leader so I can see what to expect?

Also, why would you want to hide good ol' Sid? ;)
 
I guess it's start from scrach time than.
Nothing like a little trial and error to learn stuff.

BTW, what files did you link me to? I was just checking the pages back and can't find anything.
 
Also, why would you want to hide good ol' Sid? ;)
It just looks bad, especially since there is no article for him. It would be alright I suppose if someone wrote up a joke article about him ridding the world of civilization with the barbs, and also gave the leader a proper button, currently he uses Ghengis's which is another aesthetic thing that bothers me about it.

Can you post some screenshots of how it looks with 1, 2, and more Civs for a leader so I can see what to expect?
OK, i re wrote the function to make it more inline with what you say you want. Reuploading the file for that as well. And here are the screenshots:

As you can see, looks exactly the same as now if there is only 1 civ defined for the leader:
Spoiler :

A pane is added to facilitate multiple civs if the leader is set up to have them:
Spoiler :

And the user can scroll the pane if there are too many civs to fit in it:
Spoiler :
 
I guess it's start from scrach time than.
Nothing like a little trial and error to learn stuff.

It can be disheartening, but you're right that it's the best way to learn. Take it slow, one step at a time. RFC might be a tough first project simply because it has so many features that may not be easy to break apart into small chunks, but there are probably more than a few players that would like to see this merge.

BTW, what files did you link me to? I was just checking the pages back and can't find anything.

The Modders' Corner on the BUG wiki. It documents how to add events, gameutils, options, etc. Most importantly, it explains how to use BUG's XML configuration files which go in Assets/Config.
 
@EF

Do you want me to repost the corrected code from here: http://forums.civfanatics.com/showpost.php?p=8580605&postcount=4 or are things good to incorporate this into BUG at this point. There are a couple of errors in there, but easy to fix, I have it done if you want it, but that's probably not necessary; I'm just more curious if this is good to go from your perspective.
 
OK, here it is.
 
This weekend, I promise. What about SVN didn't you like? It's easy to use and gives you a lot of power. I highly recommend you create a project at SourceForge or Google Code and use it to host you mod development. Having a revision control system will save your butt many times.

Is it still the weekend?

Now that you mention it, I really should start a project on one of those. Which would you recommend?

If I were to do something like that then SVN would become a lot more useful, I admit.

If you want any help doing the last part of the merge, I'd be happy to do it. Especially in merging in ACO and the UP.
 
OK, here is the updated SevoPediaLeader.py file. Hopefully fourth time's the charm.
 
The Unit Upgrades graph is driving me nuts. I'm trying to pull out a single unit from it, but it's not working. In the file we have this as a comment:

Code:
#The exception list allow you to completely hide a unit from the upgrade graph.
#This is useful for mods that use an unreachable unit to keep others from expiring.
#Example unitExceptionList = [UNIT_UNREACHABLE]
So I put in this code to exclude legend units:
Code:
unitExceptionList = []
for i in range(gc.getNumUnitClassInfos()):
	if (gc.getUnitClassInfo(i).getMaxGlobalInstances() != -1):
		unitExceptionList.append(gc.getUnitInfo(gc.getUnitClassInfo(i).getDefaultUnitIndex()).getType())
Works great. Now I try to do the easy thing, and put in the single unit as it shows in the example, and it never works, just get a python exception. Here is the code I've tried:
Code:
unitExceptionList = []
for i in range(gc.getNumUnitClassInfos()):
	if (gc.getUnitClassInfo(i).getMaxGlobalInstances() != -1):
		unitExceptionList.append(gc.getUnitInfo(gc.getUnitClassInfo(i).getDefaultUnitIndex()).getType())
unitExceptionList.append(UNIT_EARLY_FLYER)
And I've tried everything, staring out the list as it shows in the example unitExceptionList = [UNIT_EARLY_FLYER], tried using gc.getInfoTypeForString and .getType calls so that it's like the function that works. Nothing, nothing works.

All I ever get is "UNIT_EARLY_FLYER is undefined". So my question is, how do I append this list with a unit, if all I have to to access it is it's unit type, or unitclass type? I was getting around this by making this unit a legend unit, but then it goes in the legend list in the civilopedia, which I don't want. I just want this unit pulled from the Unit Upgrades Graph, but not effect it in any other way. What am I doing wrong here?
 
You need to enclose UNIT_EARLY_FLYER in quotes because it's a string:

Code:
unitExceptionList.append("UNIT_EARLY_FLYER")
 
Wow, thanks. I can't believe I spent so much time on this, and the solution was something that should have been instantly apparent.
 
Top Bottom