Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 04-10-2009, 08:10 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default 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 
	{
	my $zone_music_end = 'cscript.exe /nologo C:\EQEmu\quests\music\stop.vbs';
	system("$zone_music_end");
		
	my $zone_music_a = 'C:\EQEmu\quests\music\runa.vbs'; #Zoneid 11
	my $zone_music_b = 'C:\EQEmu\quests\music\runb.vbs'; #Zoneid 117
	my $zone_music_c = 'C:\EQEmu\quests\music\runc.vbs'; #Zoneid 3

	if($zoneid == 11)
		{ #executes the corresponding vb script above
		system("$zone_music_a");
		}
	elsif($zoneid == 117)
		{
		system("$zone_music_b");
		}
	elsif($zoneid == 3)
		{
		system("$zone_music_c");
		}
	}
4. Create a vb script for each zone for which you will have custom music. I've called mine "run_.vbs" replacing the underscore with a sequential letter (runa.vbs, runb.vbs, runc.vbs, etc.). You'll need to download and install Wscript to execute this (if you don't already have it). Notice below that the script launches a corresponding batch file (in this case, "runa.bat"). The batch file itself will launch the wav file. I use the vb script to execute the batch file in a "shell," which in turn allows the batch file to run in "silent" mode (i.e., it won't interrupt game play by opening a command line first). The script below can be used as a template. Just change the pathname and filename to whatever path/filename you're using. Create one of these for each wav file you'll be using.

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.
Reply With Quote
  #2  
Old 04-10-2009, 08:37 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

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).
Reply With Quote
  #3  
Old 04-10-2009, 08:44 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

Also, I should clarify that when following the instructions to modify the way wav files are palyed without using a media player GUI . . .

Quote:
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.
. . . you won't actually see the "Hear" action in the dialog. The is because you are creating it new. Create a new action called "Hear," and use the settings above to define it. Then set it as your default. This way you won't overwrite other ways you may want to use wav files.
Reply With Quote
  #4  
Old 04-10-2009, 09:12 PM
RichardoX
Hill Giant
 
Join Date: Dec 2004
Location: in your closet....
Posts: 169
Default

That's the most kick-ass thing I've ever seen!
__________________
a hill giant slashes YOU for 25 points of damage!
You have been slain!
LOADING, PLEASE WAIT...
Reply With Quote
  #5  
Old 04-11-2009, 11:10 AM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:26 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3