Page 1 of 2

Crazy MP3 player idea

Posted: Sat Feb 07, 2009 4:51 am
by AngryWolf
I've got this idea that I could add a cheap MP3 player support to TF2 by scripting. It currently works like this: create a [GAME]\tf\sound\mp3 directory and copy exactly 10 of your favorite songs there named in the following scheme: 1.mp3, 2.mp3, ..., 10.mp3. Then with the script below, you'll be able to switch forth and back between the songs by pressing F6 and F7, in addition, F8 starts and stops the current song.

The code is like this:

Code: Select all

// ************* ALIASES ***************

alias mp3_next "mp3_1"
alias mp3_prev "mp3_10"

alias mp3_1  "play mp3/1.mp3;  alias mp3_next mp3_2;  alias mp3_prev mp3_10; alias mp3_stopstart mp3_stop"
alias mp3_2  "play mp3/2.mp3;  alias mp3_next mp3_3;  alias mp3_prev mp3_1; alias mp3_stopstart mp3_stop"
alias mp3_3  "play mp3/3.mp3;  alias mp3_next mp3_4;  alias mp3_prev mp3_2; alias mp3_stopstart mp3_stop"
alias mp3_4  "play mp3/4.mp3;  alias mp3_next mp3_5;  alias mp3_prev mp3_3; alias mp3_stopstart mp3_stop"
alias mp3_5  "play mp3/5.mp3;  alias mp3_next mp3_6;  alias mp3_prev mp3_4; alias mp3_stopstart mp3_stop"
alias mp3_6  "play mp3/6.mp3;  alias mp3_next mp3_7;  alias mp3_prev mp3_5; alias mp3_stopstart mp3_stop"
alias mp3_7  "play mp3/7.mp3;  alias mp3_next mp3_8;  alias mp3_prev mp3_6; alias mp3_stopstart mp3_stop"
alias mp3_8  "play mp3/8.mp3;  alias mp3_next mp3_9;  alias mp3_prev mp3_7; alias mp3_stopstart mp3_stop"
alias mp3_9  "play mp3/9.mp3;  alias mp3_next mp3_10; alias mp3_prev mp3_8; alias mp3_stopstart mp3_stop"
alias mp3_10 "play mp3/10.mp3; alias mp3_next mp3_1;  alias mp3_prev mp3_9; alias mp3_stopstart mp3_stop"

alias mp3_stopstart "mp3_stop"
alias mp3_stop "play nothing; alias mp3_stopstart mp3_start"
alias mp3_start "mp3_next; mp3_prev"

// ********** CONFIGURATION ************

bind f6 "mp3_next"
bind f7 "mp3_prev"
bind f8 "mp3_stopstart"

// ****** PRECACHE SOUND FILES *********

play mp3/1.mp3
play mp3/2.mp3
play mp3/3.mp3
play mp3/4.mp3
play mp3/5.mp3
play mp3/6.mp3
play mp3/7.mp3
play mp3/8.mp3
play mp3/9.mp3
play mp3/10.mp3
play nothing
You paste this stuff into an empty file called mp3player.cfg in your [GAME]\tf\cfg directory and then write exec mp3player into your autoexec.cfg.

Unfortunately I have problems with the script:

1. Limited coding abilities (the number of songs is not changable dinamically).

2. Does not support voice (if you enable voice in the game, you can expect multiple songs to be played simultaenously or simply crashes your client). Which sucks.

3. Precaching is necessary, otherwise you can expect "file not found" errors when you're connected to a server. However it could still not work for 10.mp3, as I happened to run into that kind of bug once, and I have no clue why...

So I'm not sure if I should develop this script any further. Maybe I should just play MP3 files on my cell phone using an earphone and at the same time put a headset on so I can also play TF2. :)

Any help welcomed.

Edit: fixed typos

Re: Crazy MP3 player idea

Posted: Sat Feb 07, 2009 7:59 pm
by Johnimus Prime
Might be useful for the admins to play sounds with. Not so with song's though for legal reasons. Genetix can probbably tell you about that.

Re: Crazy MP3 player idea

Posted: Sat Feb 07, 2009 8:58 pm
by DragoonKnight
and maybe have f10 for the stop button :lol:

Re: Crazy MP3 player idea

Posted: Sat Feb 07, 2009 10:10 pm
by indivisible
What's all this F10 lark? I've heard it mentioned a few times in relation to hacks.

Re: Crazy MP3 player idea

Posted: Sat Feb 07, 2009 10:13 pm
by Advent
It quits :)

Re: Crazy MP3 player idea

Posted: Sat Feb 07, 2009 10:18 pm
by indivisible
Ah, [bind F10 quit] kind of way??

I changed mine to disconnect and F12 for quit.

Re: Crazy MP3 player idea

Posted: Sun Feb 08, 2009 1:01 am
by Johnimus Prime
Advent wrote:It quits :)
Your a liar! It's a direct link to loads free money and stuff. Press it, you know you want to

Re: Crazy MP3 player idea

Posted: Sun Feb 08, 2009 9:00 pm
by Fester
real nice work Angry thats a nice little toy for the music lovers.. i must get a section together for these little ideas tips and tricks for the game or game settings..

Re: Crazy MP3 player idea

Posted: Tue Feb 10, 2009 9:37 pm
by Llama@bad
if your machine is good enough: Play TF2 in a Window!
I Have it in a window with only a very very thin blue line at the upper edge of my screen.

Only thing is you have to move the window always in the position when you start tf2 but thats worth the work. I can happyly switch between chat, itunes and internet and tf2, only bad thing:
If you go outside of tf2 of course the sound will stop so you cant keep talking in tf2 or listening to an interesting speech of someone while chatting...

Re: Crazy MP3 player idea

Posted: Tue Feb 10, 2009 9:42 pm
by Jonnywhy
Llama@bad wrote:if your machine is good enough: Play TF2 in a Window!
I Have it in a window with only a very very thin blue line at the upper edge of my screen.

Only thing is you have to move the window always in the position when you start tf2 but thats worth the work. I can happyly switch between chat, itunes and internet and tf2, only bad thing:
If you go outside of tf2 of course the sound will stop so you cant keep talking in tf2 or listening to an interesting speech of someone while chatting...
Just add -noborder to the startup options of tf2. My laptop is not great, but i run no border and it works well. (graphics all turned down to minumum of course)