import os
import re
a = "E:\\SteamLibrary\\steamapps\\common\\MountBlade Warband\\Modules\\FX_Light&Darkness - Heroes of Calradia\\"
b = ["conversation.txt","item_kinds1.txt","menus.txt","mission_templates.txt","presentations.txt","scene_props.txt","scripts.txt","simple_triggers.txt","tableau_materials.txt","triggers.txt"]
d = a + "variables.txt"
e = open(d,"r",encoding="ansi")
f = e.read()
e.close()
var_line = len(re.findall(r"\n",f))
print(var_line)
start_var = 144115188075855872
end_var = start_var + var_line
h = [0] * (end_var - start_var)
for c in b:
print(c)
d = a + c
e = open(d,"r",encoding="ansi")
f = e.read()
e.close()
j = 0
for i in range(start_var,end_var,1):
g = re.findall(' '+str(i)+' ',f)
h[j] += len(g)
j += 1
l = ""
j = 0
for i in range(start_var,end_var,1):
l = l + str(h[j]) + "\n"
j += 1
e = open(".\\1.txt","w",encoding="utf-8")
e.write(l)
e.close()
|