From f55096b8cc826dcaed1f44f5c9de7af35bd4ec10 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 17 Mar 2021 06:26:06 +0100 Subject: [PATCH] use python str formatting for player variable names --- Mystery.py | 12 +++--------- playerSettings.yaml | 7 +++---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Mystery.py b/Mystery.py index 5d673ae5..b88524cf 100644 --- a/Mystery.py +++ b/Mystery.py @@ -216,16 +216,10 @@ def main(args=None, callback=ERmain): erargs.name[player] = f"Player{player}" elif not erargs.name[player]: # if name was not specified, generate it from filename erargs.name[player] = os.path.splitext(os.path.split(path)[-1])[0] - new_name = [] name_counter[erargs.name[player]] += 1 - for name in erargs.name[player].split("%%"): - if "%number%" in name: - name = name.replace("%number%", str(name_counter[erargs.name[player]])) - if "%player%" in name: - name = name.replace("%player%", str(player)) - new_name.append(name) - erargs.name[player] = handle_name("%".join(new_name)) - logging.info(erargs.name[player]) + erargs.name[player]= handle_name(erargs.name[player].format(number=name_counter[erargs.name[player]], + player=player)) + erargs.names = ",".join(erargs.name[i] for i in range(1, args.multi + 1)) del (erargs.name) if args.yaml_output: diff --git a/playerSettings.yaml b/playerSettings.yaml index 6b8a4453..caf3a08b 100644 --- a/playerSettings.yaml +++ b/playerSettings.yaml @@ -18,10 +18,9 @@ # http://www.yamllint.com/ description: Template Name # Used to describe your yaml. Useful if you have multiple files -name: YourName%number% # Your name in-game. Spaces will be replaced with underscores and there is a 16 character limit -#%player% will be replaced with actual player number. -#%number% will be replaced with the counter value of the name. -#%% will become % after all of the above processing is complete on the name. +name: YourName{number} # Your name in-game. Spaces will be replaced with underscores and there is a 16 character limit +#{player} will be replaced with the player's slot number. +#{number} will be replaced with the counter value of the name. ### Logic Section ### # Warning: overworld_glitches is not available and minor_glitches is only partially implemented on the door-rando version glitches_required: # Determine the logic required to complete the seed