Shouldn't these events alternate the hidden cursor variable each time the button is clicked?
Attachment 9372
It changes from 1 to 0 the first time I click it. But it never changes back to 1.
Thanks.
Printable View
Shouldn't these events alternate the hidden cursor variable each time the button is clicked?
Attachment 9372
It changes from 1 to 0 the first time I click it. But it never changes back to 1.
Thanks.
No, it's like I explained before - MMF2 processes events one line at a time, so it executes the actions on the first line before it tests the conditions on the second line.
MMF2 starts with the first line:
Hide_Cursor = 0, and the player has just clicked, so the action is triggered - that means Hide_Cursor is set to 1.
MMF2 then moves on to the next line:
Hide_Cursor = 1, because we just set it to 1 in the last event, so the action is triggered - that means Hide_Cursor is set to 0 again.
Instead, you could toggle a flag, or you could switch a value back and forth between 0 and 1 like this:
+ Player clicks
-> Set Hide_Cursor to Abs(Hide_Cursor - 1)
I explained this problem HERE and also best solutions / workarounds. Francois has a very clever solution.
Yeah I always used the toggle flag method until I found that solution on the boards where you can just subtract 1 from the value to get either 0 or 1.
I think flyoffacliff's issue is that they are thinking the two red events are only triggering 1 event per loop instead of both in order. It might be the red text throwing them off, but the red text merely indicates those events are triggered first/immediately. It doesn't mean they can't be all triggered in one loop. It's the same as just having two events like:
Value = 0
- Set value to 1
Value = 1
- Set value to 0
The value will always be 0 at runtime.
Oh sorry, I did not really understand when you explained it before. I did not ask for clarification because I did not want to sound like an idiot and/or waste your time. I understand why it was not working now, but as for solutions...
Option 1 - Toggle A Flag: That would work, but I need it to be global so it can be read on another frame, and flags are not global. So I would have to toggle the flag, and then set the flag to a global value. This would work, but its kind of a hassle for something so simple.
Option 2 - Use "Set Hide_Cursor to Abs(Hide_Cursor - 1)": This seems to work, but I am not sure how. What does "Abs" mean? And the -1? I changed it to Abs(Hide_Cursor-5), and then it back and forth between 1 and 4.
Thanks a lot. :)
Thanks. But I don't really understand that, and it seems more complicated than MuddyHole's suggestions. But I will save it for future reference. Thanks. :)
Okay, thanks. I understand now. :)
Abs() means "Absolute Value" which just means the value is always positive... So if you did Abs(-5) then the returned number would be 5.
So with "Abs(Hide_Cursor - 1)" if Hide_Cursor is 0, then Abs(0-1) would return be Abs(-1) which returns 1. If you then have Hide_Cursor as 1, then Abs(1-1) would return 0.
...Although Francois's method (1-Hide_Cursor) does exactly the same thing and is a bit simpler (don't know what I was thinking really XD)