Post reply

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:
Subject:
Message icon:

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

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: Grim Squeaker
« on: April 19, 2005, 03:58:47 AM »

Not that I understand all of that code, but might it be an idea to automate it as some kind of INSERT_STORE_ITEM or something.
Posted by: Andyr
« on: April 15, 2005, 07:41:09 PM »

Groovy.
Posted by: CamDawg
« on: April 15, 2005, 07:37:52 PM »

Ah, the sloppy code of my youth.

Code: [Select]
COPY_EXISTING ~scrolls.sto~ ~override~     // The Pen and Parchment Store
  READ_LONG  0x34 "sale_offset"
  READ_LONG  0x38 "sale_num"
  WRITE_LONG 0x38 ("%sale_num%" + 1)
  READ_LONG  0x2C "item_offset"
  READ_LONG  0x4C "drink_offset"
  READ_LONG  0x70 "cure_offset"
  WHILE ("%sale_num%" > 0) BEGIN
    SET "sale_num" = ("%sale_num%" - 1)
    READ_ASCII ("%sale_offset%" + ("%sale_num%" * 0x1C)) "item"
    PATCH_IF (("%item%" STRING_COMPARE_CASE "scrl1t" = 0) OR ("%sale_num%" = 0)) BEGIN
      INSERT_BYTES  ("%sale_offset%" +        ("%sale_num%" * 0x1C)) 0x1c
        WRITE_ASCII ("%sale_offset%" +        ("%sale_num%" * 0x1C)) ~u!scrl03~
        WRITE_LONG  ("%sale_offset%" + 0x10 + ("%sale_num%" * 0x1C)) 1 // identified
        WRITE_LONG  ("%sale_offset%" + 0x14 + ("%sale_num%" * 0x1C)) 5 // quantity
      SET "sale_num" = 0
    END
  END
  PATCH_IF NOT ("%item_offset%" < "%sale_offset%") BEGIN
    WRITE_LONG 0x2C ("%item_offset%" + 0x1C)
  END
  PATCH_IF NOT ("%drink_offset%" < "%sale_offset%") BEGIN
    WRITE_LONG 0x4C ("%drink_offset%" + 0x1C)
  END
  PATCH_IF NOT ("%cure_offset%" < "%sale_offset%") BEGIN
    WRITE_LONG 0x70 ("%cure_offset%" + 0x1C)
  END

This should be a smidge faster, and has the additional failsafe of adding the scroll just in case scrl1t is not found.
Posted by: Andyr
« on: April 15, 2005, 07:29:08 PM »

This code works, for future reference:

