Advice for shrinking relationship variables?

I’m trying to find a way to make my relationship variables, in particular my highest_relationship variables less complex.
Right now I’ve got mostly:

*if ((t_relationship >=l_relationship) and (t_relationship >=n_relationship)) and (t_relationship >=d_relationship)

I can do that, I’m just trying to find if there’s a less complex way of doing that. I think there is, but I have no idea of what the code would be, especially because I’m pretty sure it would have to do with the relationship scene file, and I’m not the best at fiddling with that, as uposed to the main story code.
Anyway, I hope that anyone who reads this has a good rest of your weekend and the week that’s coming up.

Can you explain what are those variables t-n-l-d?

I would guess those are each relationship with each character? And you want to find the highest one.

If that’s it, you can put that code in a separate file and call it every time you need to check the relationship, saving it to a new variable.
Something like:

check_rel.txt:

(*create max = 0 in your startup file.)

*comment max rel for t = 1
*comment max rel for l = 2
*comment max rel for n = 3
*comment max rel for d = 4

*temp max_rel = t_relationship

*label check_t
*if max_rel >= l_relationship
  *set max = 1
  *goto check_n
*else
  *set max_rel = l_relationship
  *set max = 2
  *goto check_n


*label check_n
*if max_rel >= n_relationship
  *goto check_d
*else
  *set max_rel = n_relationship
  *set max = 3
  *goto check_d


*label check_d
*if max_rel >= d_relationship
  *return
*else
  *set max = 4
  *return

This way, when you need to check for the max relationship, you can just *gosub_scene check_rel and then the max rel will be set in the variable max which you can use multireplace or *if checks.

Your game file.txt:

*gosub_scene check_rel

@{max This will be shown when the max relationship is "T"| This when "L"|This when "N"| and this when "D"}

Or *if

*gosub_scene check_rel

*if max = 1
  *comment max rel = t
*elseif max = 2
  *comment max rel = l
*elseif max = 3
  *comment max rel = n
*else
  *comment max rel = d

If that wasn’t the problem, sorry, I can do better if you explain more about what you’re trying to do.

2 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.