summaryrefslogtreecommitdiff
path: root/tools/script_extractor.py
diff options
context:
space:
mode:
authorAndrew Martinek <andrewrmartinek@gmail.com>2020-05-09 15:49:35 -0400
committerAndrew Martinek <andrewrmartinek@gmail.com>2020-05-09 15:49:35 -0400
commit29ed945c4adce0b6bc45be3964f95393d8248390 (patch)
treec314fc99467d6c65cc4f46b0848cde3746396517 /tools/script_extractor.py
parente02184fbcd4426fd0774d0dd80268c515d8aadd1 (diff)
changed run_script and updated script extraction tool
Diffstat (limited to 'tools/script_extractor.py')
-rw-r--r--tools/script_extractor.py118
1 files changed, 59 insertions, 59 deletions
diff --git a/tools/script_extractor.py b/tools/script_extractor.py
index 5fcfbac..f043010 100644
--- a/tools/script_extractor.py
+++ b/tools/script_extractor.py
@@ -55,7 +55,7 @@ def extractMovement(game_data, loc, errQuit):
def decodeLine(scriptList, game_data, loc, ignore_broken, locList):
currLine = scriptList[game_data[loc]]
- ret = "\trun_script " + currLine[0] + "\n"
+ ret = "\trun_command " + currLine[0] + "\n"
loc+=1
quit = currLine[2]
for c in currLine[1]:
@@ -108,7 +108,7 @@ def main():
parser = argparse.ArgumentParser(description='Pokemon TCG Script Extractor')
parser.add_argument('--noauto', action='store_true', help='turns off automatic script parsing')
parser.add_argument('--error', action='store_true', help='stops execution if an error occurs')
- parser.add_argument('-m', '--movement', action='store_true', help='interprets bytes as a movement script rather than an OWSequence')
+ parser.add_argument('-m', '--movement', action='store_true', help='interprets bytes as a movement sequence rather than a Script')
parser.add_argument('-r', '--rom', default="baserom.gbc", help='rom file to extract script from')
parser.add_argument('locations', nargs="+", help='locations to extract from. May be local to bank or global.')
args = parser.parse_args()
@@ -150,7 +150,7 @@ def printScript(game_data, loc, auto, ignore_broken, scriptList, \
else:
# TODO this is hacky please don't do this
- printHeader(loc, "OWSequence_")
+ printHeader(loc, "Script_")
loc += 1
print("\tstart_script")
while end == DO_NOT_QUIT:
@@ -175,23 +175,23 @@ def printScript(game_data, loc, auto, ignore_broken, scriptList, \
def createList(): # this is a func just so all this can go at the bottom
# name, arg list, is an ender
return [
- ("OWScript_EndScriptLoop1", "", QUIT_CONTINUE_CODE),
- ("OWScript_CloseAdvancedTextBox", "", DO_NOT_QUIT),
- ("OWScript_PrintTextString", "t", DO_NOT_QUIT),
+ ("ScriptCommand_EndScriptLoop1", "", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_CloseAdvancedTextBox", "", DO_NOT_QUIT),
+ ("ScriptCommand_PrintTextString", "t", DO_NOT_QUIT),
("Func_ccdc", "t", DO_NOT_QUIT),
- ("OWScript_AskQuestionJump", "tj", DO_NOT_QUIT), # more complex behavior too (jumping)
- ("OWScript_StartBattle", "bbb", DO_NOT_QUIT),
- ("OWScript_PrintVariableText", "tt", DO_NOT_QUIT),
+ ("ScriptCommand_AskQuestionJump", "tj", DO_NOT_QUIT), # more complex behavior too (jumping)
+ ("ScriptCommand_StartBattle", "bbb", DO_NOT_QUIT),
+ ("ScriptCommand_PrintVariableText", "tt", DO_NOT_QUIT),
("Func_cda8", "bbbb", DO_NOT_QUIT),
- ("OWScript_PrintTextQuitFully", "t", QUIT_SPECIAL),
+ ("ScriptCommand_PrintTextQuitFully", "t", QUIT_SPECIAL),
("Func_cdcb", "", DO_NOT_QUIT),
- ("OWScript_MoveActiveNPCByDirection", "w", DO_NOT_QUIT),
- ("OWScript_CloseTextBox", "", DO_NOT_QUIT),
- ("OWScript_GiveBoosterPacks", "bbb", DO_NOT_QUIT),
+ ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT),
+ ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT),
+ ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT),
("Func_cf0c", "bj", DO_NOT_QUIT), # more complex behavior too (jumping)
("Func_cf12", "bj", DO_NOT_QUIT),
- ("OWScript_GiveCard", "b", DO_NOT_QUIT),
- ("OWScript_TakeCard", "b", DO_NOT_QUIT),
+ ("ScriptCommand_GiveCard", "b", DO_NOT_QUIT),
+ ("ScriptCommand_TakeCard", "b", DO_NOT_QUIT),
("Func_cf53", "w", DO_NOT_QUIT), # more complex behavior too (jumping)
("Func_cf7b", "", DO_NOT_QUIT),
("Func_cf2d", "bbbb", DO_NOT_QUIT), # more complex behavior too (jumping + ??)
@@ -202,83 +202,83 @@ def createList(): # this is a func just so all this can go at the bottom
("Func_d025", "w", DO_NOT_QUIT), # possibly only jumps, still needs args
("Func_d032", "w", DO_NOT_QUIT), # see above
("Func_d03f", "", DO_NOT_QUIT),
- ("OWScript_Jump", "j", QUIT_JUMP), # jumps to d
- ("OWScript_TryGiveMedalPCPacks", "", DO_NOT_QUIT),
- ("OWScript_SetPlayerDirection", "d", DO_NOT_QUIT),
- ("OWScript_MovePlayer", "db", DO_NOT_QUIT),
- ("OWScript_ShowCardReceivedScreen", "b", DO_NOT_QUIT),
- ("OWScript_SetDialogName", "b", DO_NOT_QUIT),
- ("OWScript_SetNextNPCandOWSequence", "bj", DO_NOT_QUIT),
+ ("ScriptCommand_Jump", "j", QUIT_JUMP), # jumps to d
+ ("ScriptCommand_TryGiveMedalPCPacks", "", DO_NOT_QUIT),
+ ("ScriptCommand_SetPlayerDirection", "d", DO_NOT_QUIT),
+ ("ScriptCommand_MovePlayer", "db", DO_NOT_QUIT),
+ ("ScriptCommand_ShowCardReceivedScreen", "b", DO_NOT_QUIT),
+ ("ScriptCommand_SetDialogName", "b", DO_NOT_QUIT),
+ ("ScriptCommand_SetNextNPCandScript", "bj", DO_NOT_QUIT),
("Func_d095", "bbb", DO_NOT_QUIT),
("Func_d0be", "bb", DO_NOT_QUIT),
- ("OWScript_DoFrames", "i", DO_NOT_QUIT),
+ ("ScriptCommand_DoFrames", "i", DO_NOT_QUIT),
("Func_d0d9", "bbw", DO_NOT_QUIT), # jumps but still needs args
- ("OWScript_JumpIfPlayerCoordMatches", "iij", DO_NOT_QUIT), # jumps but still needs args
- ("OWScript_MoveActiveNPC", "m", DO_NOT_QUIT),
- ("OWScript_GiveOneOfEachTrainerBooster", "", DO_NOT_QUIT),
+ ("ScriptCommand_JumpIfPlayerCoordMatches", "iij", DO_NOT_QUIT), # jumps but still needs args
+ ("ScriptCommand_MoveActiveNPC", "m", DO_NOT_QUIT),
+ ("ScriptCommand_GiveOneOfEachTrainerBooster", "", DO_NOT_QUIT),
("Func_d103", "q", DO_NOT_QUIT),
("Func_d125", "b", DO_NOT_QUIT),
("Func_d135", "b", DO_NOT_QUIT),
("Func_d16b", "b", DO_NOT_QUIT),
("Func_cd4f", "bbb", DO_NOT_QUIT),
("Func_cd94", "q", DO_NOT_QUIT),
- ("OWScript_MoveWramNPC", "m", DO_NOT_QUIT),
+ ("ScriptCommand_MoveWramNPC", "m", DO_NOT_QUIT),
("Func_cdd8", "", DO_NOT_QUIT),
("Func_cdf5", "bb", DO_NOT_QUIT),
("Func_d195", "", DO_NOT_QUIT),
("Func_d1ad", "", DO_NOT_QUIT),
("Func_d1b3", "", DO_NOT_QUIT),
- ("OWScript_QuitScriptFully", "", QUIT_SPECIAL),
+ ("ScriptCommand_QuitScriptFully", "", QUIT_SPECIAL),
("Func_d244", "q", DO_NOT_QUIT),
("Func_d24c", "q", DO_NOT_QUIT),
- ("OWScript_OpenDeckMachine", "b", DO_NOT_QUIT),
+ ("ScriptCommand_OpenDeckMachine", "b", DO_NOT_QUIT),
("Func_d271", "q", DO_NOT_QUIT),
- ("OWScript_EnterMap", "bbood", DO_NOT_QUIT),
- ("OWScript_MoveArbitraryNPC", "bm", DO_NOT_QUIT),
+ ("ScriptCommand_EnterMap", "bbood", DO_NOT_QUIT),
+ ("ScriptCommand_MoveArbitraryNPC", "bm", DO_NOT_QUIT),
("Func_d209", "", DO_NOT_QUIT),
("Func_d38f", "b", DO_NOT_QUIT),
("Func_d396", "b", DO_NOT_QUIT),
("Func_cd76", "", DO_NOT_QUIT),
("Func_d39d", "b", DO_NOT_QUIT),
("Func_d3b9", "", DO_NOT_QUIT),
- ("OWScript_TryGivePCPack", "b", DO_NOT_QUIT),
- ("OWScript_nop", "", DO_NOT_QUIT),
+ ("ScriptCommand_TryGivePCPack", "b", DO_NOT_QUIT),
+ ("ScriptCommand_nop", "", DO_NOT_QUIT),
("Func_d3d4", "q", DO_NOT_QUIT),
("Func_d3e0", "", DO_NOT_QUIT),
("Func_d3fe", "q", DO_NOT_QUIT),
("Func_d408", "b", DO_NOT_QUIT),
("Func_d40f", "q", DO_NOT_QUIT),
- ("OWScript_PlaySFX", "b", DO_NOT_QUIT),
- ("OWScript_PauseSong", "q", DO_NOT_QUIT),
- ("OWScript_ResumeSong", "q", DO_NOT_QUIT),
+ ("ScriptCommand_PlaySFX", "b", DO_NOT_QUIT),
+ ("ScriptCommand_PauseSong", "q", DO_NOT_QUIT),
+ ("ScriptCommand_ResumeSong", "q", DO_NOT_QUIT),
("Func_d41d", "", DO_NOT_QUIT),
- ("OWScript_WaitForSongToFinish", "q", DO_NOT_QUIT),
+ ("ScriptCommand_WaitForSongToFinish", "q", DO_NOT_QUIT),
("Func_d435", "b", DO_NOT_QUIT),
- ("OWScript_AskQuestionJumpDefaultYes", "tj", DO_NOT_QUIT),
+ ("ScriptCommand_AskQuestionJumpDefaultYes", "tj", DO_NOT_QUIT),
("Func_d2f6", "q", DO_NOT_QUIT),
("Func_d317", "", DO_NOT_QUIT),
("Func_d43d", "", DO_NOT_QUIT),
- ("OWScript_EndScriptLoop2", "q", QUIT_CONTINUE_CODE),
- ("OWScript_EndScriptLoop3", "q", QUIT_CONTINUE_CODE),
- ("OWScript_EndScriptLoop4", "q", QUIT_CONTINUE_CODE),
- ("OWScript_EndScriptLoop5", "q", QUIT_CONTINUE_CODE),
- ("OWScript_EndScriptLoop6", "q", QUIT_CONTINUE_CODE),
- ("OWScript_SetFlagValue", "fb", DO_NOT_QUIT),
- ("OWScript_JumpIfFlagZero1", "fj", DO_NOT_QUIT),
- ("OWScript_JumpIfFlagNonzero1", "q", DO_NOT_QUIT),
- ("OWScript_JumpIfFlagEqual", "fbj", DO_NOT_QUIT), # also capable of jumping
- ("OWScript_JumpIfFlagNotEqual", "fbj", DO_NOT_QUIT), # jumps
- ("OWScript_JumpIfFlagNotLessThan", "fbj", DO_NOT_QUIT),
- ("OWScript_JumpIfFlagLessThan", "fbj", DO_NOT_QUIT),
- ("OWScript_MaxOutFlagValue", "f", DO_NOT_QUIT),
- ("OWScript_ZeroOutFlagValue", "f", DO_NOT_QUIT),
- ("OWScript_JumpIfFlagNonzero2", "fj", DO_NOT_QUIT),
- ("OWScript_JumpIfFlagZero2", "fj", DO_NOT_QUIT),
- ("OWScript_IncrementFlagValue", "f", DO_NOT_QUIT),
- ("OWScript_EndScriptLoop7", "q", QUIT_CONTINUE_CODE),
- ("OWScript_EndScriptLoop8", "q", QUIT_CONTINUE_CODE),
- ("OWScript_EndScriptLoop9", "q", QUIT_CONTINUE_CODE),
- ("OWScript_EndScriptLoop10", "q", QUIT_CONTINUE_CODE)
+ ("ScriptCommand_EndScriptLoop2", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_EndScriptLoop3", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_EndScriptLoop4", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_EndScriptLoop5", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_EndScriptLoop6", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_SetFlagValue", "fb", DO_NOT_QUIT),
+ ("ScriptCommand_JumpIfFlagZero1", "fj", DO_NOT_QUIT),
+ ("ScriptCommand_JumpIfFlagNonzero1", "q", DO_NOT_QUIT),
+ ("ScriptCommand_JumpIfFlagEqual", "fbj", DO_NOT_QUIT), # also capable of jumping
+ ("ScriptCommand_JumpIfFlagNotEqual", "fbj", DO_NOT_QUIT), # jumps
+ ("ScriptCommand_JumpIfFlagNotLessThan", "fbj", DO_NOT_QUIT),
+ ("ScriptCommand_JumpIfFlagLessThan", "fbj", DO_NOT_QUIT),
+ ("ScriptCommand_MaxOutFlagValue", "f", DO_NOT_QUIT),
+ ("ScriptCommand_ZeroOutFlagValue", "f", DO_NOT_QUIT),
+ ("ScriptCommand_JumpIfFlagNonzero2", "fj", DO_NOT_QUIT),
+ ("ScriptCommand_JumpIfFlagZero2", "fj", DO_NOT_QUIT),
+ ("ScriptCommand_IncrementFlagValue", "f", DO_NOT_QUIT),
+ ("ScriptCommand_EndScriptLoop7", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_EndScriptLoop8", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_EndScriptLoop9", "q", QUIT_CONTINUE_CODE),
+ ("ScriptCommand_EndScriptLoop10", "q", QUIT_CONTINUE_CODE)
]
main()