Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Akow, SBGuy), 1,423 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
really noobish snd question. #263140
04/28/09 00:21
04/28/09 00:21
Joined: Sep 2002
Posts: 199
Chicago, Illinois
Thehawk Offline OP
Member
Thehawk  Offline OP
Member

Joined: Sep 2002
Posts: 199
Chicago, Illinois
I have a sound playing inside a while loop. It causes it to play throughout. I want it to only play once though. I tried putting it into a function and then it doesn't play at all. So my question is: How can I make the sound play one time once a comparisson statement is reached?

function sndplaying
{
if (player_proxb == 1)
{
snd_play (gear_wav, 100, 0);
// wait(-1);
snd_stop(gear_wav);

}
}

I appreciate any help you can provide.

Re: really noobish snd question. [Re: Thehawk] #263146
04/28/09 00:53
04/28/09 00:53
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Im not sure what your looking for, cause what I think you want doesnt match your sample code.
Try looking at this and see if it makes sense, and it the effect you are after.
Code:
var this_sound;
while(1)     //the existing while loop you mentioned
{
   ...
   if(player_proxb==1)   //if near player (?)
   {
      if(snd_playing(this_sound)==0)   //AND sound not already running
      {
         this_sound = snd_play(gear_wav, 100, 0);   //remember snd_play DOESNT self-repeat
      }
   }
   if(snd_playing(this_sound)==0)   
   {
      snd_stop(this_sound);   //stop it "properly" when its finished itself
   }
   ...
   wait(1);
}



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1