Post subject: LUA script stopping - help?
Warepire
He/Him
Editor
Joined: 3/2/2010
Posts: 2178
Location: A little to the left of nowhere (Sweden)
I am trying to write a LUA script that runs a function during the event "event.atframeend()", the problem is that the script stops whenever I let the mouse pointer reach the script-listview, or if I click outside the LUA console. It also seems that "event.onexit()" gets called very early, if I try to do finalizing things on that event they will be executed before the "event.atframeend()" event. What could I be doing wrong? BizHawk 1.8.4.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Scripts should not be stopping from simply hovering in the listview. Double clicking a script will toggle it. Are you sure you aren't doing this by accident. Onexit() sounds like it is behaving correctly. It happens as soon as a script is stopped. It should not wait to then end of a frame.
It's hard to look this good. My TAS projects
Warepire
He/Him
Editor
Joined: 3/2/2010
Posts: 2178
Location: A little to the left of nowhere (Sweden)
Figured it out, I wasn't using the while true do emu.frameadvance loop. It works like I want now. I do however think that the behavior detailed above shall not happen if this loop is omitted.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
I disagree. If you do not have a loop the script will end immediately. However, the console doesn't know yet, as soon as you hover or something that causes a redraw, it will pick it up.
It's hard to look this good. My TAS projects
Warepire
He/Him
Editor
Joined: 3/2/2010
Posts: 2178
Location: A little to the left of nowhere (Sweden)
Perhaps I am thinking too much in terms of "gui.register()" then.