Gamestudio Links
Zorro Links
Newest Posts
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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
if(snd_playing)bug? #328941
06/16/10 08:57
06/16/10 08:57
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline OP
User
badapple  Offline OP
User

Joined: Apr 2006
Posts: 624
DEEP 13
if(snd_playing) does not seem to work in a7 free 7.85.4

i create a sound with a handle like so in the players action

var walk_handle = snd_loop(yada,yada,yada);

and inside a while loop if i code

if(key_w)
{
snd_start(walk_handle);
}
else
{
snd_pause(walk_handle);
}

it works but if i code

if(key_w)
{
if(snd_playing(walk_handle)!=1)snd_start(walk_handle);
}
else
{
if(snd_playing(walk_handle)==1)snd_pause(walk_handle);
}

it does not

Re: if(snd_playing)bug? [Re: badapple] #328942
06/16/10 09:19
06/16/10 09:19
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
A little user quiz: Who can help badapple?

Re: if(snd_playing)bug? [Re: jcl] #328945
06/16/10 09:33
06/16/10 09:33
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
the return value is not 1 and 0... it returns:
Quote:

0 if a sound with this handle isn't playing, A7.82 otherwise the current play position within the sound buffer in bytes.


therefor, change your while to:
Code:
if(key_w)
{
	if(snd_playing(walk_handle) == 0) snd_start(walk_handle);
}
else
{
	if(snd_playing(walk_handle) > 0) snd_pause(walk_handle);
}



What did I win in this quiz grin?


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: if(snd_playing)bug? [Re: Helghast] #328948
06/16/10 10:12
06/16/10 10:12
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline OP
User
badapple  Offline OP
User

Joined: Apr 2006
Posts: 624
DEEP 13
@heghast , go to the head of the class! smile
@jcl , maybe we can change my screen name to dumbass smile

see that there was a bug , but in my brain. thanks for the correction.




Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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