Custom zone music is here!
Well, sort of . . .
If you've ever wanted the ability to play custom music in the zones that are part of your world--if for no other reason than to provide proper ambiance for each zone--now you can. I have been working on this for months, and have finally taken it to the point that it works on the server. It's not yet fully functional on the client, and I am struggling with the best way to approach that. So I'm submitting this in the hope it will spark an idea in someone. Here's what I've done so far: 1. Create custom wav files for the desired zones (I use Audacity, which is a free download and allows you to convert mp3 and other formats to wav). Name them sequentially as zonea.wav, zoneb.wav, zonec.wav, etc. Using mp3s would save a lot of space, but I cannot figure out how to get the media player to play in the background (see # 2 below) when using mp3s. 2. You'll need to run the music in the background to prevent constant interrupts by the Media player GUI as it launches each new wav file. To do that in Windows XP (Vista is more difficult), use these instructions: Start, Control Panel, Folder Options, File Types; select file-type WAV; Advanced; New ...; Action - Hear; Application Used to Perform Action - C:\WINDOWS\system32\sndrec32.exe /embedding /play "%L" /Close; checkmark Use DDE; DDE Message leave blank; Application - sndrec32; DDE Application Not Running - leave blank; Topic - system; OK; Set Default; OK; Close. 3. Set up the following script in your C:\EQEmu\quests\templates\player.pl (create it if you don't have it; just know the template player.pl will be overridden by any zone-specific player.pl). I've included three zones in the sample below. You would of course change these to the zones you are using and add as many entries as you need: Code:
sub EVENT_ENTERZONE Contents of run*.vbs Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.run "%comspec% /c C:\EQEmu\quests\music\runa.bat",0 Set WshShell = Nothing 5. Using the template below, create batch files for all zones for which you will have custom music. The batch file launches the .wav file for the zone (in this case, zonea.wav): Contents of runa.bat @echo off start C:\EQEmu\quests\music\zonea.wav 6. Place all vb scripts, batch files, and wav files in the same folder (I've placed mine in c:\eqemu\quests\music\. Start game, and enter one of the zones for which you have created custom music. This music system will work well on the computer that hosts the world server. However, there are still problems with the system that need to be resolved. They are: 1. Any client machine that enters a custom-music zone will trigger the music (via the player script) on the server machine only. And it will trigger it every time another player enters another custom-music zone. 2. The instructions above will not yet allow you to play custom music on the client machine. I have been experimenting with pstools (specifically, psexec); but for this to work you need to hard-code the computer name and the administrative login and password for each client in a listfile accessed by the server, and execute this in the run*.bat file for each zone. As well (since psexec does not like commands that run music on other computers) you would need to add a second layer of .vbs and .bat files that reside on the client machine and are executed by the original run*.bat (see example below) On the server run*.bat: for /F "tokens=1,2,3*" %%A in (LISTFILE.TXT) do ( psexec \\%%A -u %%B -p %%C -i cscript.exe /nologo c:\EQEmu\Quests\music\musica.vbs ) On the client machine Contents of musica.vbs Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.run "%comspec% /c C:\EQEmu\quests\music\musica.bat",0 Set WshShell = Nothing Contents of musica.bat @echo off start C:\EQEmu\quests\music\zonea.wav But even with this, the music will begin playing on ALL machines indiscriminately whenever any one client (or server) enters a zone. I have not yet figured out a way to make the music play only on the machine that enters the zone. I assume there is something I could do to the player.pl that would isolate the function to the client machine that enters the zone, but I have no idea what that would be. Any help on this would be greatly appreciated. |
Oops . . . almost forgot to include the script for stop.bat and stop.vbs. These will ensure music from a prior zone stops before starting music for the current zone (otherwise, both will play at the same time).
Stop.vbs Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.run "%comspec% /c C:\EQEmu\quests\music\stop.bat",0 Set WshShell = Nothing Stop.bat @echo off pskill sndrec32 pskill comes stock with pstools. They are free; just google and download. Otherwise, just use tskill (tskill sndrec32). |
Also, I should clarify that when following the instructions to modify the way wav files are palyed without using a media player GUI . . .
Quote:
|
That's the most kick-ass thing I've ever seen!
|
By the way, this works great for a LAN setup (minilogin or private login scenario) where all players are in the same room and hunting in the same zones. Just hook up a speaker to the server and place the speaker in a central location so everyone can hear it.
|
All times are GMT -4. The time now is 09:31 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.