Two questions

Joined
Jul 5, 2004
Messages
23,562
Location
Canberra, Australia
I suspect the answer is no but it doesn't hurt to ask.

1) Is it possible to "deactivate" bits of XML from the BUG options screen?

I have a bunch of extra religions, around 20, but not everyone wants to play with all of them, especially not on small maps. Currently each is in a different folder in the modules area and if you don't want a religion you just remove the folder. A more elegant way would be to do it via options in game or an INI outside. I know the INI works but it is outside of Civ.

2) Have you BUG modularised python mission buttons?

This is just a vague/vain hope that I wont have to edit the Main Interface python. ;)
 
OK, I have almost got my python mission button working - editing CvMainInterface.py is not too bad when you have a good tutorial and a real example already in there that someone else did. :)

However I am up to the bit on adding hover over text to the button which requires I edit CvGameUtils.py. This file does not exist in the BUG version I have installed and Orion Veteran adds in a new set of his own game utils which includes a version of the function I need to edit "def getWidgetHelp". It would probably help if I could figure out where the function is called from but my search function has decided to stop looking in python files.

I am probably just venting - I have been accused of using the rant based method of system design and coding:), but some help would be nice. A pointer in the right direction perhaps.
 
Sounds like you need to lok at the BUG Wiki. It has a modding section that tells how to do things like adding Game Utils type functions.

Looks at this.

As that page shows, you can create your own game utils file and then load it via the BUG initialization process. You should probably look through the whole thing to get an idea of how BUG works and how to add your own stuff. (The BUG init.xml loads your mods config file which can have definitions for how to do events and gameutils callbacks and some other stuff.)
 
Sounds like you need to lok at the BUG Wiki. It has a modding section that tells how to do things like adding Game Utils type functions.

Looks at this.

As that page shows, you can create your own game utils file and then load it via the BUG initialization process. You should probably look through the whole thing to get an idea of how BUG works and how to add your own stuff. (The BUG init.xml loads your mods config file which can have definitions for how to do events and gameutils callbacks and some other stuff.)

Thanks for the link. I am very familiar with the BUG wiki, after all I have converted 10 or so mods to BUG:mischief:. However I am having one of those days where I can't find the obvious in documentation or even read it straight.:crazyeye:

Edit: OK, knew it was a handler/listener but did not know it was a CallBack which was what was throwing me. Still not clear on how it set it up and how OV used it, but getting there.

Could I have used functions in the WidgetUtil.py instead of editing CvMainInterface.py? It seems to be doing the same thing as I would think a generalization of the tutorial would do.
 
Could I have used functions in the WidgetUtil.py instead of editing CvMainInterface.py? It seems to be doing the same thing as I would think a generalization of the tutorial would do.

That looks likely. Unfortunately there doesn't seem to be any specific instructions on how to use it other than what is at the start of the file and none of the mods I have downloaded that use BUG use WidgetUtil for anything.
 
OK, after many days of fixing other stuff I can get back to this. :sigh:

Is the gamesutil tag additive? I.E. Can you have multiple <gameutils .../> definitions in the config\init.xml? Can they point to the same handler or listener? IE I have two mods I want to use which both add a python mission button so do I have to put one "getWidgetHelp" or can I have one in each mod?

Which utils are handlers and which are listeners and what is the difference? There is no description (or link) in the tutorial.
 
Right, I have think I have figured out what it is that I need to ask.

I am trying to add two buttons (python mission button) to my modmod Subduing Animals. The first lets you butcher a captured animal and food, hammers, gold are returned based on where the unit is being slaughtered (in a city, within your borders or in the wild). The second converts the unit into a resource on the map. I am following the button tutorial and things are going well.

However things are complicated because there are two other modmods in my target mod. These are Orion Veteran's Immigration mod which has a button as well and a Great Farmer mod that places various resources on the map. This means that they both use gameutils functions that I also want to use. Do I have to merge the various utils functions does BUG call each like it does for event functions?

Callbacks are notorious for increasing game turn times. Is it better for performance to merge them? Or should I ask that question elsewhere?

In the tutorial for creating the buttons they hard code a number for the widget. In WidgetUtils it maintains a global for next widget or suggests that one exists, but it does not expose the value. I could just duplicate what it does. Any suggestions?

Edit After figuring out my questions I went back and read the instructions. They are much clearer now. ;) However I think that my attempt at trying to have the Great Farmer and Subdue Animals modmod in the mod is doomed to failure since they both use the same callback "canBuild" and the result will depend on the type of unit attempting the build. the GF can build any resource but the subdued animal can only build one type. If both functions are called then the true from the GF will over ride the false from the SA.
 
Back
Top Bottom