Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (AndrewAMD), 1,486 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 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 | 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