Relationship underline counter

So, I seem to be running into an issue where the the relationship counter will mess with the highest_relationship calculations. Example, if I have it set to 1, I tend to wind up with pretty much all of my highest_relationship calculations winding up with relationship 1. Or at least that’s what it goes to in the game when I run it. I don’t know how to fix this. Would anyone know how to do that?
Currently, I have my code in startup as:

*create relationship_counter 1
*create highest_relationship ""
*create highest_relationship_stat 0
*create relationship_name_1 "t_relationship"
*create relationship_1 0
*create relationship_name_2 "l_relationship"
*create relationship_2 0
*create relationship_name_3 "n_relationship"
*create relationship_3 0
*create relationship_name_4 "d_relationship"
*create relationship_4 0
*create total_relationships 4

If I just set the relationship counter to 0, it just doesn’t seem to see the highest_relationship variables at all. Anyway, hope this helps, and to all who read this, hope you have a good rest of your day and week over-all.

I’m not sure I understand the problem, can you give us more detail?

Yes I don’t understand either, how exactly is relationship_counter interfering with highest_relationship_stat?

So, when ever I would try to do highest_relationship when I had the relationship counter set to 1, it would more often than not just default to the first relationship for everything, even if that one was not the highest. When I set it to 2, it would default to the second, and when I set it to 4, it would default to the forth. Trying to get it to default to the highest, not the number of the relationship that the relationship counter is set to.

Can you show your implementation of this logic?

You only showed us your variable declarations.

Could you give me an example of what you are asking? Just so I know what to show you.

What logic are you using for highest relationship assignment?

*label highest_relationship_calc
*temp relationship_counter 1
*label relationship_calc_loop
*if Relationship_counter <= Total_relationships
*if rel[Relationship_counter] > Highest_relationship_stat
	*set Highest_relationship_stat rel[Relationship_counter]
	*set highest_rel rel_name[Relationship_counter]
	*set Relationship_counter + 1
	*goto Relationship_calc_loop
*return

Are you using this?

Right now, I have:
Startup:

*create relationship_counter 1
*create highest_relationship ""
*create highest_relationship_stat 0
*create relationship_name_1 "t_relationship"
*create relationship_1 0
*create relationship_name_2 "l_relationship"
*create relationship_2 0
*create relationship_name_3 "n_relationship"
*create relationship_3 0
*create relationship_name_4 "d_relationship"
*create relationship_4 0
*create total_relationships 4

Highest_calc:

*label highest_relationship_calc
*set relationship_counter 1
*label relationship_calc_loop
*set relationship_1 t_relationship
*set relationship_2 l_relationship
*set relationship_3 n_relationship
*set relationship_4 d_relationship
*if Relationship_counter <= Total_relationships
	*if relationship[Relationship_counter] > Highest_relationship_stat
		*set Highest_relationship_stat relationship[Relationship_counter]
		*set highest_relationship relationship_name[Relationship_counter]
		*set Relationship_counter + 1
		*goto relationship_calc_loop
*return

It’s the indents in the loop of the calculation. The lines:

*set Relationship_counter + 1
*goto relationship_calc_loop

Are only being called IF the relationship you’re checking is higher than the current one. Which means that if the current highest stat is 5 and your first loop compares a 3 against the 5 in the *if statement, then that *if statement doesn’t fire and it doesn’t set the relationship_counter + 1 or go to the start of the loop. Instead it just hits the *return and the code stops - thus you don’t change the highest calculation as it never gets to the next 3 relationship stats to check them.

Those two lines need to be unindented to sit with the first *if statement, like this:

*label highest_relationship_calc
*set relationship_counter 1
*label relationship_calc_loop
*if Relationship_counter <= Total_relationships
    *if relationship[Relationship_counter] > Highest_relationship_stat
        *set Highest_relationship_stat relationship[Relationship_counter]
        *set highest_relationship relationship_name[Relationship_counter]
    *set Relationship_counter + 1
    *goto relationship_calc_loop

I use 4 spaces on my indents, noticed you use tabs - so you might want to re-do those.

3 Likes

That seems to have fixed it. Thanks. Tried changing the tabs, but somehow ended up breaking firefox, but seems to be fixed now. For future reference, what is the string that lets you just input the highest_relationship? Something like

$!{highest_relationship}

Think it was something like that, but when I ran it the game skipped over it. Was using it to try and figure out if what I did worked or not. Anyway, thanks for all the help with this. I hope that you all have a good rest of your day today.

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