diff options
-rw-r--r-- | npc/commands/music.txt | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/npc/commands/music.txt b/npc/commands/music.txt index d89bfc7db..812e1f465 100644 --- a/npc/commands/music.txt +++ b/npc/commands/music.txt @@ -15,6 +15,12 @@ - script @music 32767,{ end; +function listMusic { + dispbottom "ship, city, ghoul, surreal, magic, forest, mythica, acid, misuse, prelude, sunrise, peace, peace2, peace3, toast, woodland2"; + dispbottom "unforgiving, deepcave, 8bit, action, hurns, fields, tulim, candor, lof, icecave, manacave, adventure, dance, academy, shrine, boss, ruins"; + return; +} + OnCall: if (!is_gm()) { end; @@ -29,15 +35,29 @@ OnCall: if (.@m$ == "Not found") { //.@m$ = implode(.@atcmd_parameters$[0], " "); dispbottom "Invalid music key. Current accepted values are:"; - dispbottom "ship, city, ghoul, surreal, magic, forest, mythica, acid, misuse, prelude, sunrise, peace, peace2, peace3, toast, woodland2"; - dispbottom "unforgiving, deepcave, 8bit, action, hurns, fields, tulim, candor, lof, icecave, manacave, adventure, dance, academy, shrine, boss, ruins"; + listMusic(); } else { changemusic .@map$, .@m$; } end; +OnMyself: + .@key$ = strtolower(.@atcmd_parameters$[0]); + .@m$ = htget(.hash, .@key$, "Not found"); + + if (.@m$ == "Not found") { + //.@m$ = implode(.@atcmd_parameters$[0], " "); + dispbottom l("Invalid music key. Current accepted values are:"); + listMusic(); + } else { + //debugmes "Casting with: %s", .@m$; + changeplayermusic .@m$; + } + end; + OnInit: bindatcmd "music", "@music::OnCall", 60, 80, 1; + bindatcmd "mymusic", "@music::OnMyself", 1, 80, 1; .hash = htnew; // create hashtable htput(.hash, "ship", "sail_away.ogg"); |