I need help with my if elif else

idk why but like when i have more badgirl points i still get the good girl ending?? i checked the points before in case i added @goodgirl +1 in the badgirl choice but it shouldnt be that since i looked through them. can anyone help T.T

Try checking story modifiers. If the points are equal it may default to the first ending? If that’s not the case I’ll try looking in closer at the screenshots, but that’s all I can think of. If points can be equal at any point in time, I’d suggest creating an outcome for that as well. Story modifiers don’t reset every time to save + preview, so they might be equaling out and you don’t notice it. Make sure that’s not the case first. If that’s good, I’ll take another look. If that is the case, set those values to have bad girl be lower than good girl and try loading again

That wouldn’t affect anything :slight_smile:

1 Like

I see you do have one for points being equal. One thing that might be worth trying is moving those outcomes to labels. Sometimes the web previewer gets iffy when it comes to points and gains within if/elif/else statements (I’m not sure why, it’s just something I myself have experienced). I think the issue here may just be with points though. Try manually setting goodgirl, for example, to 1 point and badgirl, for example, to 2 points and see if that does anything. That can be done through the story modifiers button. If that doesn’t work, I’d also check that those are definitely the characters having points added on.

I’ve inputted the code like this into my script, and changed the values each time to test each branch and it works perfectly. Make sure you format your script this way and it should work :slight_smile:

Good Girls Points

Bad Girls Points

Equal Points

The only other thing I can think of is that you have a space after the word elif, which I do not have and mine works fine.

So ensure there is no space after elif, and that there is a space before the >. See if that fixes it for you.

1 Like

If you use the if and elif commands I think you also have to use the else command so just put instead of the second elif the else command without the brackets. I think then you got it cause I don’t see other errors

It doesn’t cause an error with more than one elif :slight_smile:
It works perfectly fine, I’m not having an issue with my script as this isn’t my thread, I’ve tested it in mine to see if I can help her with hers and it functions perfectly.
She would not have to include the else command if all options are covered by elif. But she can use else instead of the BAG GIRL =GOOD GIRL if she pleases, it still works either way as shown below:)

Using else

Ok

Having/not having a space between elif and the first parentheses shouldn’t affect anything. It’s something with the points themselves. My guess would be that with all the replaying, Goodgirl points keep adding on and she doesn’t realize it.

Best remedy would be…
@GOODGIRL =1
@BADGIRL =2

Versus “+” so that coding can be checked. The same lines can be removed once done testing

1 Like

I’m actually pretty sure that she had made a thread previously about this issue and I commented the exact same thing about setting the value before it to test it (using =), but I’m sure she said it didn’t work, so I’m just proposing all avenues at this point :joy:

It could be a completely different person but I vaguely remember another post with the exact same problem (good girl v badgirl points).

(update, yes it was the same OP here: I need help with my coding (if/elif else))

Interesting! I’ve never had this issue in my own script. I have no idea what it could be, then.

Same, it seems that all the suggestions are coming up empty even when theoretically it should be working. I think she originally said after some of the suggestions that it was working in the portal but not on the app, so I wonder whether the points need resetting again in the app, though I think she may have tried this.

OP, have you tried resetting your points and testing the script after with the:

@GOODGIRL =3
@BADGIRL =4

just before your if/else command, to see if it functions in the app? You can reset your points by going onto “Story Modifiers” then “Character Points” to see what the points counter is coming up as, as this will tell you which has more. You can then click on the BADGIRL or GOODGIRL points on this menu, and set them manually on the app to test it.

so to answer (almost) everyones questions i have done the the points thing and i check on the character points after choice to see if it gains points properly and everything seems fine, i also check at the end to see if i have more bad girl points and i do but i still get the good girl ending which is really weird . it works on my pc but then i load up the story on my phone and it doesn’t work ? so weird , and the weirder thing is that in the second chapter i use the EXACT same code and i also use another if else elif with bad girl and good girl points and it seems to be working ?

My guess is that its some discrepancy with your points in your app, theres no other reason for it to not work in the portal and not in the app, I’m sorry I have no other advice :sweat_smile:

Only thing is to reset story progress in app again, and perhaps go through a couple of chapters before the one that’s causing problems, select all bad girl choices and test it again like that.

Have you already published episodes from this story? If not, you’re welcome to send me the link and I can check the points by reading it? Obv this wont work if its published already as I wont be able to see the chapter you’re working on!

You might have an error elsewhere that needs fixing and perhaps that could get your script to work because the simple branching there should work for any chapter. :thinking:
I noticed you’ve got an error to do with overlays, do you know where that error is?

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