SetFrameSound not working

Started by stepsoversnails, Fri 25/03/2011 18:34:02

Previous topic - Next topic

stepsoversnails

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?

monkey0506

#1
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.

proximity

So, how exactly can we change current frame sound with using LinkedAudio property ?
Proximity Entertainment

monkey0506

Just set the LinkedAudio property directly:

Code: ags
ViewFrame *frame = Game.GetViewFrame(player.View, player.Loop, player.Frame);
frame.LinkedAudio = aFootstep;

proximity

Quote from: monkey_05_06 on Tue 26/04/2011 22:22:08
Just set the LinkedAudio property directly:

Code: ags
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.
Proximity Entertainment

monkey0506

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.

proximity

Hmmm you're right. I may have use it like LinkedAudio.Play. It worked with your code, thanks monkey.
Proximity Entertainment

monkey0506

You're welcome. And just to be clear:

Code: ags
// works!!
if (frame.LinkedAudio != null) frame.LinkedAudio.Play();


Code: ags
// works!!
frame.LinkedAudio = aFootstep;


Code: ags
// doesn't work! D:
frame.LinkedAudio = aFootstep.Play();


That last one is probably what you mistakenly did. Glad you got it working though. :)

SMF spam blocked by CleanTalk