dealing with unsuccessful music/sound calls

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

dealing with unsuccessful music/sound calls

Post by Roody_Yogurt »

You can always check display.hasgraphics to see if the current interpreter supports graphics. There isn't really a comparable function for audio. Now, most multimedia Hugo games don't acknowledge the fact that music/sound is supposed to be playing, but if a game does, it looks pretty stupid if the terp can't actually play sound/music.

In The Next Day, I just had a is-this-a-simple-interpreter? check before I ask the player if they'd like to play music. What I didn't realize is that terps like the graphical DOS terp aren't simple terps (by Hugo standards) but can only play certain types of music (Guilty Bastard's mods work fine, but my MIDI file in The Next Day or CHUMS' music don't seem to work).

Looking into the issue, it looks like the terp does set the system_status global to true if a music call is unsuccessful. This is used by PlayMusic to determine whether or not the routine returns true or false. You can check for either of these things before you go and print something.

Of course, you wouldn't want to play music before you ask "do you want to play music?", so I'm thinking, if I were to do this in the future, I would include in my resource file a second long file of the type I'll be playing, but it'll be silent so the game can test whether or not that file type works and act accordingly. I already have a silent midi file I picked up somewhere. An mp3 or wav would be easy to make, and I imagine everything else is possible, too.

This is probably an issue that won't come up for anyone else, but I wanted to share this workaround.