Gamestudio Links
Zorro Links
Newest Posts
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (AndrewAMD), 3,517 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joe_kane, Namitha_NN, Syndrela, agasior, mosfet
19189 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problems with sound #211074
06/14/08 19:09
06/14/08 19:09
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Hello,

I am trying to script some sound in my simulation game. The idea is that if you touch and hold the H the sound will play. If have tried it with media_play and that did do it quite well, but when I touch the H the model suddenly runs slow. How can I fix this problem?

After that I tried it with snd_play, and I have the following code:

Code:
SOUND toeter = "toeter_PP.wav";

var toetertje;

function horn() {
	while(key_h == 1) {
		toetertje = snd_play(toeter,100,0);
		
		wait(1);
	}
}

on_h = horn();

Is there a solution to solve this problem?

Thanks in advance.

Re: Problems with sound [Re: Polypfreak1987] #211095
06/14/08 21:55
06/14/08 21:55
Joined: Jun 2007
Posts: 63
Italy
Sonic220 Offline
Junior Member
Sonic220  Offline
Junior Member

Joined: Jun 2007
Posts: 63
Italy
can be cause it's a while?
The sond must continue playing if h is hold?
can't you do in the funcion that call h insert snd_play(toeter,100,0); ?
(sorry, still noob I think it's not a help xD)


~Vision Divine~
Re: Problems with sound [Re: Sonic220] #211126
06/15/08 06:38
06/15/08 06:38
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
I tried to place the sound out of the while-loop, but that doesn't work either.

Re: Problems with sound [Re: Polypfreak1987] #211128
06/15/08 06:58
06/15/08 06:58
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
try this:
Code:
SOUND toeter = "toeter_PP.wav";

var toetertje;

function horn() {
	
	toetertje = snd_loop(toeter,100,0);		
	while(key_h == 1) {wait(1);}
	snd_stop(toetertje);
}

on_h = horn();


Re: Problems with sound [Re: kasimir] #211129
06/15/08 07:04
06/15/08 07:04
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Thank you very much, that was the key! laugh


Gamestudio download | 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