Author Topic: STRING_EQUAL  (Read 1684 times)

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
STRING_EQUAL
« on: March 27, 2010, 05:06:31 AM »
Actually I am not sure if STRING_EQUAL is causing the problem or if it is due to something else. When I try to run this code I am told that "In state 23, I expected one of these tokens: [2] ~~. Parse error <state 23> at END". What I am attempting to do is detect whether a CRE is wearing an armour, find out what kind of armour it is and then replace it with something else.

Code: [Select]
READ_LONG 0x2b8 "itemslotoffset"
READ_LONG 0x2bc "itemsoffset"
READ_SHORT ("%itemslotoffset%" + "2") "armour"
PATCH_IF ("%race%" = "1" AND "%armour%" != "63535") BEGIN // Human Armour Correction
  READ_ASCII ("%itemsoffset%" + ("%armour%" * "14")) "armourfile"
  PATCH_IF ("%armourfile%" STRING_EQUAL "LEAT01") BEGIN
    REPLACE_CRE_ITEM ~leat01a~ #0 #0 #0 ~armor~
  END
END

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: STRING_EQUAL
« Reply #1 on: March 27, 2010, 07:51:24 AM »
You're missing the flags bit in the REPLACE_CRE_ITEM.
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 Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: STRING_EQUAL
« Reply #2 on: March 27, 2010, 01:05:34 PM »
Yes, that was one of two errors, the other being 63535 instead of 65535.

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: STRING_EQUAL
« Reply #3 on: March 27, 2010, 06:17:03 PM »
I am getting some odd results from REPLACE_CRE_ITEM. I have seen it replace all of the items in the code but it only does so if the armor is the first on the list of items.

Code: [Select]
READ_LONG 0x2b8 "itemslotoffset"
READ_LONG 0x2bc "itemsoffset"
READ_SHORT ("%itemslotoffset%" + "2") "armour"
PATCH_IF ("%race%" = "1" AND "%armour%" != "65535") BEGIN // Human Armour Correction
  READ_ASCII ("%itemsoffset%" + ("%armour%" * "14")) "armourfile"
  PATCH_IF ("%armourfile%" STRING_EQUAL_CASE "leat01") BEGIN
    REPLACE_CRE_ITEM ~leat01a~ #0 #0 #0 ~none~ ~armor~
  END
  PATCH_IF ("%armourfile%" STRING_EQUAL_CASE "leat04") BEGIN
    REPLACE_CRE_ITEM ~leat04a~ #0 #0 #0 ~none~ ~armor~
  END    
  PATCH_IF ("%armourfile%" STRING_EQUAL_CASE "chan01") BEGIN
    REPLACE_CRE_ITEM ~chan01a~ #0 #0 #0 ~none~ ~armor~
  END
  PATCH_IF ("%armourfile%" STRING_EQUAL_CASE "chan04") BEGIN
    REPLACE_CRE_ITEM ~chan04a~ #0 #0 #0 ~none~ ~armor~
  END
  PATCH_IF ("%armourfile%" STRING_EQUAL_CASE "plat01") BEGIN
    REPLACE_CRE_ITEM ~plat01a~ #0 #0 #0 ~none~ ~armor~
  END
  PATCH_IF ("%armourfile%" STRING_EQUAL_CASE "plat04") BEGIN
    REPLACE_CRE_ITEM ~plat04a~ #0 #0 #0 ~none~ ~armor~
  END
END

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 298
  • Gender: Male
Re: STRING_EQUAL
« Reply #4 on: March 27, 2010, 06:34:22 PM »
Code: [Select]
  READ_ASCII ("%itemsoffset%" + ("%armour%" * "14")) "armourfile"Each item takes up 0x14 = 20 bytes of space.

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: STRING_EQUAL
« Reply #5 on: March 27, 2010, 06:51:28 PM »
Ah, of course. Thanks. :)

 

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