summaryrefslogtreecommitdiff
path: root/npc/commands
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-10-16 20:19:43 +0000
committerJesusaves <cpntb1@ymail.com>2020-10-16 20:19:43 +0000
commit83a913ba19dbbcabf4d00b27d436fa6b56504881 (patch)
treea847e99ebbb73f0cd73f1cc0bd569044a08bab05 /npc/commands
parentd4edbf92056973481c9937f20d9130e68f96e993 (diff)
downloadserverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.tar.gz
serverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.tar.bz2
serverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.tar.xz
serverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.zip
Jukebox
This allows players to use @jukebox like @music anywhere And it also adds a classy Jukebox in Hurnscald PUB. First experiment with public functions, don't blame me if it breaks :p Low priority, adding to MR list in order to met deadlines.
Diffstat (limited to 'npc/commands')
-rw-r--r--npc/commands/music.txt17
1 files changed, 15 insertions, 2 deletions
diff --git a/npc/commands/music.txt b/npc/commands/music.txt
index e794060f..d2578d1a 100644
--- a/npc/commands/music.txt
+++ b/npc/commands/music.txt
@@ -21,9 +21,9 @@ OnCall:
}
// TODO: tmw-like argv splitter
- getmapxy .@map$, .@void, .@void, UNITTYPE_PC; // get map
+ .@map$ = getmap();
- .@key$ = .@atcmd_parameters$[0];
+ .@key$ = strtolower(.@atcmd_parameters$[0]);
.@m$ = htget(.hash, .@key$, "Not found");
if (.@m$ == "Not found")
@@ -34,8 +34,21 @@ OnCall:
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");