summaryrefslogtreecommitdiff
path: root/npc/commands/music.txt
blob: d2578d1a7605e5de1d85ef4e8dc929d6aaf34b43 (plain) (blame)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// @music atcommand
// changes the music for all players on the map
//
// group lv: 2
// group char lv: 99
// log: True
//
// usage:
//    @music <short name>
//
// example:
//    @music fun

-	script	@music	32767,{
    end;

OnCall:
    if (!is_evtc())
    {
        end;
    }

    // TODO: tmw-like argv splitter
    .@map$ = getmap();

    .@key$ = strtolower(.@atcmd_parameters$[0]);
    .@m$ = htget(.hash, .@key$, "Not found");

    if (.@m$ == "Not found")
    {
        .@m$ = implode(.@atcmd_parameters$[0], " ");
    }

    changemusic .@map$, .@m$ + ".ogg";
    end;

OnMyself:
    .@key$ = strtolower(.@atcmd_parameters$[0]);
    .@m$ = htget(.hash, .@key$, "Not found");

    if (.@m$ == "Not found")
    {
        .@m$ = implode(.@atcmd_parameters$[0], " ");
    }

    changeplayermusic .@m$ + ".ogg";
    end;

OnInit:
    bindatcmd "music", "@music::OnCall", 0, 99, 1;
    bindatcmd "jukebox", "@music::OnMyself", 0, 50, 0;

    .hash = htnew; // create hashtable
    htput(.hash, "forest",     "bartk - in the forest of the birches");
    htput(.hash, "adventure",  "bartk - the adventure begins");
    htput(.hash, "fun",        "eric matyas - ghoulish fun");
    htput(.hash, "surreal",    "eric matyas - surreal place");
    htput(.hash, "ocean",      "ezili - ocean sounds");
}