

While this variable only applies to movies, it is stored as a global variable and can be modified even without a movie loaded. Returns whether the emulator is in read-only state. Returns true if emulator is paused, false otherwise. You probably won't need to use this function unless you want to make your script extra-robust to being started too early. Certain operations such as using savestates are invalid to attempt before emulation has started. Returns true if emulation has started, or false otherwise. Then register memory hooks that will change lag flag when needed. an in-game frame counter that only increments in non-lag frames). Some games poll input even in lag frames, so standard way of detecting lag (used by FCEUX and other emulators) does not work for those games, and you have to determine lag frames manually.įirst, find RAM addresses that help you distinguish between lag and non-lag frames (e.g. Returns true if currently in a lagframe, false otherwise. This returns the number indicated on the lag counter. This happens when it has to compute too much within the frame boundary. Lag frames are frames where the game did not poll for input because it missed the vblank. Returns the number of lag frames encountered. The frame counter runs without a movie running so this always returns a value. Use gui.text() when you need to position text. Set to false or nil to disable a pane, anything else will draw them.ĭisplays given message on screen in the standard messages position. Toggles the drawing of the sprites and background planes. Using this method you can ensure that some heavy operation (like Lua bot) won't freeze FCEUX.Įmu.setrenderplanes(bool sprites, bool background) Calls given function, restricting its working time to given number of milliseconds (approximate). Using this method you can ensure that some heavy operation (like Lua bot) won't freeze FCEUX. Once you move to creating auxillary libraries, try the register() methods.Ĭalls given function, restricting its working time to given number of lua cycles.

This makes more sense when creating bots. For most people, using frame advance in an endless while loop is easier to comprehend so I suggest starting with that. Note that you can also register functions by various methods that run "dead", returning control to the emulator and letting the emulator advance the frame. Most scripts use this function in their main game loop to advance frames. It's like pressing the frame advance button once. The mode argument can be one of these:Īdvance the emulator by one frame.

The following functions are available in FCEUX, in addition to standard LUA capabilities:
