External triggers from runcommand-onstart.sh
-
X86_64 - Ubuntu Server 24.04.2 LTS
Script version 4.8.9I'll preface this with I am my worst enemy and I am probably over reaching in my capabilities, I am by no means a programmer but can work with python files.
Reding the various posts a lot of things can be done with runcommand-onstart.sh and I have Ideas.
And I set up a 2nd retropie to experiment... without stuffing too much up.I get there are multiple variables onstart.sh uses as per: https://retropie.org.uk/forum/post/23378
To see what they produce can I (for example):
echo $rom > ~/test.txt
To then later use these outputs in a command for an external program?
-
M mitu moved this topic from Ideas and Development
-
@Rens said in External triggers from runcommand-onstart.sh:
To then later use these outputs in a command for an external program?
Not sure what that means - perhaps you'd better explain what you'd like to accomplish during the onstart phase ?
-
@mitu Sorry for the delayed reply...
The plan is to drive an LED matrix, not unlike pixelcade has done, but from scratch.
I'm running rpi-rgb-led-matrix on a raspberry pi-zero currently separately from the retro-pie.Onstart I want to run a script, that ssh into the pi-zero and runs led-image-viewer with art based on the rom file or if no art found a default image for system/emulator
So as i understand it I need to see what the variable contains to then tie it to an image.
-
@Rens said in External triggers from runcommand-onstart.sh:
Onstart I want to run a script, that ssh into the pi-zero and runs led-image-viewer with art based on the rom file or if no art found a default image for system/emulator
Alright, though I don't see the connection with the output part.
Regardless, you can run your scripts from the
onstart
event handlers and they can do everything a script can, including writing files with variables received by theonstart
handler (ROM file, SYSTEM, etc.) -
@Rens I think you're asking what parameters are passed to the onstart/onend scripts. It is just the four mentioned in the docs: $1 = system, $2 = emulator, $3 = rom path and $4 = command
https://retropie.org.uk/docs/Runcommand/#runcommand-scripts
Useful data are passed as arguments to these scripts:
$1
- the system (eg: atari2600, nes, snes, megadrive, fba, etc).$2
- the emulator (eg: lr-stella, lr-fceumm, lr-picodrive, pifba, etc).$3
- the full path to the rom file.$4
- the full command line used to launch the emulator.
You can see here, for example, the
runcommand-onstart.sh
and others are called with theuser_script
function:user_script "runcommand-onstart.sh"
The function:
# calls script with parameters SYSTEM, EMULATOR, ROM, and commandline function user_script() { local script="$CONFIGDIR/all/$1" if [[ -f "$script" ]]; then bash "$script" "$SYSTEM" "$EMULATOR" "$ROM" "$COMMAND" </dev/tty 2>>"$LOG" fi }
The meat is here:
bash "$script" "$SYSTEM" "$EMULATOR" "$ROM" "$COMMAND" </dev/tty 2>>"$LOG"
As you can see, only the four parameters
"$SYSTEM" "$EMULATOR" "$ROM" "$COMMAND"
are passed to$script
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.