Skip to content

WeiDU question: PATCH_IF

[Deleted User][Deleted User] Posts: 0
edited September 2014 in General Modding
The user and all related content has been deleted.

Comments

  • argent77argent77 Member Posts: 3,478
    edited September 2014
    WeiDU provides the keyword STRING_CONTAINS_REGEXP which probably does what you want. You'll need to specify the search string as a regular expression however. The same is true for REPLACE_TEXTUALLY, you'll need to specify the string to replace as a regular expression.

    Let's take this example:
    OUTER_TEXT_SPRINT oldstring ~Longsword +1~
    ACTION_IF ((~%oldstring%~ STRING_CONTAINS_REGEXP ~ \+1~) == 0) BEGIN
    OUTER_INNER_PATCH_SAVE newstring ~%oldstring%~ BEGIN
    REPLACE_TEXTUALLY ~ \+1~ ~~
    END
    PRINT ~Old string: "%oldstring%"~
    PRINT ~New string: "%newstring%"~
    END ELSE BEGIN
    PRINT ~String does not contain " +1".~
    END
    It searches for " +1" in the given string and removes it when found.
  • [Deleted User][Deleted User] Posts: 0
    edited September 2014
    The user and all related content has been deleted.
  • argent77argent77 Member Posts: 3,478
    Just curious. How do you handle item names such as "Bone Club +2, +3 vs. undead"? There are surely a number of mods that use similar naming schemes for their own items.
  • [Deleted User][Deleted User] Posts: 0
    edited September 2014
    The user and all related content has been deleted.
  • argent77argent77 Member Posts: 3,478
    Or you could simply remove everything after the enchantment factor. For example, REPLACE_TEXTUALLY ~ \+[1-6].*$~ ~~ changes "Bone Club +2, +3 vs. undead" into "Bone Club".
  • The user and all related content has been deleted.
Sign In or Register to comment.