Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
launch_a_script [2025/11/05 22:36] – [Table] lbrpdxlaunch_a_script [2026/06/08 19:58] (current) – version-reports crcerror
Line 6: Line 6:
  
 You can opt to have scripts launched at various points in Batocera. This will change the location you save the script to and how it opens. You can opt to have scripts launched at various points in Batocera. This will change the location you save the script to and how it opens.
 +
 +===== Version indicators =====
 +
 +Scripts added will be shown in the version number
 +  * ''b'' means boot script for ''/boot/boot-custom.sh'' or ''/boot/postshare.sh''
 +  * ''g'' means a script inside ''/userdata/system/configs/emulationstations/scripts''
 +  * ''c'' means ''custom_service'' (this happens if ''custom.sh'' is transformed to a service)
 +  * ''c2'' means that ''custom_service'' and ''custom.sh'' is active, be aware that the ''custom.sh'' is ignored since **v44**
 +  * ''u{n}'' tells number of user services activated
 +  * ''v'' means that executables files are found in ''/userdata/system/scripts''
 +
 +So for a example a version **43cu3v 2026/05/23 20:44** means, you are using BATOCERA v43 with an //custom_service// and //three user services// active and scripts/programs active for the //game-start-stop-option//
  
 ===== Scripts during boot/shutdown ===== ===== Scripts during boot/shutdown =====
Line 40: Line 52:
  
 <WRAP center round important> <WRAP center round important>
