summaryrefslogtreecommitdiff
path: root/npc/commands/music.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/commands/music.txt')
-rwxr-xr-x[-rw-r--r--]npc/commands/music.txt88
1 files changed, 23 insertions, 65 deletions
diff --git a/npc/commands/music.txt b/npc/commands/music.txt
index b817b949..5c62f008 100644..100755
--- a/npc/commands/music.txt
+++ b/npc/commands/music.txt
@@ -1,75 +1,33 @@
-// @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,{
+- script @music NPC32767,{
+ callfunc "argv_splitter";
+ if (GM < CMD_MUSIC && GM < G_SYSOP) goto L_GM;
+ if (@argv$[0] == "") goto L_Failed;
+
+ gmlog "@music " + @args$;
+ .@find = array_search(@argv$[0], .find$);
+ if (.@find >= 0)
+ @argv$[0] = .replace$[max(.@find, 0)];
+ .file$ = @argv$[0];
+ areatimer 0, getmapname(), (POS_X - .range), (POS_Y - .range), (POS_X + .range), (POS_Y + .range), 0, strnpcinfo(0)+"::OnPC";
+ message strcharinfo(0), "music : The music has ben temporarily changed.";
end;
-OnCall:
- if (!is_evtc())
- {
- end;
- }
-
- // TODO: tmw-like argv splitter
- .@map$ = getmap();
-
- .@m$ = strtolower(.@atcmd_parameters$[0]);
-
- // GMs might not know and want a list of musics
- if (.@m$ == "" || .@m$ == "list") {
- .@r$="list";
-
- freeloop(true);
- .@size=getarraysize($MUSIC_ARRAY$);
- for (.@i = 0; .@i < .@size; ++.@i) {
- .@r$+=", "+$MUSIC_ARRAY$[.@i];
- }
- freeloop(false);
-
- dispbottom("Music list: "+.@r$);
- end;
- }
-
- .@key = array_exists($MUSIC_ARRAY$, .@m$);
-
- if (!.@key)
- {
- //.@m$ = implode(.@atcmd_parameters$[0], " ");
- message(getcharid(CHAR_ID_ACCOUNT), sprintf("Can't broadcast: %s.ogg", .@m$));
- } else {
- message(getcharid(CHAR_ID_ACCOUNT), sprintf("Now broadcasting: %s", .@m$));
- changemusic .@map$, .@m$ + ".ogg";
- }
+OnPC:
+ music .file$ + ".ogg";
end;
-OnMyself:
- .@m$ = strtolower(.@atcmd_parameters$[0]);
- .@key = array_exists($MUSIC_ARRAY$, .@m$);
-
- // TODO: Check if you have the music unlocked? Bitmask? Array?
+L_Failed:
+ message strcharinfo(0), "music : You must specify a music file.";
+ end;
- if (!.@key)
- {
- //.@m$ = implode(.@atcmd_parameters$[0], " ");
- message(getcharid(CHAR_ID_ACCOUNT), sprintf("Can't play: %s.ogg", .@m$));
- } else {
- message(getcharid(CHAR_ID_ACCOUNT), sprintf("Now playing: %s", .@m$));
- changeplayermusic .@m$ + ".ogg";
- }
+L_GM:
+ message strcharinfo(0), "music : GM command is level "+ CMD_MUSIC +", but you are level " + GM;
end;
OnInit:
- bindatcmd "music", "@music::OnCall", 0, 99, 1;
- bindatcmd "jukebox", "@music::OnMyself", 0, 50, 0;
+ setarray .find$, "this", "cave", "chilling", "clouds", "dimond", "explorers", "gy", "reid", "magick", "mystique", "night", "ride", "sail", "snow", "forest", "xmas";
+ setarray .replace$, "this", "cavesong", "chilling-environment", "clouds-calling", "dimonds-cove", "explorers-melody", "graveyard", "inquisitive-inn", "magick-real", "mystique-forest", "night-is-calling", "ride-of-the-valkyries", "sail-away", "snow-village", "the-forest", "white-christmas";
+ set .range, 14; // FIXME: make this a const
+ registercmd chr(ATCMD_SYMBOL) + "music", strnpcinfo(0);
end;
}