Trouble coding gosub for multiple personality traits

I think you can streamline your code and use less if statements. Check this out:

*label max_trait
*temp trait_1 "adaptable"
*temp trait_2 "aggressive"
*temp trait_3 "benevolent"
*temp trait_4 "charming"
*temp trait_5 "cruel"
*temp trait_6 "deceptive"
*temp trait_7 "diplomatic"
*temp trait_8 "emotional"
*temp trait_9 "honest"
*temp trait_10 "reserved"
*temp trait_11 "stoic"
*temp trait_12 "stubborn"

*temp trait_number 12
*temp dom_trait trait[1]
*temp tie false
*temp counter 2

*label max_trait_foreach
*if ({dom_trait} < {trait[{counter}]})
	*set dom_trait trait[{counter}]
	*set tie false
	*goto max_trait_foreach_continue
*elseif ({dom_trait} = {trait[{counter}]})
	*set tie true
	*goto max_trait_foreach_continue
*label max_trait_foreach_continue
*set counter +1
*if (counter <= trait_number)
	*goto max_trait_foreach
*if (tie)
	*set dom_trait "mixed"
	*return
*return


I’m too late. :joy:

EDIT:
If dom_trait is a global variable in your code change the line: *temp dom_trait trait[1] to *set dom_trait trait[1]. All the rest keep the same.

2 Likes