I'm trying to set up regions with different walking sounds.
so naturally i'm using the SetFrameSound function.
but, after entering the code into the regions walks onto event and trying to run the game it comes up with the error: room1.asc(9): Error (line 9): Undefined token 'SetFrameSound'
I thought this function was built into the editor. Why would it come up as an undefined token? Or is there something i'm missing here?
Which version of AGS are you using?
Neither 3.2 nor 3.2.1 have been "officially" released, but they are the only versions using the new-style audio system, which appears to be your problem.
The newest, but as-yet unofficial versions use the ViewFrame.LinkedAudio property instead of SetFrameSound. Try that.
So, how exactly can we change current frame sound with using LinkedAudio property ?
Just set the LinkedAudio property directly:
ViewFrame *frame = Game.GetViewFrame(player.View, player.Loop, player.Frame);
frame.LinkedAudio = aFootstep;
Quote from: monkey_05_06 on Tue 26/04/2011 22:22:08
Just set the LinkedAudio property directly:
ViewFrame *frame = Game.GetViewFrame(player.View, player.Loop, player.Frame);
frame.LinkedAudio = aFootstep;
I tried that but it says "cannot convert audio channel to audio clip.
LinkedAudio is an AudioClip. You assign it the value of an audio clip as set in the editor, not the AudioChannel the clip is playing on.
Hmmm you're right. I may have use it like LinkedAudio.Play. It worked with your code, thanks monkey.
You're welcome. And just to be clear:
// works!!
if (frame.LinkedAudio != null) frame.LinkedAudio.Play();
// works!!
frame.LinkedAudio = aFootstep;
// doesn't work! D:
frame.LinkedAudio = aFootstep.Play();
That last one is probably what you mistakenly did. Glad you got it working though. :)