• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Help with xpath - Changing car colors

SlicksGirl

Refugee
I have changed car colors in past versions, before learning xpath. So my question is, if i wanted to replace multiple properties of a block, how would i do that? and do i need to change it for both cntCar03SedanDamage0 and cntCar03SedanDamage1?

i realize this appends it, is there a way to replace it?

Code:
<append xpath="/blocks/block[@name='cntCar03SedanDamage0']"><property name="RandomTintColor1" value="0,50,110" param1="car03_white"/>
<property name="RandomTintColor2" value="255,0,255" param1="car03_white"/>
<property name="RandomTintColor3" value="255,255,0" param1="car03_white"/>
<property name="RandomTintColor4" value="255,128,0" param1="car03_white"/>
<property name="RandomTintColor5" value="51,0,0" param1="car03_white"/>
<property name="RandomTintColor6" value="255,128,0" param1="car03_white"/>
<property name="RandomTintColor7" value="102,102,0" param1="car03_white"/>
<property name="RandomTintColor8" value="51,51,0" param1="car03_white"/>
<property name="RandomTintColor9" value="128,255,0" param1="car03_white"/>
<property name="RandomTintColor10" value="0,51,0" param1="car03_white"/>
<property name="RandomTintColor11" value="0,255,255" param1="car03_white"/>
<property name="RandomTintColor12" value="0,102,102" param1="car03_white"/>
<property name="RandomTintColor13" value="0,0,204" param1="car03_white"/>
<property name="RandomTintColor14" value="0,0,51" param1="car03_white"/>
<property name="RandomTintColor15" value="51,0,102" param1="car03_white"/>
<property name="RandomTintColor15" value="51,0,51" param1="car03_white"/>
<property name="RandomTintColor15" value="204,0,102" param1="car03_white"/>
<property name="RandomTintColor15" value="0,102,51" param1="car03_white"/>
<property name="RandomTintColor15" value="255,51,255" param1="car03_white"/>
<property name="RandomTintColor15" value="0,0,0" param1="car03_white"/>
<property name="RandomTintColor15" value="96,96,96" param1="car03_white"/>
<property name="RandomTintColor15" value="102,51,0" param1="car03_white"/>
</append>
 
It appears you can use set for multiple items so the code looks very similar to the append code.

Code:
<set xpath="/blocks/block[@name='cntCar03SedanDamage0']">
	<property name="RandomTintColor1" value="0,50,110" param1="car03_white"/>
       	<property name="RandomTintColor2" value="255,0,255" param1="car03_white"/>
       	<property name="RandomTintColor3" value="255,255,0" param1="car03_white"/>
       	<property name="RandomTintColor4" value="255,128,0" param1="car03_white"/>
       	<property name="RandomTintColor5" value="51,0,0" param1="car03_white"/>
       	<property name="RandomTintColor6" value="255,128,0" param1="car03_white"/>
       	<property name="RandomTintColor7" value="102,102,0" param1="car03_white"/>
       	<property name="RandomTintColor8" value="51,51,0" param1="car03_white"/>
       	<property name="RandomTintColor9" value="128,255,0" param1="car03_white"/>
       	<property name="RandomTintColor10" value="0,51,0" param1="car03_white"/>
       	<property name="RandomTintColor11" value="0,255,255" param1="car03_white"/>
       	<property name="RandomTintColor12" value="0,102,102" param1="car03_white"/>
       	<property name="RandomTintColor13" value="0,0,204" param1="car03_white"/>
       	<property name="RandomTintColor14" value="0,0,51" param1="car03_white"/>
       	<property name="RandomTintColor15" value="51,0,102" param1="car03_white"/>
       	<property name="RandomTintColor15" value="51,0,51" param1="car03_white"/>
       	<property name="RandomTintColor15" value="204,0,102" param1="car03_white"/>
       	<property name="RandomTintColor15" value="0,102,51" param1="car03_white"/>
       	<property name="RandomTintColor15" value="255,51,255" param1="car03_white"/>
       	<property name="RandomTintColor15" value="0,0,0" param1="car03_white"/>
       	<property name="RandomTintColor15" value="96,96,96" param1="car03_white"/>
       	<property name="RandomTintColor15" value="102,51,0" param1="car03_white"/>
 	</set>
Haidr'Gna says this works so credits to him for tinkering about with xpath and discovering this method ... normally I would use <remove xpath="/blocks/block[@name=cntCar03SedanDamage0]"></remove> to remove whole block and then either append it like in your code example to end of file or use insertAfter (previous block) to place new code in the file in the appropriate place.

Not sure about second part of the question to be honest, but after first stage of wrenching a car I have never noticed wether it still has a colour or not.

 
Last edited by a moderator:
I replaced the colors manually and started a new seed and it appears that, the game ignores the car colors, because it only serves up 4 colors and white. and none of those colors are in the list.

- - - Updated - - -

your code example should work though, thanks!

 
Back
Top