I finally got a looping sound to play when it's suposed to, and stop when it's not. I had problems with my sound playing from the start of the level, and never stopping throughout the map. I have also seen several questions on the subject.
Here is what I ultimately came up with:
I used the code from the door1.fpi
:state=0,plrdistwithin=120:state=4
:state=1:incframe=0
:state=1,frameatend=0:state=2,coloff
:state=2,plrdistfurther=120:state=3,sound=$1,colon
:state=3:decframe=0
:state=3,frameatstart=0:state=0,setframe=0
:state=4,plrcanbeseen:state=1,setframe=0,sound=$0
:state=4,state=0
and changed it like this:
:state=0,plrdistwithin=300:state=4
:state=1:incframe=0
:state=1,frameatend=0:state=2
:state=2,plrdistfurther=300:state=3,loopsound=$0,soundscale=0
:state=3:decframe=0
:state=3,frameatstart=0:state=0,setframe=0
:state=4,plrcanbeseen:state=1,setframe=0,loopsound=$0,soundscale=40
:state=4,state=0
Kind of a flimsy workaround, since the sound is still looping, just inaudible, but it works for me
Hope it helps someone with this problem, or leads me to a more effecient way of doing it
It's easy not to get lost when you have no idea where you are going