Jump to content

XML noob needs some pointers


Recommended Posts

What I want to do will be simple for you guys 'cos you have large brains :lmao:

I want to open and update an XML like this (part of Ghost Recon data files):

- <GunFile>
  <VersionNumber>1.500000</VersionNumber> 
  <ModelFileName>w_mm1.qob</ModelFileName> 
  <NameToken>WPN_MM1</NameToken> 
  <Weight>5.000000</Weight> 
  <MagazineCapacity>12</MagazineCapacity> 
  <MagazineWeight>2</MagazineWeight> 
  <MaxRange>500.000000</MaxRange> 
  <VelocityCoefficient0>1</VelocityCoefficient0> 
  <VelocityCoefficient1>1</VelocityCoefficient1> 
  <VelocityCoefficient2>1</VelocityCoefficient2> 
  <KillCoefficient1>1</KillCoefficient1> 
  <KillCoefficient2>1</KillCoefficient2> 
  <ProjectileCount>1</ProjectileCount> 
  <ProjectileSpread>0</ProjectileSpread> 
  <ReticuleTextureName>reticle_gl.rsb</ReticuleTextureName> 
  <ReticulePipLeft>43</ReticulePipLeft> 
  <ReticulePipTop>0</ReticulePipTop> 
  <ReticulePipRight>53</ReticulePipRight> 
  <ReticulePipBottom>24</ReticulePipBottom> 
  <ReticuleBaseLeft>0</ReticuleBaseLeft> 
  <ReticuleBaseTop>0</ReticuleBaseTop> 
  <ReticuleBaseRight>42</ReticuleBaseRight> 
  <ReticuleBaseBottom>42</ReticuleBaseBottom> 
  <ReticulePipBaseOffset>19</ReticulePipBaseOffset> 
  <ReticulePipMaxOffset>200</ReticulePipMaxOffset> 
- <Selective>
  <SelectiveOption RateOfFire="30" RoundsPerPull="1" StartSound="w_140grenadelauncher_ss.wav" /> 
  </Selective>
  <Recoil>100</Recoil> 
  <RunStandAccuracy>550</RunStandAccuracy> 
  <RunCrouchAccuracy>1000</RunCrouchAccuracy> 
  <RunProneAccuracy>350</RunProneAccuracy> 
  <WalkStandAccuracy>90</WalkStandAccuracy> 
  <WalkCrouchAccuracy>300</WalkCrouchAccuracy> 
  <WalkProneAccuracy>350</WalkProneAccuracy> 
  <ShuffleStandAccuracy>60</ShuffleStandAccuracy> 
  <ShuffleCrouchAccuracy>80</ShuffleCrouchAccuracy> 
  <ShuffleProneAccuracy>50</ShuffleProneAccuracy> 
  <StationaryStandAccuracy>15</StationaryStandAccuracy> 
  <StationaryCrouchAccuracy>10</StationaryCrouchAccuracy> 
  <StationaryProneAccuracy>5</StationaryProneAccuracy> 
  <TurnBandVelocity1>0.75</TurnBandVelocity1> 
  <TurnBandMultiplier1>1</TurnBandMultiplier1> 
  <TurnBandVelocity2>2</TurnBandVelocity2> 
  <TurnBandMultiplier2>5</TurnBandMultiplier2> 
  <TurnBandVelocity3>4</TurnBandVelocity3> 
  <TurnBandMultiplier3>10</TurnBandMultiplier3> 
  <TurnBandVelocity4>10</TurnBandVelocity4> 
  <TurnBandMultiplier4>30</TurnBandMultiplier4> 
  <TurnBandVelocity5>100000</TurnBandVelocity5> 
  <TurnBandMultiplier5>100</TurnBandMultiplier5> 
  <StabilizationTime>0.25</StabilizationTime> 
  <WeaponMotionType>4</WeaponMotionType> 
  <HasUnderbarrelWeapon>0</HasUnderbarrelWeapon> 
  <Silenced>0</Silenced> 
- <ZoomSettings>
  <Zoom>1</Zoom> 
  <Zoom>2</Zoom> 
  </ZoomSettings>
  <ProjectileFileName>40mmglgrenade.prj</ProjectileFileName> 
  <MuzzleFlashScale>1</MuzzleFlashScale> 
  <TracerFrequency>0</TracerFrequency> 
  </GunFile>

I want to update 2 values (or possibly more later):

GunFile\MagazineCapacity = "1"

GunFile\ProjectileFileName = "jammedgrenade.prj"

I am thinking of placing the updates in a text file in a similar format to what I have put here.

Then I read the text file and use the path and value to replace existing values.

I got as far a reading values but have no idea how to update them.

Thanks

Link to post
Share on other sites

Search for this inn help "StringReplace" i think that would do the trick.

StringReplace ( $input, "<VelocityCoefficient0>1</VelocityCoefficient0> " or start, "<VelocityCoefficient0>2</VelocityCoefficient0> ")

now i replaced <VelocityCoefficient0>1</VelocityCoefficient0> with <VelocityCoefficient0>2</VelocityCoefficient0>

not 100% sure if it works tho :lmao:

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...