A tui launcher for jc141 releases. A very simple way to launch jc141 games
Paste code to text file .sh extension and run script in the directory where jc141 are present, also install dialog
<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;">
</span><span style="color:#323232;"># navigate to the directory containing the .sh files
</span><span style="color:#323232;">cd "$(dirname "$(readlink -f "$0")")" || exit
</span><span style="color:#323232;">
</span><span style="color:#323232;"># directory containing the game directories
</span><span style="color:#323232;">games_dir="$PWD/"
</span><span style="color:#323232;">
</span><span style="color:#323232;"># check if the games directory exists
</span><span style="color:#323232;">if [ ! -d "$games_dir" ]; then
</span><span style="color:#323232;">echo "error: The 'games' directory does not exist."
</span><span style="color:#323232;">exit 1
</span><span style="color:#323232;">fi
</span><span style="color:#323232;">
</span><span style="color:#323232;"># initialize the dialog menu options
</span><span style="color:#323232;">menu_options=()
</span><span style="color:#323232;">
</span><span style="color:#323232;"># loop through subdirectories in the games directory
</span><span style="color:#323232;">for game_dir in "$games_dir"/*/; do
</span><span style="color:#323232;">if [ -d "$game_dir" ]; then
</span><span style="color:#323232;"># extract the parent directory name as the game name
</span><span style="color:#323232;">game_name=$(basename "$game_dir")
</span><span style="color:#323232;">
</span><span style="color:#323232;"># check if any of the specified .sh files exist
</span><span style="color:#323232;">if [ -f "$game_dir/start.w.sh" ] || [ -f "$game_dir/start.e-w.sh" ] || [ -f "$game_dir/start.sh" ] || [ -f "$game_dir/start.n.sh" ]; then
</span><span style="color:#323232;"># add the game name to the menu options
</span><span style="color:#323232;">menu_options+=("$game_name" "Run $game_name")
</span><span style="color:#323232;">fi
</span><span style="color:#323232;">fi
</span><span style="color:#323232;">done
</span><span style="color:#323232;">
</span><span style="color:#323232;"># use dialog to display the menu
</span><span style="color:#323232;">choice=$(dialog --title "Select a game:" --menu "Games:" 30 30 15 "${menu_options[@]}" 2>&1 >/dev/tty)
</span><span style="color:#323232;">
</span><span style="color:#323232;"># check if the user selected a game and execute it
</span><span style="color:#323232;">if [ -n "$choice" ]; then
</span><span style="color:#323232;">selected_game="${choice#* }" # extract the selected game name from the choice
</span><span style="color:#323232;">selected_game_dir="$games_dir/$selected_game"
</span><span style="color:#323232;">
</span><span style="color:#323232;"># determine which script exists and set the selected_game_script accordingly
</span><span style="color:#323232;">if [ -f "$selected_game_dir/start.w.sh" ]; then
</span><span style="color:#323232;">selected_game_script="$selected_game_dir/start.w.sh"
</span><span style="color:#323232;">elif [ -f "$selected_game_dir/start.e-w.sh" ]; then
</span><span style="color:#323232;">selected_game_script="$selected_game_dir/start.e-w.sh"
</span><span style="color:#323232;">elif [ -f "$selected_game_dir/start.n.sh" ]; then
</span><span style="color:#323232;">selected_game_script="$selected_game_dir/start.n.sh"
</span><span style="color:#323232;">elif [ -f "$selected_game_dir/start.sh" ]; then
</span><span style="color:#323232;">selected_game_script="$selected_game_dir/start.sh"
</span><span style="color:#323232;">else
</span><span style="color:#323232;">echo "error: this script must run with in the directory of jc141 downloads"
</span><span style="color:#323232;">exit 1
</span><span style="color:#323232;">fi
</span><span style="color:#323232;">
</span><span style="color:#323232;"># execute the selected game's script
</span><span style="color:#323232;">chmod +x "$selected_game_script" # make the script executable
</span><span style="color:#323232;">"$selected_game_script"
</span><span style="color:#323232;">fi
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span>