Code: [Select]
COPY_EXISTING ~scrolls.sto~ ~override/scrolls.sto~     /* The Pen and Parchment Store */
  READ_LONG 0x34 "sale_offset"
  READ_LONG 0x38 "sale_num"
  READ_LONG 0x2C "item_offset"
  READ_LONG 0x4C "drink_offset"
  READ_LONG 0x70 "cure_offset"
  SET "orig_sale_num" = "%sale_num%"
  SET "wraithform_added" = 0
  SET "wraithform_insert" = 0
  WHILE ("%sale_num%" > 0) BEGIN
    READ_ASCII ("%sale_offset%" +        (("%sale_num%" - 1) * 0x1C)) "item"
    PATCH_IF ((("%item%" STRING_COMPARE_CASE "scrl1Q") = 0) AND ("%wraithform_insert%" = 0)) BEGIN
      SET "wraithform_insert" = "%sale_num%"
    END
    SET "sale_num" = ("%sale_num%" - 1)
  END
  PATCH_IF ("%wraithform_insert%" > 0) BEGIN
    WRITE_LONG 0x38 ("%orig_sale_num%" + 1)
    INSERT_BYTES ("%sale_offset%" + ("%wraithform_insert%" * 0x1C)) 28
      WRITE_ASCII ("%sale_offset%" +        ("%wraithform_insert%" * 0x1C)) ~u!scrl03~
      WRITE_LONG  ("%sale_offset%" + 0x10 + ("%wraithform_insert%" * 0x1C)) 1 // identified
      WRITE_LONG  ("%sale_offset%" + 0x14 + ("%wraithform_insert%" * 0x1C)) 5 // quantity
    PATCH_IF NOT ("%item_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x2C ("%item_offset%" + 0x1C)
    END
    PATCH_IF NOT ("%drink_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x4C ("%drink_offset%" + 0x1C)
    END
    PATCH_IF NOT ("%cure_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x70 ("%cure_offset%" + 0x1C)
    END
  END

NI doesn't show it in the right place in the View tab though looking at the offsets in Edit it is there. Thanks again, Cam! :D
Posted by: CamDawg
« on: April 15, 2005, 07:23:33 PM »

Typo.

Code: [Select]
    READ_ASCII ("%sale_offset%" + 0x04 + (("%sale_num%" - 1) * 0x1C)) "item2"
is no longer necessary, and in

Code: [Select]
    READ_ASCII ("%sale_offset%" +        (("%sale_num%" - 1) * 0x1C)) "item1"
"item1" should be "item".

Posted by: Andyr
« on: April 15, 2005, 06:38:59 PM »

Ok, Sim says using ASCII instead and STRING_COMPARE. He also suggest we don't need to check for the item after. The following code is adding it to the bottom of the .STO file, though. Anyone got any more ideas? :)

Code: [Select]
COPY_EXISTING ~scrolls.sto~ ~override/scrolls.sto~     /* The Pen and Parchment Store */
  READ_LONG 0x34 "sale_offset"
  READ_LONG 0x38 "sale_num"
  READ_LONG 0x2C "item_offset"
  READ_LONG 0x4C "drink_offset"
  READ_LONG 0x70 "cure_offset"
  SET "orig_sale_num" = "%sale_num%"
  SET "wraithform_added" = 0
  SET "wraithform_insert" = 0
  WHILE ("%sale_num%" > 0) BEGIN
    READ_ASCII ("%sale_offset%" +        (("%sale_num%" - 1) * 0x1C)) "item1"
    READ_ASCII ("%sale_offset%" + 0x04 + (("%sale_num%" - 1) * 0x1C)) "item2"
//    PATCH_IF (("%item1%" STRING_COMPARE_CASE "scrl1Q") = 0) AND ("%item2%" STRING_COMPARE_CASE "scrl1T") = 0) AND ("%wraithform_insert%" = 0)) BEGIN
    PATCH_IF ((("%item%" STRING_COMPARE_CASE "scrl1Q") = 0) AND ("%wraithform_insert%" = 0)) BEGIN
// between Vampiric Touch and Ghost Armour
      SET "wraithform_insert" = "%sale_num%"
    END
    SET "sale_num" = ("%sale_num%" - 1)
  END
  PATCH_IF ("%wraithform_insert%" > 0) BEGIN
    WRITE_LONG 0x38 ("%orig_sale_num%" + 1)
    INSERT_BYTES ("%sale_offset%" + ("%wraithform_insert%" * 0x1C)) 28
      WRITE_ASCII ("%sale_offset%" +        ("%wraithform_insert%" * 0x1C)) ~u!scrl03~
      WRITE_LONG  ("%sale_offset%" + 0x10 + ("%wraithform_insert%" * 0x1C)) 1 // identified
      WRITE_LONG  ("%sale_offset%" + 0x14 + ("%wraithform_insert%" * 0x1C)) 5 // quantity
    PATCH_IF NOT ("%item_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x2C ("%item_offset%" + 0x1C)
    END
    PATCH_IF NOT ("%drink_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x4C ("%drink_offset%" + 0x1C)
    END
    PATCH_IF NOT ("%cure_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x70 ("%cure_offset%" + 0x1C)
    END
  END

Note: the commented-out line was my attempt to check for both items to see if that fixed it, but uncommenting it and getting rid of the PATCH_IF in the example above introduces a parse error.

WHILE loops > me. :(
Posted by: Andyr
« on: April 15, 2005, 06:10:43 PM »

I am trying to add Wraithform to a store without using ADD_CRE_ITEM for the next UB so it does not appear on the top of the style. I have borrowed code from Cam from Tutu Tweaks, but need a hand adapting something. This is what I have at the moment:

Code: [Select]
COPY_EXISTING ~scrolls.sto~ ~override/scrolls.sto~     /* The Pen and Parchment Store */
  READ_LONG 0x34 "sale_offset"
  READ_LONG 0x38 "sale_num"
  READ_LONG 0x2C "item_offset"
  READ_LONG 0x4C "drink_offset"
  READ_LONG 0x70 "cure_offset"
  SET "orig_sale_num" = "%sale_num%"
  SET "wraithform_added" = 0
  SET "wraithform_insert" = 0
  WHILE ("%sale_num%" > 0) BEGIN
    READ_LONG ("%sale_offset%" +        (("%sale_num%" - 1) * 0x1C)) "item1"
    READ_LONG ("%sale_offset%" + 0x04 + (("%sale_num%" - 1) * 0x1C)) "item2"
    PATCH_IF (("%item1%" = 0x51314C524353) AND ("%item2%" = 0X51314C524353) AND ("%wraithform_insert%" = 0)) BEGIN // between Vampiric Touch and Ghost Armour
      SET "wraithform_insert" = "%sale_num%"
    END
    SET "sale_num" = ("%sale_num%" - 1)
  END
  PATCH_IF ("%wraithform_insert%" > 0) BEGIN
    WRITE_LONG 0x38 ("%orig_sale_num%" + 1)
    INSERT_BYTES ("%sale_offset%" + ("%wraithform_insert%" * 0x1C)) 28
      WRITE_ASCII ("%sale_offset%" +        ("%wraithform_insert%" * 0x1C)) ~u!scrl03~
      WRITE_LONG  ("%sale_offset%" + 0x10 + ("%wraithform_insert%" * 0x1C)) 1 // identified
      WRITE_LONG  ("%sale_offset%" + 0x14 + ("%wraithform_insert%" * 0x1C)) 5 // quantity
    PATCH_IF NOT ("%item_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x2C ("%item_offset%" + 0x1C)
    END
    PATCH_IF NOT ("%drink_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x4C ("%drink_offset%" + 0x1C)
    END
    PATCH_IF NOT ("%cure_offset%" < "%sale_offset%") BEGIN
      WRITE_LONG 0x70 ("%cure_offset%" + 0x1C)
    END
  END

The problem is in here.

Code: [Select]
    PATCH_IF (("%item1%" = 0x51314C524353) AND ("%item2%" = 0X51314C524353) AND ("%wraithform_insert%" = 0)) BEGIN // between Vampiric Touch and Ghost Armour
Looking at Cam's code, I had assumed this was the hex for the name for the .ITM files I was looking to place it in between. However, WeiDU can't convert this to an integer, and the sequence is longer than what Cam's original code had (0x then 8 characters, not 12 or 10 as I have). So, what I'd like to know is how can I convert item filenames to hex/ASCII/whatever it wants? :) I used NI for the above example, selecting the .ITM name and then "view as hex".