Howdy. I'm happily working away at a set of functions for an RPG in v3, what with my last little project mysteriously managing to delete itself.
Anyway, I'm getting along with not too much trouble - well, as little as you can expect at a point where there isn't any documentation for it out yet - but I have of course hit a minor problem. Wouldn't be here if I hadn't, eh?
Anyway, the code in question that is causing me some degree of concern is the following:
(Apologies in advance for any instances of code that could probably be a lot better. I'm on the lower end of intermediate.)
void FadeOut_m()
{
int loop;
loop = 100;
while (loop > 0)
{
SetLucent(loop);
rectfill(0,0,screenx, screeny,rgb(1,1,1),screen);
ShowPage();
loop == loop-1;
if (GetSongVolume(currentmusic) > 0)
SetSongVolume(currentmusic, (GetSongVolume(currentmusic)-1));
Wait(2);
}
SetLucent(0);
FadeMusic();
}
"currentmusic" stores the music currently being played at all times.
"screenx" and "screeny" are just aliases for the height and width of the screen. They were in v2 but not v3. It would be nice to see them back, as either one is shorter to type than "ImageHeight(screen)."
Its supposed to fade to black, fading the music with it. If it isn't completely quiet by the end of the while loop, the FadeMusic() function I scripted does it immediately afterwards. This is because the user can alter the music volume in-game, so the function isn't sure what volume the music is actually at when it runs. As you can guess, it doesn't quite work.
The visual fade happens, but the audio one doesn't. So:
1. What the heck am I doing wrong?
2. Are the built-in functions I'm using fully functional?
3. Am I using aformentioned functions correctly?
4. Have I just missed something painfully obvious?
V3 is great, by the way. Very, very exciting stuff going on.