PICO-8 Wiki
extcmd( cmd )
Executes an administrative command from within a program.
The command name, as a string.

The command can be one of the following:

  • 'label': Sets the cart label to the current screen.
  • 'screen': Saves a screenshot.
  • 'rec': Sets the video recording start point.
  • 'video': Saves an animated GIF to the desktop.
  • 'audio_rec': Starts audio recording.
  • 'audio_end': Ends audio recording and saves to the desktop.
  • 'pause': Activates the pause menu, as if the player pressed the pause button.
  • 'reset': Resets the currently running cart, as if the player pressed the reset key sequence (Control-R or Command-R).
  • 'breadcrumb': After a cart uses load() with the breadcrumb parameter to load another cart, loads the original cart, as if the player selected the breadcrumb menu item.
  • 'shutdown': Exits the program if used in an exported binary.
  • 'set_filename': Set the filename of the next screenshot or gif.
  • 'set_title': set window title (useful for exported binaries)
  • 'folder': opens the folder where carts are. Nice for opening to a created file or something similar.

These commands mirror actions a user can perform while running a PICO-8 cart and pressing function keys or running shell commands. The extcmd() function allows triggering these actions at precise moments that may be difficult to capture by pressing keys, or when running in non-interactive "headless" mode (via the -x command line flag).


function achievement_unlocked(str)
  extcmd('screen') -- save a screenshot of the moment

See also[]