Relationship_variables

So for relationship variables, more so that I can do,
$!{t_relationship} and have it actually work. Would I be able to do something like this:
*set relationship_1 ${t_name}
Would that work, or would the ${} get in the way?

You need to put it like

*set relationship_1 "${t_name}"

then it should work fine.

1 Like

So currently I have:

*label highest_relationship_calc
*set relationship_counter 1
*label relationship_calc_loop
*set relationship_1 "${t_name}"
*set relationship_2 "${l_name}"
*set relationship_3 "${n_name}"
*set relationship_4 ${d_name}"
*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

Just want to make sure I don’t have to change anything in the rest of the loop to account for the changes. Also would something like,

*if (highest_relationship) ="t_name"

work for variables? Never sure if the ${} would get in the way or not, something about it doing so early when I was just a newbie at all this coding stuff.

Also, what’s the command to show the highest_relationship string? Something like,
$!{highest_relationship}
Something like that? Although if that is the correct command, when ever I run it it’s showing as blank, even though I have the relationships different.
Am asking because when ever I run the actual code it shows me the first relationship in the if sequence, even if that is not the highest one.

that won’t work
it needs to be like
*if (highest_relationship) ="${t_name}"
it needs to be in ${} so it converts

What do you mean?

If I remember correctly, there is a way for you to show the current highest relationship.
Right now when I run the code it only shows the first highest relationship block, and I’m trying to figure out why that is, so I would like to check to see if it is showing the relationships correctly or if that is the reason, that it is showing the relationships incorrectly.
Worst comes to worst I can always set it up so there are a bunch of go twos and labels, but would prefer not to do that if possible.

If you run the block the highest relationship should be stored in the highest_relationship

I am trying to find the command that displays the current highest relationship value so I can find out why when I run the code, even when T’s relationship is not the highest, it runs as if T’s were.

Right now I have T at 50 and D at 60 and it’s still running as if T were higher so. Rather frustrating as I don’t know what I am doing wrong.

I am afraid I can’t help with that since I don’t know the Original Block of code.

Fare enough, probably should have posted that a while ago, so my bad.

Currently, I have:

*if (highest_relationship ="${t_name}")
	*goto t_highest

*elseif (highest_relationship ="${d_name}")
	*goto d_highest
*elseif (highest_relationship ="${l_name}")
	*goto l_highest
*elseif (highest_relationship ="${n_name}")
	*goto n_highest

As I said, right now D is the highest at 60, but it’s still running as if T was the highest and I don’t know why. Used to have the *if with the actual relationship flaver text, but changed in hopes it would fix the problem, though it didn’t so. Shrug.
Anyway, I hope that helps you diagnose what’s going on here. If you need more code, please ask.

Okay I figured out the problem, here you are comparing relationship_1, relationship_2, etc.
but as you can see they are declared as characters not integer, hence its giving wrong return.

It needs to be something like this

*label highest_relationship_calc
*set relationship_counter 1
*label relationship_calc_loop
*set relationship_1 t_relationship
*set relationship_name_1 "${t_name}"
*set relationship_2 l_relationship
*set relationship_name_2 "${l_name}"
*set relationship_3 n_relationship
*set relationship_name_3 "${n_name}"
*set relationship_4 d_relationship
*set relationship_name_4 "${d_name}"
*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

Note: I took the liberty of assuming that values of relationships are stored in t_relationship, l_relationship, etc.

So right now, I have:

*set relationship_counter 1
*label relationship_calc_loop
*set relationship_1 t_relationship
*set relationship_name_1 "${t_name}"
*set relationship_2 l_relationship
*set relationship_name_2 "${l_name}"
*set relationship_3 n_relationship
*set relationship_name_3 "${n_name}"
*set relationship_4 d_relationship
*set relationship_name_4 "${d_name}"
*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

Then,

*create t_relationship 50
*create l_relationship 50
*create n_relationship 50
*create d_relationship 60

Then,

*if (highest_relationship ="${t_name}")
	*goto t_highest

*elseif (highest_relationship ="${d_name}")
	*goto d_highest
*elseif (highest_relationship ="${l_name}")
	*goto l_highest
*elseif (highest_relationship ="${n_name}")
	*goto n_highest

I just ran the code and still seems to be running as if T is the highest, so just checking if anything is out of place I missed.
Also, thanks for all the help with this.

Did you call the loop using *gosub after declaring variables?

*title test 5
*author test

*create t_relationship 50
*create l_relationship 50
*create n_relationship 50
*create d_relationship 60
*create t_name "tname"
*create l_name "lname"
*create n_name "nname"
*create d_name "dname"
*create Total_relationships 4
*create Highest_relationship_stat 0
*create highest_relationship " "
*create relationship_counter 1

*create relationship_1 0
*create relationship_name_1 " "
*create relationship_2 0
*create relationship_name_2 " "
*create relationship_3 0
*create relationship_name_3 " "
*create relationship_4 0
*create relationship_name_4 " "

*gosub relationship_calc_loop
*if (highest_relationship = "${t_name}")
    t highest
    *goto t_highest
*elseif (highest_relationship = "${d_name}")
    d highest
    *goto d_highest
*elseif (highest_relationship = "${l_name}")
    l highest
    *goto l_highest
*elseif (highest_relationship = "${n_name}")
    n highest
    *goto n_highest
*else
    No one
    *goto highest

*label t_highest
T End
*ending

*label d_highest
D End
*ending

*label l_highest
L End
*ending

*label n_highest
N End
*ending

*label highest
The End
*ending

*label relationship_calc_loop
*set relationship_1 t_relationship
*set relationship_name_1 "${t_name}"
*set relationship_2 l_relationship
*set relationship_name_2 "${l_name}"
*set relationship_3 n_relationship
*set relationship_name_3 "${n_name}"
*set relationship_4 d_relationship
*set relationship_name_4 "${d_name}"

*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

Above is my test file, and d is the highest and its displaying properly.
So it should work properly in yours as well, make sure you are calling *gosub after you set values.

Output:

Thanks :slight_smile: if I’m not mistaken then I totally forgot that the gossip underlined scene existed. Had a good little chuckle about it afterwards, so thank you for reminding me. Should be fixed now.

You are welcome, :slightly_smiling_face:

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

Seems that I was incorrect, and it’s still not working correctly. I checked over your test file, and implemented it as well as possible. Here is what I have so far:

*label highest_relationship_calc
*set relationship_counter 1
*label relationship_calc_loop
*set relationship_1 0
*set relationship_name_1 "${t_name}"
*set relationship_2 0
*set relationship_name_2 "${l_name}"
*set relationship_3 0
*set relationship_name_3 "${n_name}"
*set relationship_4 0
*set relationship_name_4 "${d_name}"
*gosub highest_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
*return

As well as this

*comment highest_relationship_variables
*create highest_relationship_stat 0
*create highest_relationship ""
*create relationship_counter 1
*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

Unsure if I should keep the, *set relationship_1 as T_relationship" as well since it is already set as “*set relationship_1 0” so.
Granted, I am a little unfamiliar with what each aspect of the highest_calc actually does, soo perhaps that is part of it as well?
Anyway, hope this finds you well, and I hope that you are having a good rest of your day.

What results are you getting when you run it? What results are you expecting?

What is this code looking at? I am not seeing highest_calc_loop anywhere else in the code you provided.