Profile image

Using regular expressions to change multiple instances of part properties

109k WalrusAircraft  7.9 years ago

Hi there,

Thought I'd share a little trick that has helped me out when modifying parts. If you use Notepad++ text editor, there is an option to use regular expressions on Find and Replace. If you do this, you can save a serious amount of time, by changing all property values (such as massScale) at once. This is how I got my very large airships to weight less. Think about the time you will save.

Here is an example of how I use it:

Find what: massScale="[-+]?[0-9]*.?[0-9]+
Replace with: massScale="0.07

You can change the regular expression to change anything you want. Note that I intentionally left the last quote off to make this one work.

Why use this? Well if you are scaling up a creation and it weights too much, you can reduce the overall weight with this simple trick.

How should I use it? If you use the HellFire's fine tuner tool, I would scale a creation (even just 0.1%) to get the values in the XML. All the parts will have a massScale attribute. I would then use the regular expression to make the change.

Screenshot Example

  • Log in to leave a comment
  • Profile image
    725 IguasOs

    @WalrusAircraft Oh, ok thanks for the reply, :)

    7.7 years ago
  • Profile image

    massScale does normally appear in the XML file, but you can manually add it if you can edit the files. That said, massScale does appear if you use the fine tuner tool to scale the entire craft. @IguasOs

    7.7 years ago
  • Profile image
    725 IguasOs

    Hey Walrus, i just post a comment to know where is the massScale, is it in the config of the aircraft ? cause i can't find it, thanks you :)
    Edit: I can fint it, but only on some planes...

    7.7 years ago
  • Profile image

    Yes, that is absolutely correct - @Tully2001

    7.8 years ago
  • Profile image
    34.1k AgDynamics

    I was just wondering if there was a way to do this, thanks!

    7.9 years ago
  • Profile image
    6,368 KDS

    Yea, it just fits my build style better then. I work on it as I go. @WalrusAircraft

    7.9 years ago
  • Profile image

    @KDS - Doesn't that just change one part at a time? This changes the attributes for thousands of parts (if you have that many) at one time.

    7.9 years ago
  • Profile image
    6,368 KDS

    Or you know... Use overload and it's 3 times simpler :P

    7.9 years ago