Pocket Plane Group

Friends and Neighbors => Weimer Republic (WeiDU.org) => WeiDU => Topic started by: Lollorian on November 29, 2011, 05:12:27 AM

Title: [SOLVED] Confitions not being evaulated in a GLOB REGEX?
Post by: Lollorian 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 (http://www.shsforums.net/topic/52508-global-itmcresplare-fixer/page__view__findpost__p__528078) :) Sorry for the trouble and dragging you into all this :P
Title: Re: [231] Confitions not being evaulated in a GLOB REGEX?
Post by: the bigg 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
Title: Re: [231] Confitions not being evaulated in a GLOB REGEX?
Post by: Lollorian 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