View Full Version : [XML]Easy(?) Problem with the "orPreReq" tech tag <solved>


Deon
Feb 01, 2008, 12:19 PM
What could be wrong with the tech prereqs?
I use <andPreReq> and <orPreReq> in my new CIV4Techinfos.xml, but they don't see to make any effect...
Even when the TECH_TOOLS is defined before the TECH_CRAFTING and TECH_CRAFTING has the

<orPreReqs>
<PrereqTech>TECH_TOOLS</PrereqTech>
</orPreReqs>

in the game it still has no prereqs...
Does anyone encounter such a problem? Please help =).
P.S. Even when I copy something like Sailing from original tech xml file and rename the needed entries, it stops working in terms of prereqs...

Deon
Feb 01, 2008, 02:25 PM
This is the part of my CIV4TechInfos.
It should be TOOLS -> CULTIVATION, but it isn't. What's wrong with it?

<TechInfo>
<Type>TECH_TOOLS</Type>
<Description>TXT_KEY_TECH_TOOLS</Description>
<Civilopedia>TXT_KEY_TECH_TOOLS_PEDIA</Civilopedia>
<Help/>
<Strategy>TXT_KEY_TECH_TOOLS_STRATEGY</Strategy>
<Advisor/>
<iAIWeight>0</iAIWeight>
<iAITradeModifier>0</iAITradeModifier>
<iCost>50</iCost>
<iAdvancedStartCost>100</iAdvancedStartCost>
<iAdvancedStartCostIncrease>0</AdvancedStartCostIncrease>
<Era>ERA_ANCIENT</Era>
<FirstFreeUnitClass>NONE</FirstFreeUnitClass>
<iFeatureProductionModifier>0</FeatureProductionModifier>
<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
<iTradeRoutes>0</iTradeRoutes>
<iHealth>0</iHealth>
<iHappiness>0</iHappiness>
<iFirstFreeTechs>0</iFirstFreeTechs>
<iAsset>8</iAsset>
<iPower>0</iPower>
<bRepeat>0</bRepeat>
<bTrade>1</bTrade>
<bDisable>0</bDisable>
<bGoodyTech>1</bGoodyTech>
<bExtraWaterSeeFrom>0</bExtraWaterSeeFrom>
<bMapCentering>0</bMapCentering>
<bMapVisible>0</bMapVisible>
<bMapTrading>0</bMapTrading>
<bTechTrading>0</bTechTrading>
<bGoldTrading>0</bGoldTrading>
<bOpenBordersTrading>0</bOpenBordersTrading>
<bDefensivePactTrading>0</bDefensivePactTrading>
<bPermanentAllianceTrading>0</bPermanentAllianceTrading>
<bVassalTrading>0</bVassalTrading>
<bBridgeBuilding>0</bBridgeBuilding>
<bIrrigation>0</bIrrigation>
<bIgnoreIrrigation>0</bIgnoreIrrigation>
<bWaterWork>0</bWaterWork>
<iGridX>1</iGridX>
<iGridY>1</iGridY>
<DomainExtraMoves/>
<CommerceFlexible/>
<TerrainTrades/>
<bRiverTrade>0</bRiverTrade>
<Flavors/>
<OrPreReqs/>
<AndPreReqs/>
<Quote>TXT_KEY_TECH_TOOLS_QUOTE</Quote>
<Sound/>
<SoundMP/>
<Button>Art/Interface/Buttons/TechTree/TOOLS.dds</Button>
</TechInfo>
<TechInfo>
<Type>TECH_CULTIVATION</Type>
<Description>TXT_KEY_TECH_CULTIVATION</Description>
<Civilopedia>TXT_KEY_TECH_CULTIVATION_PEDIA</Civilopedia>
<Help/>
<Strategy>TXT_KEY_TECH_CULTIVATION_STRATEGY</Strategy>
<Advisor>ADVISOR_GROWTH</Advisor>
<iAIWeight>0</iAIWeight>
<iAITradeModifier>0</iAITradeModifier>
<iCost>100</iCost>
<iAdvancedStartCost>100</iAdvancedStartCost>
<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
<Era>ERA_ANCIENT</Era>
<FirstFreeUnitClass>NONE</FirstFreeUnitClass>
<iFeatureProductionModifier>0</iFeatureProductionModifier>
<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
<iTradeRoutes>0</iTradeRoutes>
<iHealth>0</iHealth>
<iHappiness>0</iHappiness>
<iFirstFreeTechs>0</iFirstFreeTechs>
<iAsset>8</iAsset>
<iPower>2</iPower>
<bRepeat>0</bRepeat>
<bTrade>1</bTrade>
<bDisable>0</bDisable>
<bGoodyTech>1</bGoodyTech>
<bExtraWaterSeeFrom>0</bExtraWaterSeeFrom>
<bMapCentering>0</bMapCentering>
<bMapVisible>0</bMapVisible>
<bMapTrading>0</bMapTrading>
<bTechTrading>0</bTechTrading>
<bGoldTrading>0</bGoldTrading>
<bOpenBordersTrading>0</bOpenBordersTrading>
<bDefensivePactTrading>0</bDefensivePactTrading>
<bPermanentAllianceTrading>0</bPermanentAllianceTrading>
<bVassalTrading>0</bVassalTrading>
<bBridgeBuilding>0</bBridgeBuilding>
<bIrrigation>0</bIrrigation>
<bIgnoreIrrigation>0</bIgnoreIrrigation>
<bWaterWork>0</bWaterWork>
<iGridX>2</iGridX>
<iGridY>1</iGridY>
<DomainExtraMoves/>
<CommerceFlexible/>
<TerrainTrades/>
<bRiverTrade>0</bRiverTrade>
<Flavors>
<Flavor>
<FlavorType>FLAVOR_MILITARY</FlavorType>
<iFlavor>1</iFlavor>
</Flavor>
<Flavor>
<FlavorType>FLAVOR_GOLD</FlavorType>
<iFlavor>3</iFlavor>
</Flavor>
<Flavor>
<FlavorType>FLAVOR_SCIENCE</FlavorType>
<iFlavor>6</iFlavor>
</Flavor>
<Flavor>
<FlavorType>FLAVOR_CULTURE</FlavorType>
<iFlavor>2</iFlavor>
</Flavor>
<Flavor>
<FlavorType>FLAVOR_GROWTH</FlavorType>
<iFlavor>4</iFlavor>
</Flavor>
</Flavors>
<OrPreReqs>
<PrereqTech>TECH_TOOLS</PrereqTech>
</OrPreReqs>
<AndPreReqs/>
<Quote>TXT_KEY_TECH_CULTIVATION_QUOTE</Quote>
<Sound/>
<SoundMP/>
<Button>Art/Interface/Buttons/TechTree/Cultivation.dds</Button>
</TechInfo>

ripple01
Feb 01, 2008, 02:44 PM
It's a capitalization issue...

Try the following and it should fix your issue...

<OrPreReqs>
<PreReqTech>TECH_TOOLS</PreReqTech>
</OrPreReqs>

Cheers,
ripple01

Deon
Feb 01, 2008, 02:51 PM
Thank you for your try, but no, it's PrereqTech...
As i said I copied from original XML.
If you used PreReqTech (as I did once), you get the error:
http://img215.imageshack.us/img215/2782/errpo1.th.png (http://img215.imageshack.us/my.php?image=errpo1.png)

Any advice? I'm lost.
LOST LOST LOST LOST!!!
I started to mod quickly, quickly learned, got some python skills and then... This crap.
HELP me please.

Deon
Feb 01, 2008, 03:12 PM
Now it's even much more weird....
I took the original XML, copied the SAILING tech and renamed all the TECH_SAILING to TECH_TESTING in the copied text... And it lost it's links to the prereqs. WHY?!...

Mylon
Feb 02, 2008, 03:28 AM
No clue what the problem is. I've added techs before and the prereqs worked just fine.

Like in this file for vanilla Civ4...

Deon
Feb 02, 2008, 04:21 AM
DO NOT EVER PLACE COMMENTS INSIDE OF YOUR XML!!!
:crazyeye:
The problem is solved by myself.

CyberChrist
Feb 02, 2008, 06:07 AM
You can place comments just fine in (most) of the XML files. Just place them between <!-- and --> 'brackets'.

Example:
<!-- my comments bla bla ... -->

I can strongly advice using a text editor that use colorcoding based on tags though - to spot any typos fast.

Deon
Feb 02, 2008, 08:04 AM
Man you shouldn't place <!-- my comments bla bla ... --> between </techinfo> {HERE} <techinfo>, or the following tech will lack its prereqtechs (for me it's so).

I like Notepad2 or Notepad++.

Mylon
Feb 02, 2008, 08:38 AM
Ah yes, I have had difficulties with comments in the past. I don't think I ever tried commenting _inside_ the fields, however. But in general, comments are likely to break stuff, even if used properly.

CyberChrist
Feb 02, 2008, 10:22 AM
Comments (when started and finished properly) never broke anything for me regardless of where I put them. Of course that may just be because I never thought of putting them anywhere where it might cause errors - heh.

@Deon:
I am using UltraEdit myself - color coding really makes a big difference for spotting potential slip ups.

Deon
Feb 02, 2008, 10:23 AM
But believe me, I spent a night figuring this out.
Commenting was ok in other xmls, but for CIV4TechInfos it was fatal. I tried it a few times and every time the error was reproduced clearly =).

CyberChrist
Feb 02, 2008, 10:27 AM
All I can tell you is that my TechInfo is full of comments - all over the place - with no problems.

Deon
Feb 02, 2008, 12:05 PM
Then it's the problem of my version. Strange =).

CyberChrist
Feb 02, 2008, 01:17 PM
Would probably be easier to say for sure if you posted your non-working file.

Deon
Feb 02, 2008, 02:12 PM
It would be easier to post my mod then... Because if you use my techinfo only, you get a LOT of errors because there're just 2 techs there, and I relinked others to TECH_NEVER.
Anyway it's easy to check - I can ruin my usual game by opening Civ4\Beyond the sword\Assets\XML\Technologies\CIV4TechInfos.xml and adding some comment just before the future tech:

<!-- WILL IT RUIN THE PREREQS? -->
<techinfo>
<tag>TECH_FUTURE_TECH</tag>
...

Deon
Feb 02, 2008, 02:14 PM
BANG! Now the ancient greece can research the future tech =).
No prereqs at all.

I'd say it's strange, because I have a usual en BTS with the patch 3.13.
Can you do the same as I did and tell me your result?

CyberChrist
Feb 02, 2008, 11:36 PM
The code you posted will of course not work and isn't helpfull in determining why it doesn't work for you(I assume you retyped it just for the post).

You need to post the code EXACTLY as you have it in your non-working file for anyone to have a chance to give your reasons why it doesn't work.

Anyway, I had no intention of testing the file by implementing it in a mod and the running it - I would just have fired it up in my editor to see if any schematic flaws would make themselves visible.

Deon
Feb 03, 2008, 12:45 AM
The code you posted will of course not work
I did not get it... Why won't it work?! I just used a comment as you said.
I just edited the BASE CIV4TechInfos.xml by adding the comment line where I said. Isn't it clear? The file is actually the one from my bts installation.
Here it is.

Was my english SO bad that you couldn't understand what I said, or is it me missing something in your words? Explain me please =).

P.S. Uploaded file already contains the comment line which ruins prereqs.

CyberChrist
Feb 03, 2008, 02:27 AM
I did not get it... Why won't it work?! I just used a comment as you said.
I just edited the BASE CIV4TechInfos.xml by adding the comment line where I said. Isn't it clear? The file is actually the one from my bts installation.
Here it is.

Was my english SO bad that you couldn't understand what I said, or is it me missing something in your words? Explain me please =).

P.S. Uploaded file already contains the comment line which ruins prereqs.
There is no such tag as <tag> in default cIV XML so it definetly isn't how it looks in your version of BTS either - of course it would explain why it fails if you had indeed been using that 'tag' (which I don't think you did). ;)

Anyway, looking at your attached code then the problem seems to be one of incorrect indention (fairly common problem really). You have used SPACE before your comment where the rest of the tags in the XML are using TAB. While it is possible to mix the two indention approaches then you have used only 5xSPACE before your comment where the preceeding and following tags use 2xTAB. This is most likely why it fails.

If you for some reason insist on mixing SPACE and TAB indentions (which is a very bad idea imo) then it will only work if you use the measure of 1xTAB = 4xSPACE ... and vice versa.

Personally I see no reason to use anything but TAB indentions - they make it faster to edit, easier to spot any indention mistakes and takes up less HD/memory space (SPACE indentions can grow into MBs of wasted space in larger mods).

Deon
Feb 03, 2008, 05:55 AM
Ouch, it was "type" not "tag".
Sooo, was it just because of space? Nice =).
Thank you for this note, I definitely want to have my comments inside my techinfos =))).