So, I ran into a bit of an issue, and want a second opinion.
I am running code for calculating highest_relationship calculations, and want to see if the code I am running is correct, because when I playtest my game, it skips the code.
Here is the code:
Also, looking over it again, How would I link it back to my game? Itās going to be used a lot over the course of at least the early game, and the friendship is going to be used a bunch throughout the series, and I donāt think having a bunch of *ifās is going to work. I would need something like 20 or so for each one?
Anyway, if someone could help me a bit with this and the over-all code, would be appreciated. Also, for those who are wondering, next update of the book should be out in the next week and a half or so. Yeah, I know itās a bit off-topic but. Anyway. Hope anyone who is reading this has a good day, and, yeah.
I am not 100% following why you have all the *if and *elseif logic and what the relevance of 50 and 51 are. But my understanding of your code is that you have multiple relationship stats, one of each character (e.g. l_relationship, n_relationship, etc.) and you want to see which of these are higher and add that relationship into the āhighestā variable.
What Iām going to put below is simply for looping through all your character relationships, identifying the highest, and storing that in the āhighest relationshipā variable. I think youāll need additional logic for handling this 50/51 stuff, but Iāll need you to describe exactly what you want to achieve there first. Iāll also need to understand what the difference between the relationship and friendship variables are.
Youāll notice that I switch all your character relationship traits to a different name, this allows us to loop through them easily. By having an underscore and a number, we can take advantage of a useful bit of CS code.
You then call this with *gosub_Highest_relationship_calc whenever you want to update your two variables.
Let me know how the friendship variable and the 50/51 are designed to be used as I can take a look. Also, this wonāt handle ties (and depends on if they can happen and what you want to do with them).
Relationship variables have to do with the relationship with that character, and if it is currently the highest one.
Friendship variables are most of the same, but designed to someone replace relationship variables after a very specific point in the book, notably when the romance takes place and the person you choose gets a roughly 15% give or take relationship increase. Also, since Iām going to make a specific variable for whoever youāre romancing, I wanted to make sure that I could still have a highest and one relationship, a.k.a., friendship.
Also, do you put all of that in the highest_relationship_calc document, or in startup? Some of it looks like stuff you would put in startup, and some in the highest_relationship calc.
1, would you put the *gosub in the highest_calc or the startup, or do you put that when ever you want to see whose relationship is higher, like this:
*gosub highest_calc)```
Though, I am not sure how you would call, say, between if t_relationship or l_relationship is higher though, for example.
Also, currently each relationship has a percentage. I might be wrong here, and if so could someone please explain this to me, but as I look over this, I am not sure how it would mesh, since you have that "relationship_counter, and
*if (relationship_counter =total_relationships)
So yeah, a little confused.
With the code I put above, you would do something like this:
Before you stands 3 people, who do you like most?
*choice
#Sarah
*set relationship_1 + 10
#Steve
*set relationship_2 +10
#Kiran
*set relationship_3 +10
*gosub Highest_relationship_calc
Your current highest relationship is ${Highest_relationship}.
Writing this on my phone, so a bit quick.
Essentially, whenever you modify your underlying relationship stats then you run the gosub to update your highest relationship stat.
Percentage should work fine, the code just looks at which number is higher.
The code will run through all the relationship stats you have and compare them all to see which is highest
Also, would the Gosub go after each choice to alter the relationship, and if not, how would something like that look. I assume something to the tune of,
option 1,
text text text etc,
goto what ever,
option 2,
text text text,
goto what ever,
etc, then the gosub_highest_calc at the end of the choice block, between the final *goto and the next label down?
Also, I assume that you would use the relationship_name_1, relationship_name_2, etc when you needed to send the player to different scenes depending on the relationship stat? Though may change that just because of the existing structure I have already sset-up, if I can. The variables, I mean.
I think you should differentiate the name of these variables, because something like this will throw up an error. Same goes with l_relationship ,n_relationship and d_relationship. Sinnie avoids this by adding ānameā somewhere in the middle.
If you have implicit_control_flow turned on, then you can add *gosub at the end of the choice block like Sinnie had shown. If not, add the *gosub after choices that alter the relationship.
You would have to use Highest_relationship instead to direct the player to different scene.
Also, I think in order for Sinnieās code to work, thereās a bit of restriction on how you name your variables. The number within the variables name is required.