Extcmd: Difference between revisions

From Pico-8 Wiki
Jump to navigation Jump to search
imported>Felice Enellen
(→‎Examples: syntax highlighting)
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 15: Line 15:
* <code>'reset'</code>: Resets the currently running cart, as if the player pressed the reset key sequence (Control-R or Command-R).
* <code>'reset'</code>: Resets the currently running cart, as if the player pressed the reset key sequence (Control-R or Command-R).
* <code>'breadcrumb'</code>: After a cart uses [[Load|load()]] with the breadcrumb parameter to load another cart, loads the original cart, as if the player selected the breadcrumb menu item.
* <code>'breadcrumb'</code>: After a cart uses [[Load|load()]] with the breadcrumb parameter to load another cart, loads the original cart, as if the player selected the breadcrumb menu item.
* <code>'shutdown'</code>: Exits the program if used in an exported binary.
*<code>'set_filename'</code>: Set the filename of the next screenshot or gif.
*<code>'set_title'</code>: set window title (useful for exported binaries)
*<code>'folder'</code>: opens the folder where carts are. Nice if you want to open to a created file or what have you.


These commands are normally available in Pico-8 when you press function keys during cart execution. <code>extcmd()</code> lets you perform these at precise moments that may be difficult to capture by pressing keys, or when running in non-interactive "headless" mode (the <code>-x</code> command line flag).
These commands are normally available in PICO-8 when you press function keys during cart execution. <code>extcmd()</code> lets you perform these at precise moments that may be difficult to capture by pressing keys, or when running in non-interactive "headless" mode (the <code>-x</code> command line flag).


== Examples ==
== Examples ==
<syntaxhighlight lang="lua">
<pre class="p8sh">
extcmd('screen')
extcmd('screen')
</syntaxhighlight>
</pre>


== See also ==
== See also ==

Latest revision as of 03:46, 24 December 2021

extcmd( cmd )
Executes an administrative command from within a program.
cmd
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 if you want to open to a created file or what have you.

These commands are normally available in PICO-8 when you press function keys during cart execution. extcmd() lets you perform these at precise moments that may be difficult to capture by pressing keys, or when running in non-interactive "headless" mode (the -x command line flag).

Examples

extcmd('screen')

See also