So, I have a bunch of *if’s involving highest_relationships, but it keeps going to one in particular, even when I alter the relationships in the startup file where that one doesn’t have the highest relationship, and am now confused what’s going on.
The code for the *if’s looks like this:
Right now, it’s defaulting to t_reassure, even when I have t’s relationship at 50 and one of the others at 60. So yeah, I’m a little confused on what’s happening here.
Don’t think I have anything set up that would alter the relationships, as I have the test file jump streight to reassurance, so yeah.
Hope that someone can give me a second opinion?
I’m not overly familiar with choicescript but if it’s anything like other programming languages you need to move your second parentheses ) to the end of the condition statement.
Ok so, knowing how you determine highest_relationship and what its set to would be helpful.
In this case, the parenthesis don’t actually matter, it works either way, at least in IDE, but it does look prettier the way Nocturnal Stillness said.
As written, its asking if the variable highest_relationship has the value “t_relationship” assigned to it. Its not doing anything to look at what values are stored in each _relationship stat. I’m guessing you’d want to have code somewhere checking each relationship value against eachother and saving that to highest_relationship before this if statement.
This a really messy solution (almost certainly a cleaner way to do it) but if you copy paste this right before your if statements (it checks which variable is the highest and sets highest_relationship to that name of that variable) it should work:
If you plan on having multiple relationship checks throughout your book, you probably want some kind of script file text file and just go to that scene/label every time you want to set highest_relationship.
To be fare, I was never particularly good on knowing what most of that does. I get the over-all basicks, but nothing like the rest of the choice script.
Nothing in that code seems to set the actual relationships you are checking for. So that might be the issue? If it doesn’t actually check the highest relationship it would drop out of the *if block which ends up showing the text below it which would be *label t_assure
I tried to set that last one, as it’s in another text file, to track which relationships are highest, and use that.
It’s with the *gosub_scene variable.
Basickly I intended it to track each fluctuation in relationships by using the *gosub_scene variable, then have it use that file to check to see which relationship is currently the highest.
Seemed to work fine when I was checking which relationship was higher than another, so I’m not quite sure what’s going wrong now?
My advice would be to spend some time understanding exactly how that code works. I just looked back and I originally wrote that piece of code for you two years ago. Since then I have seen at least 10 threads where you have encountered issues using it.
As has been suggested above and I suggested the other day, printing out the values of the variables is a great way of seeing what state everything is in at any one time. It also greatly assists in understanding what the code is doing.
The original code was written to take all relationship stats, which are a number and identify which number is the highest. That relationship is then recorded as the highest one
Why does this code set several stat-related variables, never check them, and then loop back and reset them again? Am I missing something? Did you copy some code and then edit it without understanding the functionality?
I think that I am missing something, as ${highest_calc} doesn’t seem to print out the highest relationship, but I can’t think of exactly how to fix that. Frustrated sigh.