Gamestudio Links
Zorro Links
Newest Posts
webGL
by Ice2642. 11/17/25 21:27
Camera always moves upwards?
by NeoDumont. 11/17/25 09:56
Future of ZorroHFT
by TipmyPip. 11/16/25 13:52
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Training with the R bridge does not work
by Petra. 11/15/25 09:31
Zorro 2.70
by jcl. 11/15/25 08:43
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (AndrewAMD), 7,596 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
tritom, sheliepaley, Blueguy, blobplayintennis, someone2
19178 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