If/elif/else help please!

Hi, I am working on my last episode for a story, and I am trying to create multiple endings bases on the character’s accumulated points. It’s a bit more complicated because these endings are based on two character’s points.
Like if CHAR1 has more points than CHAR2 and so on. I don’t need help with that side of things, but my script looks like this:

if (ED=0 AND LOGAN=0 AND ED=LOGAN) {
goto Ending_Two
}
if (ED<0 AND LOGAN<0 AND ED=LOGAN) {
goto Ending_Three
}
if (ED>0 AND LOGAN>0 AND ED>LOGAN ) {
goto Ending_Four
}

So far I have no issues with the if statements that direct to endings 1-3 (I obviously didn’t include all my if statements). But I am having issues with the if statement for Ending 4. It’s like the script only reads ED>0, and just doesn’t read LOGAN>0
I guess I’m initially asking, is it possible to include AND in an if statement?
Because from what I’m seeing, it’s not.
Please help! I’m having a heck of a time trying to figure this out myself.
~Firefly

I think you want something like this? It checks which character has the highest number (ending 1 and 2) or if they match on 0 (ending 5), a positive (ending 3) or negative (ending 4) number.

if (ED>LOGAN){
goto Ending_One
}
elif (ED<LOGAN){
goto Ending_Two
}
else{
if (ED>0){
goto Ending_Three
}
elif (ED<0){
goto Ending_Four
}
else{
goto Ending_Five
}
}

FEATURE: Compare More Points Per Line
From what I can tell, no it isn’t possible to have “AND” there, but you can create the branches based on multiple points. E.g

if (CHAR1 > CHAR2) {
if (CHAR1 > CHAR3) {

#CHAR1 branch here.

}} if (CHAR2 > CHAR1) {
if (CHAR2 > CHAR3) {

#CHAR2 branch here.

}} if (CHAR3 > CHAR1) {
if (CHAR3 > CHAR2) {

# CHAR3 branch here.

}} if (CHAR1 = CHAR2) {
if (CHAR1 = CHAR3) {

#ALL EQUAL branch here.

}} if (CHAR1 = CHAR2) {
if (CHAR1 < CHAR3) {

#CHAR3 has more than CHAR1 and CHAR1 is equal with CHAR2.

}} And so on…

That’s just an example, but you could include more ifs within the branches if you wanted to.

2 Likes

Ok, thanks everyone

1 Like

Yes this is what I have to do

1 Like

To your wuestion if its possible to use and on conditions.

While such coding does exist ( for gains if I remember right… not sure about points)
There ware several infos that it actually doesnt work properly and should not be used… while some ware saying they use it and it works fine​:woman_shrugging::woman_shrugging::woman_shrugging:

Its like a year back so dunno if there was any progress in this but generaly the one which works 100% righ is using combination of several id/ elif/else instead.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.