-While [[#custom.sh (deprecated)|custom.sh]] still works in **v40**, it'deprecated since **v38** and and may be removed in a later version. (See [[https://batocera.org/changelog|changelog]].)+While [[#custom.sh (deprecated)|custom.sh]] still works in **v42**, it'abolished since **v43** and and will not work anymore. (See [[https://batocera.org/changelog|changelog]].)
 The recommended way to do custom scripting in Batocera now is the [[#services|services]] method detailed below. The recommended way to do custom scripting in Batocera now is the [[#services|services]] method detailed below.
 </WRAP> </WRAP>
Line 219: Line 231:
 </WRAP> </WRAP>
  
-^ Event name                 ^ Arguments                                                                          ^ Notes                                                                                                                                                                     ^ +^ Event name                   ^ Arguments                                                                          ^ Notes                                                                                                                                                                     ^ 
-| ''game-start''             | ROM name ''rom'', ROM path ''basename'' (arguments described below)                | When a game starts. Nearly identical to Batocera's ''gameStart'', however this doesn't include as much information and only triggers when it's ES itself that starts it.  | +| ''game-start''               | ROM name ''rom'', ROM path ''basename'' (arguments described below)                | When a game starts. Nearly identical to Batocera's ''gameStart'', however this doesn't include as much information and only triggers when it's ES itself that starts it.  | 
-| ''game-end''               | N/A                                                                                | When a game ends. Nearly identical to Batocera's ''gameStop'', however this only triggers when it's ES itself that ends it.                                               | +| ''game-end''                 | N/A                                                                                | When a game ends. Nearly identical to Batocera's ''gameStop'', however this only triggers when it's ES itself that ends it.                                               | 
-| ''game-selected''          | ''getSourceFileData()->getSystem()->getName()'', ''getPath()'', ''getName()''      | New to Batocera **v33**. Whichever game is currently being hovered over. Includes games shown during the screensaver.                                                     | +| ''game-selected''            | ''getSourceFileData()->getSystem()->getName()'', ''getPath()'', ''getName()''      | New to Batocera **v33**. Whichever game is currently being hovered over. Includes games shown during the screensaver.                                                     | 
-| ''system-selected''        | System ''getSelected()->getName()''                                                | New to Batocera **v33**. Whichever system is currently being hovered over in the system list.                                                                             | +| ''system-selected''          | System ''getSelected()->getName()''                                                | New to Batocera **v33**. Whichever system is currently being hovered over in the system list.                                                                             | 
-| ''theme-changed''          | Theme being switched to ''theme_set->getSelected()'', Previous theme ''oldTheme''  | When a different theme is selected. Mostly used for theme/element reloading.                                                                                              | +| ''theme-changed''            | Theme being switched to ''theme_set->getSelected()'', Previous theme ''oldTheme''  | When a different theme is selected. Mostly used for theme/element reloading.                                                                                              | 
-| ''settings-changed''       | N/A                                                                                | When a system setting is saved.                                                                                                                                           | +| ''settings-changed''         | N/A                                                                                | When a system setting is saved.                                                                                                                                           | 
-| ''controls-changed''       | N/A                                                                                | When a controller mapping is saved from the **CONTROLLER MAPPING** menu.                                                                                                  | +| ''controls-changed''         | N/A                                                                                | When a controller mapping is saved from the **CONTROLLER MAPPING** menu.                                                                                                  | 
-| ''config-changed''         | N/A                                                                                | Whenever any configuration, be it system settings or controller mappings, is changed.                                                                                     | +| ''config-changed''           | N/A                                                                                | Whenever any configuration, be it system settings or controller mappings, is changed.                                                                                     | 
-| ''quit''                   | N/A                                                                                | When the system is told to do a regular shutdown.                                                                                                                         | +| ''quit''                     | N/A                                                                                | When the system is told to do a regular shutdown.                                                                                                                         | 
-| ''reboot''                 | N/A                                                                                | When the system is told to do a reboot.                                                                                                                                   | +| ''reboot''                   | N/A                                                                                | When the system is told to do a reboot.                                                                                                                                   | 
-| ''shutdown''               | N/A                                                                                | When the system is told to do a fast shutdown.                                                                                                                            | +| ''shutdown''                 | N/A                                                                                | When the system is told to do a fast shutdown.                                                                                                                            | 
-| ''sleep''                  | N/A                                                                                | When the system is told to sleep.                                                                                                                                         | +| ''sleep''                    | N/A                                                                                | When the system is told to sleep.                                                                                                                                         | 
-| ''wake''                   | N/A                                                                                | When the system is told to wake from sleep.                                                                                                                               | +| ''wake''                     | N/A                                                                                | When the system is told to wake from sleep.                                                                                                                               | 
-| ''achievements''           | with arguments described below                                                     | When a RetroAchievement is unlocked - new to Batocera **v38**                                                                                                             | +| ''achievements''             | with arguments described below                                                     | When a RetroAchievement is unlocked - new to Batocera **v38**                                                                                                             | 
-| ''screensaver-start''      | N/A                                                                                | When the screensaver starts                                                                                                                                               | +| ''screensaver-start''        | N/A                                                                                | When the screensaver starts                                                                                                                                               | 
-| ''screensaver-stop''       | N/A                                                                                | When the screensaver stops (waken up by user)                                                                                                                             | +| ''screensaver-stop''         | N/A                                                                                | When the screensaver stops (waken up by user)                                                                                                                             | 
-| ''suspend''                | N/A                                                                                | When the system is told to sleep (but triggered by  ''/etc/pm/sleep.d/99es_scripts_runner'' instead of ''sleep''                                                        | +| ''suspend''                  | N/A                                                                                | When the system is told to sleep (but triggered by  ''/etc/pm/sleep.d/99es_scripts_runner'' instead of ''sleep''                                                        | 
-| ''resume''                 | N/A                                                                                | When waken up by keyboard action ( triggered by  ''/etc/pm/sleep.d/99es_scripts_runner''                                                                                | +| ''resume''                   | N/A                                                                                | When waken up by keyboard action ( triggered by  ''/etc/pm/sleep.d/99es_scripts_runner''                                                                                | 
-"controller-connected    | device being added to the Batocera machine                                         | New to Batocera **v43**, triggered when a device ''/dev/input/js*'' is connected                                                                                          | +''controller-connected''     | device being added to the Batocera machine                                         | New to Batocera **v43**, triggered when a device ''/dev/input/js*'' is connected                                                                                          | 
-"controller-disconnected | device being disconnected                                                          | New to Batocera **v43**, triggered when a device ''/dev/input/js*'' is disconnected                                                                                       |+''controller-disconnected''  | device being disconnected                                                          | New to Batocera **v43**, triggered when a device ''/dev/input/js*'' is disconnected                                                                                       |
  
 EmulationStation sends different arguments to these scripts based on the event type. For game-related events: EmulationStation sends different arguments to these scripts based on the event type. For game-related events:
  • launch_a_script.1762382164.txt.gz
  • Last modified: 9 months ago
  • by lbrpdx