Gamestudio Links
Zorro Links
Newest Posts
Zorro strategy fails to run
by Lapsa. 12/06/26 17:32
ZorroGPT
by mistery. 12/05/26 12:48
contractUpdate() is filtering if >2 rows
by mistery. 12/04/26 19:03
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Lapsa, Quad), 2,483 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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