Please help! Switch not working.

I'm making a horse breeding mini game and came across a bug I have no idea how to fix.
The player gets to choose one of two horses - a male or a female - and can put it into one of two stable stalls - stall 1 or stall 2. A number gets assigned to the variable Stable x Horse Type. So if the male horse gets put into stable one, then the Stable 1 Horse Type = 1. If the female horse gets put into stable one the variable would be Stable 1 Horse Type = 2. If the male gets put into Stable 2 then the variable would be Stable 2 Horse Type = 1 (and the female would be =2).

So that all works great.

My issue is that I have a page (page 4 on both events) where if the player tries to breed the horse with itself, a message pops up saying "You cannot breed a horse with itself. Please choose a different horse." And it works fine if the player selects the male horse first to start breeding, but doesn't work if the player selects the female horse first to start breeding.
I have two switches - Horse Breeding M Start and Horse Breeding F Start. I even tried putting the female horse in the first stall (she was originally in the second stall) and it still didn't work. So I have no idea what's going on.

So here are my event pages for the first stall:

stall1-eventpg-1.jpgstall1-eventpg-2.jpgstall1-eventpg-3.jpgstall1-eventpg-4.jpgstall1-eventpg-5.jpgstall1-eventpg-6.jpgstall1-eventpg-7.jpg

And here are my event pages for Stall 2:

stall2-eventpg-1.jpgstall2-eventpg-2.jpgstall2-eventpg-3.jpgstall2-eventpg-4.jpgstall2-eventpg-5.jpgstall2-eventpg-6.jpgstall2-eventpg-7.jpg

If anyone can help me figure out why my Horse Breeding F First switch isn't working, I would really appreciate it. Thank you!
page 2 and 3 are incompleet event that you show, 4 and 5 might be better
in an else brance.

not sure why you check stall 1 and stall 2 as if condition if not
on the condition page itself, which is probably better to check stall 1
if it's female or male, same with stall 2, but I dont know the exact reason
or how it should run ingame for this event. (I might miss understood it).
You have to be very careful trying to use multiple event pages as if/else conditions...they're not designed to work that way, and it's easy to get something mixed up like you did here.

It would be more elegant to outsource this entire process to a common event or write a function for it that you stick in a plugin.

However.

The reason you're failing is because of page 6. That has the conditions of First Breeding Thingy is Female, and horse type is >= 1. That will check as true and execute, so the game won't keep looking down to page 5, with First Breeding Thingy Female and horse type is >= 2.

If you swap those pages, it ought to work.
The programming logic for this could be:

If (variable horse == variable horse){
You can't breed your horse with itself, choose another one
}
else{
Do your things here
}

You may use a conditional branch for this. 😉
Thank you everyone for your replies!! I really appreciate it! This is my first time trying to figure out how to do something that I didn't have a tutorial for. I basically adapted a farming system tutorial to try to create the breeding thing, but obviously I have a lot more fine-tuning to do.
I really appreciate everyone taking their time to help me out. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/please-help-switch-not-working.135369/