From 97a1ff5186f6069b57086ab0e6e9512f69fa2bbf Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Wed, 17 Aug 2022 20:17:37 -0400 Subject: [PATCH] Try to read default num as float in script if int doesn't work. --- scripts/stats_schema_achievement_gen/achievements_gen.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) mode change 100644 => 100755 scripts/stats_schema_achievement_gen/achievements_gen.py diff --git a/scripts/stats_schema_achievement_gen/achievements_gen.py b/scripts/stats_schema_achievement_gen/achievements_gen.py old mode 100644 new mode 100755 index 3bfb30c6..5c6a6f42 --- a/scripts/stats_schema_achievement_gen/achievements_gen.py +++ b/scripts/stats_schema_achievement_gen/achievements_gen.py @@ -64,7 +64,10 @@ def generate_stats_achievements(schema, config_directory): for s in stats_out: default_num = 0 if (s['type'] == 'int'): - default_num = int(s['default']) + try: + default_num = int(s['default']) + except ValueError: + default_num = int(float(s['default'])) else: default_num = float(s['default']) output_stats += "{}={}={}\n".format(s['name'], s['type'], default_num)