EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Custom zone music--finally! (https://www.eqemulator.org/forums/showthread.php?t=27635)

neiv2 03-06-2009 10:24 PM

Custom zone music--finally!
 
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.

neiv2 03-07-2009 01:55 AM

Well, it appears I still have a bit of work to do on this. When the files are distributed to the client, and the client character zones, the music plays on the server side instead of the client side. I'm sure this would be an easy fix by someone here, but I'll keep working on it till I find a solution.

neiv2 03-08-2009 10:02 AM

So far no success in getting the music to play on the client machine.

The statement $client->system("$zone_music"); doesn't seem to want to respond. The statement system("$zone_music"); works well for the server side, but each time a client enters a different zone, that zone's music begins to play on the server side but not on the client side. If I could find a perl command like "system" that will execute a batch file on the client machine, this would work like a charm. Does anyone know of such a command?


All times are GMT -4. The time now is 04:35 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.