SHOW:
|
|
- or go back to the newest paste.
1 | append = [$arg1 = (concat (getalias $arg1) $arg2)] | |
2 | rndo = [at $arg1 (rnd (listlen $arg1))] | |
3 | ||
4 | // Simple music player for Sauerbraten. Can't get simpler than this. | |
5 | // If you want to play songs from another folder, change the "fanatic" part. | |
6 | ||
7 | playasong = [ | |
8 | - | _playlist = [] ; _ext = [.wma .wav .ogg .mid] |
8 | + | local playlist ext song |
9 | ext = [.wma .wav .ogg .mid] | |
10 | - | if (> (indexof $_ext (substr $f (- (strlen $f) 4))) -1) [ |
10 | + | |
11 | - | append _playlist (format ["%1"] $f) |
11 | + | if (> (indexof $ext (substr $f (- (strlen $f) 4))) -1) [ |
12 | append playlist [[@@f]] | |
13 | ] | |
14 | - | _song = (rndo $_playlist) |
14 | + | |
15 | - | music (format "fanatic/%1" $_song) playasong |
15 | + | song = (rndo $playlist) |
16 | - | echo "^f7Now playing:^f2" $_song |
16 | + | music [fanatic/@song] playasong |
17 | echo "^f7Now playing:^f2" $song | |
18 | - | |
18 | + |