Page 1 of 2

Background music "addon"

Posted: Sun Feb 21, 2010 9:39 am
by Mouzi
This is a user-script I made for the Greasemonkey Add-on on Mozilla Firefox to play background music on levels.
The music will work for anyone playing the level if they have the user-script (and have no problems with YouTube).

Requirements:
Mozilla Firefox
Greasemonkey Add-on

If you already have these then you can click here and install the user-script.

The script allows you to add music from YouTube as the background music of your level.
You only need to specify it in your AI code. An example level can be found here. (The music will only work if you have the user-script.)

The syntax is as follows:

Code: Select all

bgMusic, startingMinutes, startingSeconds, endingMinutes, endingSeconds, volume (0 - 100), youtubeID
Example:

Code: Select all

randomRotate
bgMusic,0,2,3,55,100,YOUTUBEID
randomWaypoints
rotatePart,0,10
The code will play the video specified in youtubeID from 0:02 to 3:55 and then loop. It will also set the volume to 100.

You can get the YouTube ID from the url for example in
youtube.com/watch?v=9SbGP4TlwAQ
The ID would be 9SbGP4TlwAQ. (Only include the ID even if there would be parameters after it eg. &fmt=18 or &feature=related)

If you find any bugs let me know :P

Re: Background music "addon"

Posted: Sun Feb 21, 2010 11:09 am
by asdasdg
Does it only work on firefox?

Re: Background music "addon"

Posted: Sun Feb 21, 2010 12:01 pm
by Mouzi
Yeah :P I know, I know, FF sucks but it was the easiest one for me.
Other browsers support user-scripts too but you'd have to rewrite it and fix browser specific problems.

Re: Background music "addon"

Posted: Sun Feb 21, 2010 12:58 pm
by Fruktfisk
This is awesome, I already use Firefox with GM, so this went fairly quick.
I should do a level for this sometime soon.

btw, Firefox might not be the best browser, but it is so customizable that I can get it to look the way I want it to, which in my opinion makes it awesome. :D

Re: Background music "addon"

Posted: Sun Feb 21, 2010 1:17 pm
by Mouzi
I hope this doesn't turn into Browser Wars™ but anyway I too liked Firefox for a long time and I'm still using it because I couldn't live without the extensions. The best thing about Firefox is also the worst thing. All the extensions make it a bit buggy and slow at least for me (it's not the fastest even without the extensions) so I'm also using Chrome on the side sometimes. [/offtopic]

Glad you liked it Fruktfisk :P

Re: Background music "addon"

Posted: Sun Feb 21, 2010 7:37 pm
by Zeke
The install is painless and it worked great. Now please write one for IE :-)

Re: Background music "addon"

Posted: Sun Feb 21, 2010 11:07 pm
by NARFNra
It seems totally impossible to transplant this into Seamonkey...

Shame really, as it works in Iceweasel, which JUST SO HAPPENS to completely fail at using Zeta Flow.

I swear the world is conspiring against me...

Re: Background music "addon"

Posted: Mon Feb 22, 2010 2:10 am
by Mouzi
I guess I'll have to look into making different versions of this then.

Re: Background music "addon"

Posted: Mon Feb 22, 2010 2:15 am
by NARFNra
Can anybody hear music in this?
http://zetaflow.skylogic.ca/game/profile/12294

Re: Background music "addon"

Posted: Mon Feb 22, 2010 2:39 am
by Mouzi
Works for me.

Re: Background music "addon"

Posted: Mon Feb 22, 2010 4:29 am
by Zeke
NARF - Your level worked for me too. Yours differed from Mouzi's example, in that the music started as soon as I clicked the joystick icon and went to the level title page. Whereas Mouzi's music doesn't begin until a few seconds after level play starts.

There also seemed to be a difference of about 1 FPS. It would appear that the music file size has an impact.

Re: Background music "addon"

Posted: Mon Feb 22, 2010 10:05 am
by Mouzi
I noticed a small mistake there. It said background music loading even if there is no bgmusic. Fixed the code now, so update if you have it installed.

Re: Background music "addon"

Posted: Mon Feb 22, 2010 10:11 am
by Zeke
Mouzi - Do I have to uninstall and then reinstall? Pardon my ignorance, but I rarely use FF and this is the first add-on I've ever installed.

Re: Background music "addon"

Posted: Mon Feb 22, 2010 11:22 am
by Mouzi
You can just click the link again and reinstall. It replaces the old one.

Re: Background music "addon"

Posted: Sun Mar 14, 2010 6:11 pm
by asdasdg
Even though I don't have the software required, I have put music in a few of my levels.
Most recent example is the chaleng enhanced. Enjoy! :)