I finally figured out how to launch a custom music file for a zone (or, for that matter, a proximity). Just use the perl "system" command as a function in a .pl script, a DOS batch file, and a music clip. Here's how it works.
To get custom "mood" music to play when entering a zone:
1. Create a music clip (in this case, I named it
zone.mp3). Place this clip in the desired quest\zone folder.
2. Place the following script in the quest\zone\player.pl file (if player.pl does not exist in that folder, create it):
Code:
sub EVENT_ENTERZONE
{
my $zone_music = 'C:\EQEmu\quests\[zone_name]\music.bat';
system ("$zone_music");
}
3. Create a corresponding batch file (in this case, I named it
music.bat) containing the following text, and place it in the desired quest\zone folder:
Code:
@echo off
start C:\EQEmu\quests\[zone_name]\zone.mp3
4. #reloadquest, and enter the zone.
Although I have not yet attempted it, the same "system" command could be used in an NPC .pl in a sub EVENT_ENTER event after proximity has been set in the sub EVENT_SPAWN event.
One drawback: the media player will pop up on top of the screen when it launches the file, but an alt-tab back to the screen hides it. I have not yet figured out how to keep that from happening.