Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Music? Please?

9 years ago

Hey. I'm Chaotime.

I've been wanting to add music into my game (WITH an option to turn it off mind you!)

I do NOT want to turn off rich text editor.

I'd like to use an mp3 I have on my flashdrive. Is this possible and if so how do I do it?

If it's not possible, I can find the same or similar music on youtube. Recommendations for particular pieces are appreciated. It's a horror game and I just want typical, creepy ambient background music. I'd like it to autoplay, but have a link on a particular page that will turn it off and on as the player wishes. This page can be accessed at any time through an item. Not all of these features I'm describing is available yet, but I would really like to know how to input music into a game WITHOUT a player having to click on a video and I don't want the video visible either. Just two links (one for on, one for off, restricted so that only one shows at any time) to turn the music on and off whenever the player wants. Is this possible and if so how can it be done?

 

Please! I'm desperate!

 

P.S: If you could have a way to put it on repeat please tell me how! Thanks!

Music? Please?

9 years ago

BGM that's both controllable and persistent across pages isn't simple in HTML. The easiest method, and the one with the fewest hiccups, would be just to link the player to a YouTube video in a new tab, though that wouldn't loop and the player would have to switch to that window and manually toggle it.

To do looping, you could link the player to a document using HTML5 audio instead, but play/pause controlling would still need to be done manually. Anything more advanced would involve JavaScript, which also has to avoid cross-domain restrictions and still deal with issues involved with the player closing either of the windows.

Music? Please?

9 years ago

...We need to hunt Quiller down and make him spill his secrets...He had an item option that was basically the settings for the game. Turn on and off the pictures inserted, the background, the fancy links, and music. Becoming Legend....before he turned off the sneak preview and turned on a sneak preview for a demo in it's place.

As for the OP of the thread, this is the only thread  I could find about inserting music that might be helpful. (went back 8 years) I gotta at least try to help out if I'm going to post, right?

http://chooseyourstory.com/forums/advanced-editor-forum/message/14227

Music? Please?

9 years ago

Switching something on and off is not complicated, but depending on how freely and how smoothly you want the ability to do so incorporated, it could potentially get messy or tedious. I've never cared enough about adding music or video to look into the finer points. Also, finding Quiller is not the issue, getting a response, though... ? In fairness, though, med school is exhausting.

Music? Please?

9 years ago

Yeah; putting a song in isn't difficult, but my main concern was getting the music to continue playing even after the player is taken to a new page—which I know is possible, though it's really easy for it to be messed up. ...Although, looking back, I don't think that's what Chaotime even really asked for.

Music? Please?

9 years ago

Ahh? I'd be curious to know how you managed that. I can't see music working as well otherwise...

Music? Please?

9 years ago

The description page can contain the audio files, and since it's, in a way, linked to the the storygame window and is from the same website, the game window can control the playback of the files using the "opener" property. Something like this, though you can still see that issues arise when, for instance, one of the windows is closed.

Music? Please?

9 years ago
Or, if you wanted to get really fancy and ugly at the same time, I bet there'd be a way to make it work by putting a frame inside the main page...

Music? Please?

9 years ago

<audio controls><source src="http://www.bountyheadbebop.com/Z-Kirito.mp3" type="audio/mpeg"></audio>

Music? Please?

9 years ago

...Tempted to make an audio book game now.

Music? Please?

9 years ago

<audio controls loop> for auto-looping audio

Music? Please?

9 years ago

Oh my god thats perfect 

Music? Please?

9 years ago
WHAT HAVE YOU DONE BERKA!??!

GIVING AVERAGE PEOPLE THIS KNOWLEDGE IS TOO MUCH FOR THEM TO HANDLE!

Music? Please?

9 years ago

Yeah, but unless you are hosting your own music, you're likely to end up with a lot of broken links after a while. Most sites cut off hotlinking.

Music? Please?

9 years ago
Thanks to everyone! Sorry I haven't posted in a while. And actually, that's exactly what I was looking for... for the music to continue playing even after the player had been taken to a new page and for it to autoplay at first but have the option to turn it off. However... is there a way to autoplay one song, stop it when the player gets to a certain page and autoplay a new song on that same page (or series of pages) STILL with the option to turn it off?

Music? Please?

9 years ago
Ummm... Didn't work. I tried putting this into the Global Page Script (this exact coding that I might've messed up on >.<) %PAGETEXT := "

Music? Please?

9 years ago
Oops. Wrong code. I'm using this one: $PAGETEXT := "" And the little bar for the music shows up but the music won't play! Please HELP!

Music? Please?

9 years ago

A YouTube video won't work as the source. You'll need to use the audio file.

Music? Please?

9 years ago

You can't make music cross pages unfortunately (it will always reset when a new page is opened)

Another option, if all you have are YouTube vids for music, is to embed them in your page and set them to autoplay (or not, because a lot of music in games can be really detracting to the story). Some of these you can hide on your page, others you can't.

Music? Please?

9 years ago

The following code is "hidden" in the above post:

<iframe width="1" height="1" src="https://www.youtube.com/embed/kyFyAqLtHq8?autoplay=1" frameborder="0" allowfullscreen></iframe>

Music? Please?

9 years ago

okaaaay. It still won't work. Am I just being stupid? Here's what I've got:

 

%PAGETEXT := <audio controls loop><iframe width="1" height="1" src="https://www.youtube.com/embed/kyFyAqLtHq8?autoplay=1" frameborder="0" allowfullscreen></iframe>

 

IDK what's going on...

 

lemme try something....

okay, I think I know what the problem is. BRB

Music? Please?

9 years ago

well the music will play, but the thing is not tiny. It's the normal size. Apparently something is screwy. Here's the actual code...

 

%PAGETEXT := "<audio controls loop><iframe width='1' height='1' src='https://www.youtube.com/embed/kyFyAqLtHq8?autoplay=1' frameborder='0' allowfullscreen></iframe>"

 

the music will only play if I put this code (minus the %PAGETEXT := " ") in the source coding. Otherwise it refuses to work!

Music? Please?

9 years ago

oh, duh! Nevermind I got it to work. Thanks Berka! I'll try to figure out the rest I need on my own. And a big thanks to everyone else! :D