Jump to content


BUT_ONLY_IF_IT_CHANGES


No replies to this topic

#1 Idobek

    Dust Bunny

  • Modders
  • 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. If we didn't want to copy all the item files to the override, we used to use IF_EVAL, like so:

Quote

BEGIN ~Identify All Items~
COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
  READ_SHORT 0x42 "loretoidentify"
  WRITE_SHORT 0x42 0x0000
  IF_EVAL ("%loretoidentify%" > 0)

With the invention of BUT_ONLY_IF_IT_CHANGES we can don't need to evaluate the current lore value, we can just patch:
BEGIN ~Identify All Items~
COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
   WRITE_SHORT 0x42 0x0000
BUT_ONLY_IF_IT_CHANGES

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 peice 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.
<SimDing0> Did you know G3 has secret forum rules?
<CamDawg> Yep. They're generally of the nature 'don't annoy Idobek.'




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users