Author Topic: [SOLVED] Confitions not being evaulated in a GLOB REGEX?  (Read 1527 times)

Offline Lollorian

  • Planewalker
  • *****
  • Posts: 96
[SOLVED] Confitions not being evaulated in a GLOB REGEX?
« on: November 29, 2011, 05:12:27 AM »
WeiDU seems to skip random PATCH_IFs even if all the conditions match when doing COPY_EXISTING_REGEXP ??? This one to be exact (there are others as well but I debugged just this :D)
Code: [Select]
            PATCH_IF (("%type%" =  1) AND ("%amulet%" = 0) AND ("%ignore%" = 0) AND (("%flags%" BAND 0b00000100) = 0b00000100) AND ("%index%" > 17)) BEGIN
              PATCH_PRINT ~%SOURCE_FILE%: Equippable items in inventory: %item%.itm! Equipping AMULET~
              WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff
              WRITE_SHORT ("%slot_off%" + (0x02 * 6))         "ref"
              SET "%amulet%" = 1
            END ELSE

I added this line to output the values used in the condition
Code: [Select]
PATCH_PRINT ~%SOURCE_FILE%: = %item% - %type% - %amulet% - %ignore% - %flags% - %index%~right above the condition.

Now when doing a COPY_EXISTING of the individual file, it seems to properly move the amulet
Code: [Select]
Copying and patching 1 file ...

CBELEDI1.CRE: = MINHP1 - 1 - 0 - 0 - 40 - 4

CBELEDI1.CRE: = CLCK20 - 32 - 0 - 0 - 108 - 21

CBELEDI1.CRE: Equippable items in inventory: CLCK20.itm! Equipping CLOAK

CBELEDI1.CRE: = WAND07 - 35 - 0 - 0 - 108 - 22

CBELEDI1.CRE: = AMUL21 - 1 - 0 - 0 - 108 - 23

CBELEDI1.CRE: Equippable items in inventory: AMUL21.itm! Equipping AMULET

CBELEDI1.CRE: = SCRL7J - 11 - 0 - 0 - 108 - 24

CBELEDI1.CRE: = SCRL6N - 11 - 0 - 0 - 108 - 25
Copied [CBELEDI1.CRE] to [override/CBELEDI1.CRE]
.. but in the regex copy, this happens...
Code: [Select]
CBDRWW23.CRE: = POTN02 - 9 - 1 - 0 - 108 - 27
Copied [CBDRWW23.CRE] to [override/CBDRWW23.CRE]

CBELEDI1.CRE: = MINHP1 - 1 - 0 - 0 - 40 - 4

CBELEDI1.CRE: = CLCK20 - 32 - 0 - 0 - 108 - 21

CBELEDI1.CRE: Equippable items in inventory: CLCK20.itm! Equipping CLOAK

CBELEDI1.CRE: = WAND07 - 35 - 0 - 0 - 108 - 22

CBELEDI1.CRE: = AMUL21 - 1 - 0 - 0 - 108 - 23

CBELEDI1.CRE: = SCRL7J - 11 - 0 - 0 - 108 - 24

CBELEDI1.CRE: = SCRL6N - 11 - 0 - 0 - 108 - 25
Copied [CBELEDI1.CRE] to [override/CBELEDI1.CRE]

CBELEDI2.CRE: = REGHP1 - 10 - 0 - 0 - 40 - 4

Note that the conditions for both cases are exactly identical, but the outcome seems to differ :o
The unmodified errant CRE, the .tp2 and both DEBUGs attached here :) Sorry for the trouble and dragging you into all this :P
« Last Edit: November 29, 2011, 08:42:12 PM by Lollorian »

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: [231] Confitions not being evaulated in a GLOB REGEX?
« Reply #1 on: November 29, 2011, 03:49:28 PM »
That's because you're never resetting the amulet variable.

This code:
Code: [Select]
SET "%variable%" = 5doesn't work. You need to use
Code: [Select]
SET "variable" = 5or
Code: [Select]
SET variable = 5
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 Lollorian

  • Planewalker
  • *****
  • Posts: 96
Re: [231] Confitions not being evaulated in a GLOB REGEX?
« Reply #2 on: November 29, 2011, 08:41:52 PM »
<insert epic rage face>
Such a simple solution for something I spent over 8 hrs trying to debug! :o

Thanks again for your help mate! :D

 

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)?: