-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
34 lines (27 loc) · 798 Bytes
/
run.sh
File metadata and controls
34 lines (27 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env sh
# Awkventure loading script
# - Loads all awk files in directory
# - Reads console size from stty
# - Loads game file from directory
HEIGHT=$(tput lines)
WIDTH=$(tput cols)
run_game()
{
GAMEFILES=$(ls | grep -o '^[a-zA-Z]*.dat$')
LIBRARIES=$(ls | grep -o '^[a-zA-Z]*.awk$')
SAVEFILE=$(ls | grep -o '^[a-zA-Z]*.sav$' | head -n 1)
gawk $(for lib in $LIBRARIES; do echo "-f "; echo $lib; done;) \
-v screen_width=$WIDTH \
-v screen_height=$HEIGHT \
-v TELNET_FLAG=$TELNET \
-v INTRO_FLAG=$INTRO \
$(for gamefile in $GAMEFILES; do echo $gamefile; done;) \
$SAVEFILE
}
if [ "$1" = "TELNET" -o "$2" = "TELNET" ]; then
TELNET=1
fi
if [ "$1" = "INTRO" -o "$2" = "INTRO" ]; then
INTRO=1
fi
run_game