View difference between Paste ID: 3C6eHz1q and 5JLjqrne
SHOW: | | - or go back to the newest paste.
1
append = [$arg1 = (concat (getalias $arg1) $arg2)]
2
rndo = [result (at $arg1 (rnd (listlen $arg1)))]
3
4
// Simple music player for Sauerbraten
5
6
playasong = [
7-
	playlist = ""; audiolibrary = [.wma .wav .ogg .mid]
7+
	playlist = [] ; _ext = [.wma .wav .ogg .mid]
8
	loopfiles f "packages/fanatic" "" [
9-
		if (> (indexof $audiolibrary (substr $f (- (strlen $f) 4))) -1) [
9+
		if (> (indexof $_ext (substr $f (- (strlen $f) 4))) -1) [
10
			append playlist (format ["%1"] $f)
11
		]
12
	]
13
	song = (rndo $playlist)
14
	music (format "fanatic/%1" $song) playasong
15-
	echo (concat "^f7Now playing:^f2" $song)
15+
	echo "^f7Now playing:^f2" $song
16
]
17
18
19