#6
Post
by The King » Wed Dec 02, 2020 12:33 am
Okay, so here's how I implimented the code:
label statrankmenu:
$ stats["strength"] += 6 # this is how you access the stat, as a string index (key). the expected value of strength now is 6.
$ stats["stamina"] += 6
$ stats["spd"] += 6
$ stats["toughness"] += 6
$ stats["hp"] += 6
$ stats["iq"] += 6
$ highest = max(stats, key=lambda k: stats[k]) # get the key of the highest value in the dict.
$ paired = [i for i,j in stats.items() if j == highest] # return how many skills are equal the highest one
if len(paired) == 1: # just a single high stat!
jump expression "{}_ending".format(highest)
if len(paired) == 2: # two stats are equal!
jump double_ending
if len(paired) == 3: # three stats are equal!
jump triple_ending
if len(paired) == 4:
jump quadruple_ending
if len(paired) == 5:
jump quintuple_ending
if len(paired) == 6:
jump balanced_ending
label strength_ending:
"Strength is highest."
return
label stamina_ending:
"Stamina is highest."
return
label speed_ending:
"Speed is highest."
return
label intelligence_ending:
"IQ is highest."
return
label toughness_ending:
"You're a real toughie, aren't you?"
return
label health_ending:
"HP is highest."
return
label double_ending:
"You've end with a couple of equal stats..."
return
label triple_ending:
"Three skills are the same!"
return
label quadruple_ending:
"Four skills are the same!"
return
label quintuple_ending:
"Five skills are the same!"
return
label balanced_ending:
"You're very well rounded!"
return
The default stats I placed closer to the top, before the start label, which I wrote as such:
default stats = dict(
iq=1,
strength=1,
toughness=1,
spd=1,
stamina=1,
hp=1,
)
The issue is, that given all of these stats being equal, this should give the balanced ending. However, no matter what I do, no matter which value I raise to the highest, every single time I get the strength ending. Have I done something wrong? Should I keep the stats dictionary right above the stat ranking section, or is there something else wrong with the code I added? Please help me out, thank you.