Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- file = open("DefaultGameCore.ini", "r")
- file2 = open("DefaultGameCore2.ini", "w")
- # file is the file read from
- # file2 is the file written to. Can change their names above.
- for line in file:
- stringFound = re.search('iEnvironmentDamage=\d+', line)
- #change this line above to change what string is being searched.
- #\d+ means one or more decimals. Be careful not to change all iHP in DGC.ini
- #since it's too commonly used.
- #One way to do it is just to cut and paste out an entire section of a
- #variable you want to change and then apply this script.
- if stringFound:
- myStringOri = stringFound.group(0);
- envDmgNum = re.sub('iEnvironmentDamage=', '', myStringOri)
- envDmgNum = str(int(envDmgNum) * 2)
- #change the *2 above to change how much env damage is increased/decreased.
- myStringNew = re.sub('\d+',envDmgNum,myStringOri)
- line = re.sub('iEnvironmentDamage=\d+', myStringNew, line)
- print (myStringOri)
- file2.write(line)
- else:
- file2.write(line)
- file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement