Last active
January 22, 2018 00:28
-
-
Save milkey-mouse/74a320017c67d417245f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xml.dom.minidom import parse, parseString | |
fp = r"C:\Program Files (x86)\Steam\SteamApps\common\Besiege\Besiege_Data\SavedMachines\binch.bsg" | |
dom = parse(fp) | |
nummemes = 0 | |
for block in dom.getElementsByTagName("Block"): | |
if block.attributes["id"].value == "59": | |
data = block.getElementsByTagName("Data")[0].getElementsByTagName("Single") | |
for att in data: | |
if att.attributes["key"].value == "bmt-duration": | |
nummemes += 1 | |
delay = 1 | |
step = 0.01 | |
for block in dom.getElementsByTagName("Block"): | |
if block.attributes["id"].value == "59": | |
data = block.getElementsByTagName("Data")[0].getElementsByTagName("Single") | |
for att in data: | |
if att.attributes["key"].value == "bmt-duration": | |
att.childNodes[0].nodeValue = str(delay) | |
delay += step | |
elif att.attributes["key"].value == "bmt-strength": | |
att.childNodes[0].nodeValue = "6" | |
elif att.attributes["key"].value == "bmt-charge": | |
att.childNodes[0].nodeValue = "0" | |
with open(fp, "w") as thing: | |
thing.write(dom.toxml()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment