Author Topic: REPLACE request  (Read 1544 times)

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 378
  • Gender: Male
  • Creator of spells
REPLACE request
« on: August 20, 2010, 09:33:03 AM »
I have a file xxx.2da that looks like this:
Code: [Select]
1
2
3
4
5
6

And I'd like to patch it like this,
Code: [Select]
COPY_EXISTING ~xxx.2da~ ~override~
REPLACE_TEXTUALLY ~1 ~ ~2~
REPLACE_TEXTUALLY ~2 ~ ~3~
REPLACE_TEXTUALLY ~3 ~ ~4~
REPLACE_TEXTUALLY ~4 ~ ~5~
REPLACE_TEXTUALLY ~5 ~ ~6~
REPLACE_TEXTUALLY ~6 ~ ~7~
all my numbers are turned into 7s because REPLACE_TEXTUALLY replaces as it goes and then starts over. There can be workarounds by replacing text to temps and replacing the temps back, but it would be so much nicer if WeiDU could handle this.

Maybe there could be a REPLACE_TEXTUALLY_LATER and a REPLACE_TEXTUALLY_NOW feature. Or allow REPLACE_TEXTUALLY to take more than one pair of parameters:
Code: [Select]
COPY_EXISTING ~xxx.2da~ ~override~
REPLACE_TEXTUALLY ~1 ~ ~2~
 ~2 ~ ~3~
 ~3 ~ ~4~
 ~4 ~ ~5~
 ~5 ~ ~6~
 ~6 ~ ~7~

And what I'm talking about would apply to the rest of the REPLACE_ family.

-Galactygon

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: REPLACE request
« Reply #1 on: August 20, 2010, 10:32:51 AM »
Unfortunately, what you're asking for is impossible to do. If it makes sense in your context, doing the REPLACE_TEXTUALLY should fix the problem.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: REPLACE request
« Reply #2 on: August 20, 2010, 04:43:48 PM »
if you're just incrementing them, reverse the patch order (change 6 to 7, then 5 to 6, then 4 to 5, etc.).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: REPLACE request
« Reply #3 on: August 20, 2010, 04:59:06 PM »
if you're just incrementing them, reverse the patch order (change 6 to 7, then 5 to 6, then 4 to 5, etc.).
What he said - I accidentally forgot to type the "in reverse order".
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 378
  • Gender: Male
  • Creator of spells
Re: REPLACE request
« Reply #4 on: August 30, 2010, 01:43:47 AM »
I've resolved this - thanks!

-Galactygon

Offline GeN1e

  • Planewalker
  • *****
  • Posts: 267
  • Gender: Male
Re: REPLACE request
« Reply #5 on: August 30, 2010, 09:15:16 PM »
REPLACE_EVALUATE ~\([0-9]\) ~ BEGIN res =
 MATCH1 = 1 ? 2 :
 MATCH1 = 2 ? 3 :
 MATCH1 = 3 ? 4 :
 MATCH1 = 4 ? 5 :
 MATCH1 = 5 ? 6 :
 7
END ~%res%~

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: