Recently, working on a game in AGS, I wanted to implement audio, such as background music (ambient) and some voice tests. Focusing on Ambient music,
I did:
function room_AfterFadeIn()
{
PlayAmbientSound(0, 1, 50, 0, 0);
}
But as I was typing "PlayAmbientSound", nothing came up in the 'suggestion' box (for scripting. As you are typing. e.g. if you type "cyourcharacter" it would bring up a list of variables, etc.). And after compiling it:
Failed to save room room1.crm; details below
room1.asc(41): Error (line 41): Undefined token 'PlayAmbientSound'
Same thing happens with PLAY and pretty much anything relevant to playing audio. Help! I'm using the latest version of AGS running in Windows XP.
The audio system was overhauled as of version 3.2.
Import the sound file into the project tree, then use this:
AudioChannel*ac = aAmbient.Play();
ac.Volume = 50;
ac.SetPosition(x, y);
Also check "AudioChannel" and "AudioClip functions and properties" topics in the manual (in the "Scripting" category).
"Upgrading to AGS 3.2" topic (in the manual contents root) might be helpful as well.
Thanks you guys! I implemented it with:
aSomesongname.Play();
Now I can start finishing that map. e.e 'Special Effects' help a lot. :-)
Thanks!
- Ean