Can't Even Get Music To Play

Started by helpessfool, Fri 24/06/2016 01:35:33

Previous topic - Next topic

helpessfool

I must be the world's biggest idiot, because I seemingly can't find a real explanation for how to add music. Just add "aYourmusictitle.Play()" they say.

OK... and? I try stuff like this:

Code: ags

function room_FirstLoad()
{
  aBeaks.Play();
}


And nothing ever happens. I've tried Room_AfterFadeIn. Everything. And yes - I have "aBeaks" in my music folder.

I want to flip my desk over right now. Why is this basic feature so obscure? How dumb am I?

Crimson Wizard

#1
The script is generally correct, there should be something else.

Quote from: helpessfool on Fri 24/06/2016 01:35:33And yes - I have "aBeaks" in my music folder.
Checking just in case: what do you mean by "folder" - the folder on disk, or project tree in the editor?

Then, first thing to check if that function room_FirstLoad is really called. Like, put "Display("I am here!");" there. If you see this message upon room loaded, that means that function is correctly registered in the room events.

Other things that worth investigating:
* Sound volume. Do you set/change it anywhere in the game? What option chosen in the setup for the sound and music?
* Rare case, but still possible: using MP3 audio with engine version that has no MP3 support.

Snarky

Another possibility: In the past there's been problems with clips that are quite short, or that have a specific file size, which wouldn't play at all. I think this has been fixed, but depending on your engine version that might be an issue. (To test whether that's the case, just try with another, long audio clip.)

helpessfool

Thanks for the help!

Crimson Wizard: The audio file is under the music "folder" in the project tree.

I tried "Display("Pretty please");" and had no luck, so I guess something isn't registering. This is my first "room." I'm just doing a basic functionality test. I imported some graphics and have a character walking around with a successfully defined walkable area. That's about it. I'm using the "default game" template and haven't messed with it much. There's literally only one room, so I couldn't be editing the wrong script (as far as I can tell).

I've noticed on YouTube comments, other people are having similar problems over the last year or so. We're missing something big, but I don't know exactly what it is.

Snarky: I tried a longer clip, to no avail.

Crimson Wizard

#4
Quote from: helpessfool on Fri 24/06/2016 16:04:28
I tried "Display("Pretty please");" and had no luck, so I guess something isn't registering.
This is probably the reason.

When you are adding functions for room events (such as "On Load", "After Fade-in", etc), you need to register them on the room's property pane.
Open your room in the editor, then look at the Properties pane on the right side. There will be "lightning" icon. Press it to switch to the Events tab. There you will see a list of predefined events for this room. Make sure your function name is in the "First time enters room" line.

Working with events is explained in the video tutorial here: https://youtu.be/_lghOGrET2A?list=PL21DB402CB4DAEAEF&t=182

helpessfool

Wow. It works now. Thanks! You're the best.

My user name really checked out this time. A "helpless fool." I guess I dove in too fast. I thought if you knew what script to write, the game would just process it. Good to know. I assumed the properties pane was just there to help.

Boy, with a careless attitude like mine, how will I ever create a complete game with this program? I'd better get it together!

Crimson Wizard

Quote from: helpessfool on Fri 24/06/2016 16:38:37
I thought if you knew what script to write, the game would just process it. Good to know. I assumed the properties pane was just there to help.

AGS is somewhat inconsistent in that, there are events that has to be registered, and you can use any custom function name for them; and yet there are events that just use predefined function name, so when you create such function in script it "hooks up"  automatically.
The latter are mentioned here: http://www.adventuregamestudio.co.uk/wiki/Predefined_global_script_functions

Snarky

It's a very common beginner's mistake, and something I sometimes forget about myself, if I haven't used AGS for a while. I'm sure you'll get the hang of the basics soon enough.

Quote from: helpessfool on Fri 24/06/2016 16:38:37
My user name really checked out this time. A "helpless fool."

I can't resist pointing out that your username is actually "helpessfool", without the second L. (laugh)

SMF spam blocked by CleanTalk