Background music "addon"

Design concepts in general, talk about your favorites, show levels you've made, give feedback.
Mouzi
Posts: 153
Joined: Sat Sep 01, 2007 5:34 am
Location: Finland
Contact:

Background music "addon"

Post 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
asdasdg
Posts: 240
Joined: Sun Dec 28, 2008 11:27 am
Contact:

Re: Background music "addon"

Post by asdasdg »

Does it only work on firefox?
Mouzi
Posts: 153
Joined: Sat Sep 01, 2007 5:34 am
Location: Finland
Contact:

Re: Background music "addon"

Post 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.
Fruktfisk
Posts: 29
Joined: Sun Aug 31, 2008 3:16 am

Re: Background music "addon"

Post 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
Mouzi
Posts: 153
Joined: Sat Sep 01, 2007 5:34 am
Location: Finland
Contact:

Re: Background music "addon"

Post 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
Zeke
Posts: 165
Joined: Mon Dec 10, 2007 10:40 pm
Contact:

Re: Background music "addon"

Post by Zeke »

The install is painless and it worked great. Now please write one for IE :-)

"Reality is merely an illusion, albeit a very persistent one." - Albert Einstein
User avatar
NARFNra
Posts: 82
Joined: Sun Aug 31, 2008 7:46 pm
Location: Laughing evilly as he manipulates the government on Zeta Flolan.
Contact:

Re: Background music "addon"

Post 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...
I am of open mind and willing to hear criticism. Also: That's stupid and you're stupid. ~ 8Bit Theater

Ye who runs needlessly,
Thou art a fool,
Thou art a fool,
Thou art a fool,
Thou art a fool,
~La Mulana, Endless Corridor Tablet
Mouzi
Posts: 153
Joined: Sat Sep 01, 2007 5:34 am
Location: Finland
Contact:

Re: Background music "addon"

Post by Mouzi »

I guess I'll have to look into making different versions of this then.
User avatar
NARFNra
Posts: 82
Joined: Sun Aug 31, 2008 7:46 pm
Location: Laughing evilly as he manipulates the government on Zeta Flolan.
Contact:

Re: Background music "addon"

Post by NARFNra »

Can anybody hear music in this?
http://zetaflow.skylogic.ca/game/profile/12294
I am of open mind and willing to hear criticism. Also: That's stupid and you're stupid. ~ 8Bit Theater

Ye who runs needlessly,
Thou art a fool,
Thou art a fool,
Thou art a fool,
Thou art a fool,
~La Mulana, Endless Corridor Tablet
Mouzi
Posts: 153
Joined: Sat Sep 01, 2007 5:34 am
Location: Finland
Contact:

Re: Background music "addon"

Post by Mouzi »

Works for me.
Zeke
Posts: 165
Joined: Mon Dec 10, 2007 10:40 pm
Contact:

Re: Background music "addon"

Post 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.

"Reality is merely an illusion, albeit a very persistent one." - Albert Einstein
Mouzi
Posts: 153
Joined: Sat Sep 01, 2007 5:34 am
Location: Finland
Contact:

Re: Background music "addon"

Post 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.
Zeke
Posts: 165
Joined: Mon Dec 10, 2007 10:40 pm
Contact:

Re: Background music "addon"

Post 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.

"Reality is merely an illusion, albeit a very persistent one." - Albert Einstein
Mouzi
Posts: 153
Joined: Sat Sep 01, 2007 5:34 am
Location: Finland
Contact:

Re: Background music "addon"

Post by Mouzi »

You can just click the link again and reinstall. It replaces the old one.
asdasdg
Posts: 240
Joined: Sun Dec 28, 2008 11:27 am
Contact:

Re: Background music "addon"

Post 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! :)
Post Reply