Jump to content

Photo

BUT_ONLY_IF_IT_CHANGES


No replies to this topic

#1 Idobek

Idobek

    Dust Bunny

  • Retired Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 12 April 2004 - 01:23 PM

Let's say we want to remove the 'lore to identify' value from all items so that we never have to have them identified.
BEGIN ~Identify All Items~
COPY_EXISTING_REGEXP GLOB ~.+\.itm~ ~override~
  WRITE_SHORT 0x42 0x0000
This will modify all item files in the game to set the 'lore to identify' value to 0. However, it will copy (and backup) every item file, including the ones that already have 0 'lore to identify'.

By using BUT_ONLY_IF_IT_CHANGES, only the files that actually change will be copied.
BEGIN ~Identify All Items~
COPY_EXISTING_REGEXP GLOB ~.+\.itm~ ~override~
  WRITE_SHORT 0x42 0x0000
  BUT_ONLY_IF_IT_CHANGES
To save space, you can use BUT_ONLY instead of BUT_ONLY_IF_IT_CHANGES for the same effect.


Note: BUT_ONLY_IF_IT_CHANGES will trip over the iplot0xx items if you use C_E_R to copy all the items. I have added this piece of code to the top of my tp2 to deal with this issue.
ALWAYS
ACTION_IF NOT FILE_EXISTS ~override/iplot01k.itm~
  THEN BEGIN
    COPY ~IKTest/blank.itm~ ~override/iplot01k.itm~
  END
ACTION_IF NOT FILE_EXISTS ~override/iplot04g.itm~
  THEN BEGIN
    COPY ~IKTest/blank.itm~ ~override/iplot04g.itm~
  END
ACTION_IF NOT FILE_EXISTS ~override/iplot04h.itm~
  THEN BEGIN
   COPY ~IKTest/blank.itm~ ~override/iplot04h.itm~
  END
ACTION_IF NOT FILE_EXISTS ~override/iplot04i.itm~
  THEN BEGIN
    COPY ~IKTest/blank.itm~ ~override/iplot04i.itm~
  END
END
I do it like this because then I don't have to remember copy the iplot0xx items everytime I use C_E_R on items.

Edited by Mike1072, 15 March 2015 - 04:01 PM.
modernized and removed references to IF_EVAL

Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users