View Full Version : CvInfoBase/Python-XML Question


Belizan
Jan 13, 2006, 06:35 AM
Is there anyway to get the value of an arbitrary element from within the Python API without having to parse the XML file "manually"?

I.e.

If I add a <bNoMonster>0</bNoMonsters> to each <EraInfo> element, is it possible for me to ask for the value of bNoMonsters given a particular EraInfo? Similarly for adding "fields" to <UnitInfo> elements, etc.

Anyone know?

12monkeys
Jan 13, 2006, 06:58 AM
Look here : http://civilization4.net/files/modding/PythonAPI/

select class CvInfoBase->CvEraInfo
and try to use this method : getXmlVal()

Belizan
Jan 13, 2006, 02:17 PM
I tried that before posting, actually :/. getXmlVal() doesn't take any arguments, you'll notice :/. In any event, getXmlVal() returns the <TYPE/> element for a given era (I didn't try it with other InfoBase derivitives).