ARC-9/.Stuff for developers/att2bulk.py

23 lines
895 B
Python
Raw Permalink Normal View History

prefix = "eft_grip_ak_*" # Atts with this prefix in lua name will be packed. Uses wildcards ( *_ak_* )
2022-12-03 01:46:35 -05:00
arc = 1 # 0 for ArcCW bulk atts, 1 for ARC9 bulk atts
2022-05-08 01:31:59 -04:00
import glob
import os
if arc:
content = "local ATT = {}\n\n"
else:
content = "local att = {}\n\n"
for attpath in glob.glob(prefix + '.lua'): # process
attlua = open(attpath, 'r')
content = content + "\n/////////////////////////////////////// "+ os.path.basename(attpath)[:-4] + "\n\n\n"
2022-05-08 01:31:59 -04:00
if arc:
content = content + 'ATT = {}\n\n' + attlua.read() + '\n\n\nARC9.LoadAttachment(ATT, "' + os.path.basename(attpath)[:-4] + '")\n\n'
2022-05-08 01:31:59 -04:00
else:
content = content + 'att = {}\n\n' + attlua.read() + '\n\n\nArcCW.LoadAttachmentType(att, "' + os.path.basename(attpath)[:-4] + '")\n\n'
2022-05-08 01:31:59 -04:00
attlua.close()
bulk = open(prefix[:-1] + 'bulk.lua', 'w+')
2022-05-08 01:31:59 -04:00
bulk.write(content)
bulk.close()