Merging BUG with other Mods

If it's in there, that's where it would be. I think. Maybe. It's been a long while since I messed with it. That being said, if your mod has a custom DLL that changes where the symbols go, it most certainly should have provided its own font file. Does it?

No, I do not touch the fonts. I probabily merged it incorrectly and accidently changed something that controls the icons.

EDIT: After starting over, and merging again, I got the smilies to disappear. It works correctly now! :woohoo:

I do not know where the problem came from, but it stopped, and BUG works! I even got it to work with BULL!

Thank you very much for your help with this; without it I would probably have either given up or endured the smily apocalypse. :goodjob: :thanx: :hatsoff:
 
I'd like to use only the great general bar, but merging didn't work and created python exceptions. I am using a CustomEventManager and not BUG's Event manager. I figure the EventInterfacefiles should be merged and I'm not sure what else. Any tips please?:confused:
 
There are probably problems around BUG trying to access its options which won't exist since you're not using the full BUG stack. The GG bar doesn't require any special events, so you don't need anything from BUG's CvEventInterface.py. I think everything you need should be in CvMainInterface.py and GGUtil.py.

Anywhere you see it accessing an option such as MainOpt.isShowGGProgressBar() replace that with True.

GGUtil uses some functions from BugUtil and FontUtil that you'll need to merge somehow. I suggest just copying the functions to GGUtil and repeating as necessary.

BUG was designed to make it easy to add mods to it--not extract small pieces. :assimilate:
 
Thanks for the information. I orignally wanted to rebuild my mod from the ground up by merging all my files with BUG or RevDCM, but could never get it to work since interface icons were always missing.

BTW, did Al Pacino sell you that property? <---from Glengarry Glen Ross
 
Is this everything I need from Fontutil/BugUtil merged into GGUtil?

Spoiler :
Code:
## GGUtil
##
## Utilities for dealing with Great Generals.
##
## Notes
##   - Must be initialized externally by calling init()
##
## Copyright (c) 2008 The BUG Mod.
##
## Author: EmperorFool

from CvPythonExtensions import *

gc = CyGlobalContext()

g_ePromo = -1
g_promoButton = ""
g_cGreatGeneral = ""

def init():
	global g_ePromo
	g_ePromo = gc.getInfoTypeForString("PROMOTION_LEADER")
	global g_promoButton
	g_promoButton = gc.getPromotionInfo(g_ePromo).getButton()
	global g_cGreatGeneral
	g_cGreatGeneral = FontUtil.getChar(FontSymbols.GREAT_GENERAL_CHAR)

def getPromotionId():
	return g_ePromo

def getPromotion():
	return gc.getPromotionInfo(g_ePromo)

def getGreatGeneralText(iNeededExp):
	return BugUtil.getText("INTERFACE_NEXT_GREAT_GENERAL_XP", 
			(g_cGreatGeneral, iNeededExp))
			
def getText(key, values=(), default=None, replaceFontTags=True):
	"""
	Looks up a translated message in XML with a tuple of replacement parameters.
	It is safe to pass in a single value instead of tuple/list.
	If the key isn't found, the default is returned.
	"""
	if values is None:
		values = ()
	elif not isinstance(values, (tuple, list)):
		values = (values,)
	if isinstance(key, unicode):
		warn("getText - received Unicode key %s", key)
		key = str(key)
	text = localText.getText(key, values)
	if (text and text != key):
		if replaceFontTags:
			import FontUtil
			text = FontUtil.replaceSymbols(text)
		return text
	else:
		if default is not None:
			return default
		else:
			debug("BugUtil.getText - XML key %s not found", key)
			return "XML key %s not found" % key

def replaceSymbols(text, unknownReplacement=""):
	def replace(match):
		try:
			return getChar(match.group(1))
		except BugUtil.ConfigError:
			return unknownReplacement
	return SYMBOL_REGEXP.sub(replace, text)
			
def getChar(symbolOrKey):
	try:
		return symbolChars[getSymbol(symbolOrKey)]
	except KeyError:
		raise BugUtil.ConfigError("unknown font symbol or key '%s'" % str(symbolOrKey))
		
def getSymbol(symbolOrKey):
	if isinstance(symbolOrKey, FontSymbols):
		return symbolOrKey
	try:
		return keySymbols[symbolOrKey]
	except KeyError:
		try:
			return keySymbols[symbolOrKey.upper() + "_CHAR"]
		except KeyError:
			raise BugUtil.ConfigError("unknown font symbol or key '%s'" % str(symbolOrKey))

I thiink I am supposed to replace BugUtil or FontUtil with something, but I do not know what.
 
You'll need to look in FontUtil and BugUtil for how getChar() and getText() work. They are very simple functions that you could copy directly into GGUtil and then simply remove the package references in front of the function calls. In other words "FontUtil.getChar" becomes "getChar", etc.
 
I try to make some modifications to revolutiondcm that uses bug.

Here is my xml file:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
Amducias Mods
by Amducias

Copyright (c) 2011 Amducias.
-->
<mod id="Amdu"
module="Amdu"
name="Amducias Mod"
author="Amducias"
version="1.0"
date="09/11/2011"
url="http://forums.civfanatics.com/">

<event type="combatResult" function="onCombatResult"/>
<event type="BeginPlayerTurn" function="onBeginPlayerTurn"/>
</mod>


Here is my py file:

## Amdu

from CvPythonExtensions import *
import BugUtil
import PlayerUtil
import BugData
import Popup as PyPopup

gc = CyGlobalContext()

def onCombatResult(self, argsList):
pWinner,pLoser = argsList
popup = PyPopup.PyPopup()
popup.setBodyString( 'Combat Trigger' )
popup.launch()

def onBeginPlayerTurn(argsList):
iGameTurn, iPlayer = argsList


The popup is just there to test if the function is called. But after combat I get a eventhandler error message. can someone tell me what I am doing wrong?
 
Remove the first argument (self) from both functions. You only use the self argument if the functions are defined inside a class. Yes, I know it's not super obvious, but it's just how Python works.

If that doesn't solve the problem, make sure to follow the steps in the Troubleshooting page linked in my sig so you can post the full error message and stack trace.
 
Remove the first argument (self) from both functions. You only use the self argument if the functions are defined inside a class. Yes, I know it's not super obvious, but it's just how Python works.

If that doesn't solve the problem, make sure to follow the steps in the Troubleshooting page linked in my sig so you can post the full error message and stack trace.

Thanks EmperorFool,

That helped a lot. I think I have have my basics right, now.

Many Thanks,

Spellbinder
 
I tried out that BUFFY MOD. Incredible stuff there.
Quite well done. All those information bars were very useful.

I have a question:
Can I alter BUFFY for my mod?
I just change some unit speeds in that XML file.
 
yes. You will not be able to submit HOF games using the modified BUFFY mod.
 
I'm having trouble getting my project to compile the CvBugOptions files. Both the .h and the .ccp files are listed as part of the project, but when I compile, it just skips right over them. What do I need to change to have these files compile correctly?
 
I'm having trouble getting my project to compile the CvBugOptions files. Both the .h and the .ccp files are listed as part of the project, but when I compile, it just skips right over them. What do I need to change to have these files compile correctly?

Turns out that something was wrong with my makefile. I ended up using Asaf's version from his tutorial.
 
Where are the files that control the popups for selecting techs and city builds? Specifically, I'm having issue with both windows showing techs and builds that shouldnt be available to the player, so I need to add in some Prereq checks somewhere but I cant figure out where.
 
Is there an easy and/or simple way I can set some of the BUG options as disabled? I want them to still be shown on the BUG options screen, but I want them to be grayed out and un-clickable.


Also, I'm still looking for some help on my previous question regarding the tech and city build popups.
 
Yes, there is BUG documentation, and I wrote a tutorial that is not specific to BUG that described three different methods. BUG's method is very similar to the first method I describe in that thread.

I'm currently writing a step-by-step BUG tutorial, and the section on Game Utils is coming up soon.

I find all of these tutorials very confusing as they never explain where to put this strange XML tag. <gameutils module="MyMod" class="MyGameUtils" override="True"/>

All I want to do is to not have BUG overriding the function results from CvGameUtils. Can someone please explain how to do that?
 
Where are the files that control the popups for selecting techs and city builds? Specifically, I'm having issue with both windows showing techs and builds that shouldnt be available to the player, so I need to add in some Prereq checks somewhere but I cant figure out where.
All I want to do is to not have BUG overriding the function results from CvGameUtils. Can someone please explain how to do that?

Turns out I could bypass the whole BugGameUtils function rerouting by removing the CvGameInterfaceFile.py entirely. And in turn that fixed my problem with players being allowed to research and build things they shouldnt (the missing checks were in python and the BUG version wasn't calling the standard python functions for some reason).
 
Top Bottom