scripts.h vs scripts.lst
Closed this issue · 2 comments
So I screwed up scripting with cleaning up unused Kaga's scripts. Reverted now, but apparently I still don't understand how it works. There are multiple differences between scripts.h
and scripts.lst
. Does only the overall number of entries matter?
--- SCRIPTS.H 2019-12-03 11:44:16.774207282 +0700
+++ SCRIPTS.LST 2019-12-03 11:45:03.712355811 +0700
@@ -277,6 +277,11 @@
MBASE12
MBASE34
MBCLOSE
+MODSHIT
+NCR1
+NCR2
+NCR3
+NCR4
NCREX
STABLE
V13_ORIG
@@ -328,6 +333,7 @@
ATDEATH
SIFAKHLO
SCLENNY
+SIPTBOX
NCPROSTI
NCSLAVE
NCRICO
@@ -383,8 +389,12 @@
VCCITPRS
VCGENFAM
VCAMAID
+GCRDESK
GCRGHOUL
+GCRGLOW
+GCRGUARD
GCROBOT
+GCFOLK
GCWORSHP
GCHAROLD
GCPACOFF
@@ -523,6 +533,7 @@
OCMATT
RCFITRAT
REDMENT
+VAULT13
OCSANDY
ZITMPBOX
OCTHEARN
@@ -537,6 +548,7 @@
MIBALBOX
SILOCKER
CHEATER
+VAULT15
BCPHIL
BCBILL
MCBUTCHR
@@ -567,7 +579,7 @@
MCRAT
ZISUNSPT
MCBESS
-MCJKYBOX
+MIJKYBOX
ZCCRPDEL
BCGENGRD
MCSLAG
@@ -594,7 +606,7 @@
HCSUPER
HCZAIUS
HCJACOB
-HICHEMS
+HCHEMS
MIGSTPRP
BSSDOR1
BSCOMP1
@@ -624,7 +636,7 @@
BSCOMP5
BSPOWER
BSFIELD
-PEASAN
+MCPEASAN
BSEMTR
OSV13DR
OSDOOR1
@@ -845,6 +857,7 @@
QCGRANIT
QCFRANK
GECKJUNK
+GECKTUNL
SSFRGDOR
SSGUNDOR
SSFLXDOR
@@ -852,6 +865,7 @@
SSEMIENT
QCCURLNG
SSSIGN
+MCMOLRAT
QCPRSSEC
QCMURRAY
SSCRPDOR
@@ -979,7 +993,7 @@
HIBH1BOX
FCJUAVKI
HIMANHOL
-FCELRONB
+SFELRONB
HILADDER
WIPNCHBG
WIBAYDOR
@@ -1033,7 +1047,7 @@
VCSLAV2
VCBARCIT
NIBASDOR
-NIFIGHTR
+NCFIGHTR
RIVLTDOR
CCXARN
CCRAUL
@@ -1088,8 +1102,8 @@
FCTNKGMR
FCTNKBAR
FCTNKMER
-FCTGUNTB
-FCTMERTB
+FITGUNTB
+FITMERTB
FSPEMTR1
FSPEMTR2
FSPEMTR3
@@ -1131,7 +1145,7 @@
VTALOMRK
CAVE7
NIDERMAL
-SCRIPTS_NCELDDOG
+NCELDDOG
RCRATRAY
HCHUSWIF
FCLOGRD
@@ -1153,7 +1167,7 @@
VITERM
RCMOTGNG
CCCHEAT
-FCTNKRDR
+FSTNKRDR
SCPEAON
DIREBBOK
HCSCORP
@@ -1200,6 +1214,7 @@
NIWRT1LK
NIOWRILK
NIWRT2LK
+NIMOR1LK
NIMYGDLK
NIMOR2LK
NIMYRNLK
The script number in scripts.h must be the line number in scripts.lst
Removing scripts in the middle of the list is a very bad idea because it'll cause game internal script numbers to shift (remember, it goes by line number in the .lst) and thus, all scripts after your change will be wrong.
So when you were removing the ECKagax stuff here, all scripts following were shifted up in their number and are wrong now (you can check it with opening any map in the mapper and look at their assigned script. VIMedCom, etc. in Vault City will not be found anymore where it was before).
If you want to get rid of scripts in the middle of the list, it is best to replace them with "unused" or whatever. As far as I am aware, it doesn't matter as long as the other scripts remain where they are.
So when you were removing the ECKagax stuff here, all scripts following were shifted up in their number and are wrong now.
Yes, I got that now. It's reversed.
This spaghetti is killing me, couldn't they just use symbolic identifiers and forget about these stupid defines? I went nuclear:
#!/usr/bin/env python3
# coding: utf-8
import sys
import re
scripts_h = sys.argv[1]
scripts_lst = sys.argv[2]
h = {}
lst = {}
with open(scripts_h) as f:
for line in f:
match = re.match(r"^#define\s+SCRIPT_(\w+)\s+\((\d+)\)\s+.*", line)
if match:
h[match[1]] = int(match[2])
with open(scripts_lst) as f:
linenum = 0
for line in f:
linenum += 1
scr = line.split('.', maxsplit=1)[0].upper()
lst[linenum] = scr
for scriptname in h:
script_num = h[scriptname]
if lst[script_num] != scriptname:
print("Error: SCRIPT_{} in scripts.h is {}, but line {} in scripts.lst is {}".format(scriptname, script_num, script_num, lst[script_num]))
Result is,
Error: SCRIPT_MCJKYBOX in scripts.h is 582, but line 582 in scripts.lst is MIJKYBOX
Error: SCRIPT_HICHEMS in scripts.h is 609, but line 609 in scripts.lst is HCHEMS
Error: SCRIPT_PEASAN in scripts.h is 639, but line 639 in scripts.lst is MCPEASAN
Error: SCRIPT_FCELRONB in scripts.h is 996, but line 996 in scripts.lst is SFELRONB
Error: SCRIPT_NIFIGHTR in scripts.h is 1050, but line 1050 in scripts.lst is NCFIGHTR
Error: SCRIPT_FCTGUNTB in scripts.h is 1105, but line 1105 in scripts.lst is FITGUNTB
Error: SCRIPT_FCTMERTB in scripts.h is 1106, but line 1106 in scripts.lst is FITMERTB
Error: SCRIPT_FCTNKRDR in scripts.h is 1170, but line 1170 in scripts.lst is FSTNKRDR
Nothing serious, it seems.