Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing ESC opens the ingame menu instead of closing the current gui #224

Closed
ScribbleTAS opened this issue Dec 19, 2024 · 1 comment · Fixed by #228
Closed

Pressing ESC opens the ingame menu instead of closing the current gui #224

ScribbleTAS opened this issue Dec 19, 2024 · 1 comment · Fixed by #228
Assignees
Labels
Gui Issue relates to guis TASFile Issue relates to the playback file used to store inputs
Milestone

Comments

@ScribbleTAS
Copy link
Member

ScribbleTAS commented Dec 19, 2024

acatthatcanparkourreallywell9900 brought to my attention,
that trying to close a chest via ESC in tickrate 1 would fail sometimes,
if the press was really short and also provided this video (thanks for that!):

https://youtu.be/T2SwdHS4jGM

After further testing I found that it is reproducible with the following inputs:

0|||null;null
1|||-232.35078;23.550083		
2||;0,-56,-32|-87.000725;31.050087
3||;0,-56,-32|-87.000725;31.050087
4||;0,-56,-32|-87.000725;31.050087
5||;0,-56,-32|-87.000725;31.050087
6|ESC;|;0,-56,-32|-87.000725;31.050087
	1|;||
7||;0,-56,-32|-87.000725;31.050087
8||;0,-56,-32|-87.000725;31.050087
9||;0,-56,-32|-87.000725;31.050087
10|ESC;|;0,-56,-32|-87.000725;31.050087
	1|;||
11||;0,-56,-32|-87.000725;31.050087
12||;0,-56,-32|-87.000725;31.050087

There is only a single frame, where ESC was pressed, and the Gui would not close after the second press.

Now after changing the inputs to this:

0|||null;null
1|||-232.35078;23.550083		
2||;0,-56,-32|-87.000725;31.050087
3||;0,-56,-32|-87.000725;31.050087
4||;0,-56,-32|-87.000725;31.050087
5||;0,-56,-32|-87.000725;31.050087
6|ESC;|;0,-56,-32|-87.000725;31.050087
	1|;||
+7|ESC|;0,-56,-32|-87.000725;31.050087
8||;0,-56,-32|-87.000725;31.050087
9||;0,-56,-32|-87.000725;31.050087
10|ESC;|;0,-56,-32|-87.000725;31.050087
	1|;||
11||;0,-56,-32|-87.000725;31.050087
12||;0,-56,-32|-87.000725;31.050087

It now works which is to be expected.
However, I also found out that this also works:

0|||null;null
1|||-232.35078;23.550083		
2||;0,-56,-32|-87.000725;31.050087
3||;0,-56,-32|-87.000725;31.050087
4||;0,-56,-32|-87.000725;31.050087
5||;0,-56,-32|-87.000725;31.050087
6|ESC;|;0,-56,-32|-87.000725;31.050087
+	1|||
7||;0,-56,-32|-87.000725;31.050087
8||;0,-56,-32|-87.000725;31.050087
9||;0,-56,-32|-87.000725;31.050087
10|ESC;|;0,-56,-32|-87.000725;31.050087
	1|;||
11||;0,-56,-32|-87.000725;31.050087
12||;0,-56,-32|-87.000725;31.050087

I have only removed a semicolon here...

So it seems that guis can't handle empty input sections which is interesting...

@ScribbleTAS ScribbleTAS added Bug Something isn't working Gui Issue relates to guis TASFile Issue relates to the playback file used to store inputs labels Dec 19, 2024
@ScribbleTAS ScribbleTAS added this to the Beta1.0 milestone Dec 19, 2024
@ScribbleTAS ScribbleTAS self-assigned this Dec 19, 2024
@github-project-automation github-project-automation bot moved this to Todo in TASmod Dec 19, 2024
@ScribbleTAS ScribbleTAS changed the title Pressing a button in a single frame is not recognised in Gui-Screens Gui-Screens can't record subticks Dec 25, 2024
@ScribbleTAS ScribbleTAS changed the title Gui-Screens can't record subticks Pressing a button in a single frame is not recognised in Gui-Screens Dec 25, 2024
@ScribbleTAS ScribbleTAS removed the Bug Something isn't working label Jan 8, 2025
@ScribbleTAS ScribbleTAS changed the title Pressing a button in a single frame is not recognised in Gui-Screens Pressing ESC runs twice Mar 30, 2025
@ScribbleTAS ScribbleTAS changed the title Pressing ESC runs twice Pressing ESC to close a gui screen opens the ingame menu Mar 30, 2025
@ScribbleTAS ScribbleTAS changed the title Pressing ESC to close a gui screen opens the ingame menu Pressing ESC opens the ingame menu instead of closing the current gui Mar 30, 2025
@ScribbleTAS
Copy link
Member Author

Ok, this bug is pretty interesting and a good lesson as to why a quick fix is probably not a good idea...
Back in PR #225 I fixed an issue where I subticks were not recorded... So I wrote:

What a weird oversight
[...]
Reason was that nextTickKeyboard (and Mouse) is called twice when a GuiScreen is open.

Thanks past me, but instead of applying a quick fix, you should've looked at this a little more carefully.

Because I didn't answer the question: "Why is it even being called twice?"

The reason is in some rare occasions, the gui input code and the movement input code can indeed run twice... All these years in alpha, I did not think this can happen...

And we also have the answer as to why ESC opens the pause menu instead of closing the current gui screen:
The gui code, runs before the movement code in the tick code. And the gui code handles what to do, if ESC is pressed and that is just closing the screen. And in the movement code after that, the code handles the case that ESC opens the pause menu.

And since TASmod runs both of these cases, the screen is indeed closed and then the ingame menu opens just after...

And this has been in the code for a couple of years I reckon...

@ScribbleTAS ScribbleTAS moved this from Todo to In Progress in TASmod Mar 30, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in TASmod Mar 30, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in TASmod Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gui Issue relates to guis TASFile Issue relates to the playback file used to store inputs
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant