Question about conditions and variables

This will probably be stupid, but I want to understand how the engine works. I've noticed that, all other things being equal (as far as I know), the results vary under a wide range of conditions.
Here, a variable is changed, and then changed back:
◆If: CursorScreenX ≥ 805
◆If: CursorScreenY ≥ 580
◆If: CursorScreenX ≤ 1100
◆If: CursorScreenY ≤ 615
◆If: LeftClick ≠ 0
◆If: SmoothCameraEnabler = 1
◆Variable: #0012 SmoothCameraEnabler = 0
◆Wait: 10 frames
:End
◆If: SmoothCameraEnabler = 0
◆Variable: #0012 SmoothCameraEnabler = 1
◆Wait: 10 frames
:End
:End
:End
:End
:End
:End
For some reason, waiting ten frames doesn’t help, but if you remove it and leave it with only one condition, for example, a mouse click, then everything works.
I solved it this way, although visually the difference looks significant, but I don’t understand what the fundamental difference is:
◆If: SmoothCameraEnabler = 0
◆If: CursorScreenX ≥ 805
◆If: CursorScreenY ≥ 580
◆If: CursorScreenX ≤ 1100
◆If: CursorScreenY ≤ 615
◆If: LeftClick ≠ 0
◆Variable: #0012 SmoothCameraEnabler = 1
◆Wait: 10 frames
:End
:End
:End
:End
:End
:End

◆If: SmoothCameraEnabler = 1
◆If: CursorScreenX ≥ 805
◆If: CursorScreenY ≥ 580
◆If: CursorScreenX ≤ 1100
◆If: CursorScreenY ≤ 615
◆If: LeftClick ≠ 0
◆Variable: #0012 SmoothCameraEnabler = 0
◆Wait: 10 frames
:End
:End
:End
:End
:End
:End
This seems very easy, but I don't understand, please explain. The left mouse button is triggered by the way, it is not pressed. And, again, a variable with only one condition, including LMB, works correctly.
I thought until the end that the problem lay in the hidden logic of the conditional branch, but it turned out to be much simpler. I didn't quite understand how exactly the triggered button worked. Apparently, the triggered click is considered to have occurred not based on time or frames, but rather until all the commands that were valid at the time of its activation have been executed. If I'm still confused, please correct me. (btw google-translated)

Original thread: https://forums.rpgmakerweb.com/threads/question-about-conditions-and-variables.183480/