Skip to content

Custom Game Scripts

professorkaos64 edited this page Aug 16, 2016 · 7 revisions

Table of Contents generated with DocToc

About

This page details various ways to work with scripts around Steam games under SteamOS.

Launching a program or script before the game launches

Author: elmat0

In this example, i'll be showing you how to launch antimicro before the game starts, and then exit when the game is no longer running. Please keep in mind this may not work for every use-case. Typically, there must be some kind of command to act as a "wrapper," before launching the game. Reference issue 186 from the Antimicro GitHub page.

Making your bash script:

#!/bin/sh
#
# Requires 2 arguments entered in the games launch options, first the name of the antimicro profile
# to load, followed by the games executable. Due to the way SteamOS handles non-steam games
# (%command% substitution wont work) you must place an '&' at the start (or after any game launch
# options) to set the game as a background task, and a trailing ';' to encapsulate the antimicro
# options as a single command. The game executable specified at the end isn't actually called but
# merely to tell the script to keep antimicro running until that process is terminated.
#
# Syntax '<game launch options> & antimicro-nonsteam <profile name> <game executable> ;'
# eg '-r /home/steam/.neverball/Replays/Last.nbr & antimicro-nonsteam neverball neverball;'

PROFILEDIR="/home/steam/antimicro/profiles"

antimicro --hidden --profile "$PROFILEDIR/$1.gamecontroller.amgp" &
GAMEPID=$(pgrep $2)
while [ -e /proc/$GAMEPID ]
do
  sleep 1
done
killall antimicro
wait

In the launch options for the game, try something like this:

Syntax '<game launch options> & antimicro-nonsteam <profile name> <game executable> ;
Clone this wiki locally