Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 831 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
sound keeps looping #94698
10/16/06 02:50
10/16/06 02:50
Joined: Jun 2004
Posts: 244
michigan
abbicon Offline OP
Member
abbicon  Offline OP
Member

Joined: Jun 2004
Posts: 244
michigan
I have a WAV file that i want to play once, but when i load the sound in WED and build and run my level it continues to loop. I have looked at my main WDL file with SED and i have right clicked on the speaker icon in WED but i cant seem to find where to set this to only play once.. any help is appreciated.

Thanks Jeff


"I'm the doctor." "Doctor who ?" "Exactly!"
Re: sound keeps looping [Re: abbicon] #94699
10/17/06 17:09
10/17/06 17:09
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
snd_loop(mysound,100,0);

->


snd_play(mysound,100,0);

if this is not the error:

you start the sound again and again by some other function.

Re: sound keeps looping [Re: abbicon] #94700
10/17/06 17:10
10/17/06 17:10
Joined: Jun 2006
Posts: 36
M
MichaelSoko Offline
Newbie
MichaelSoko  Offline
Newbie
M

Joined: Jun 2006
Posts: 36
Sorry my english is not perfect (<< German user) but i'll try my best!

First of all, don't add sounds in WED. Try to do it with scripting.

snd_loop for endless sound-loops and

snd_play for playing it once.

Re: sound keeps looping [Re: abbicon] #94701
10/17/06 19:12
10/17/06 19:12
Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
anonymous_alcoho Offline
Senior Developer
anonymous_alcoho  Offline
Senior Developer

Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
In the script, use a handle.

Example:

Code:

function playSomeSound()
{
if(snd_playing(mySnd) != 1)
{
mySnd = snd_play(aSound,25,0);
}
else
{
return;
}
}



Now everytime playSomeSound() is called, it first checks if the sound is playing (snd_playing). If not, it plays the sound. If the sound is playing, it simply returns.


"Oh no, it's true! I'm a love magnet!" Calvin from Calvin and Hobbes My name's Anonymous_Alcoholic.
Re: sound keeps looping [Re: anonymous_alcoho] #94702
10/18/06 21:52
10/18/06 21:52
Joined: Jun 2004
Posts: 244
michigan
abbicon Offline OP
Member
abbicon  Offline OP
Member

Joined: Jun 2004
Posts: 244
michigan
guys thanks for the help, I however cant code at all. where do i place these lines of code and how do i call them. This is another example of my frustration with this software, If i shouldnt add sounds in WED then why can I ? and if there is a better or more effective way to do it why cant i find it in the documentation ? this is the stuff that drives me nuts, i'ts not like what i am asking is an unusual request. I have a static model that i want to play a sound when the player is near but only once per level, so i waste my time adding the sound through WEd and then trying to figure out why it wont work. ATTENTION CONITEC: COMMON THINGS LIKE THIS SHOULD BE ADDRESSED IN THE MANUAL AS SHOULD MOST OF THE ISSUES ADDRESSED IN "STARTING WITH GAMESTUDIO" IF YOU GO BACK THROUGH THE ARCHIVED PAGES I AM SURE YOU WILL FIND MANY PEOPLE ASKING THE SAME QUESTIONS OVER AND OVER (SLIDING DOORS, CLIMBING LADDERS ETC.)- DONT RELY ON THE COMMUNITY TO ANSWER THESE I WANT ANSWERS FROM THE PEOPLE I PAID MY MONEY TO. Dont get me wrong This is the best on-line community that i have ever been involved with but 1 problem could have 3 different solutions and all may not work in a given situation. I want the people that wrote the engine and developed the templates to address these issues so that you can truely make a game without coding. When i first started with A4 I ran into some of the same issues (common game element couldnt be implemented I.E. climbing ladders and couldnt find any help in the manual at all.) this is even more frustrating because WED lets me load and add sounds but apparently it has to loop continuosly if that is the case then the manual should say "If you want ambient sound in your level you can add a looping .WAV file that will play in the background, however if you would like the sound not to loop you need to add it with code and if you dont know how to code sell your game only to deaf people - have a nice day!" rant officially over.

Last edited by abbicon; 10/18/06 22:18.

"I'm the doctor." "Doctor who ?" "Exactly!"
Re: sound keeps looping [Re: abbicon] #94703
10/19/06 02:15
10/19/06 02:15
Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
anonymous_alcoho Offline
Senior Developer
anonymous_alcoho  Offline
Senior Developer

Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
The code I gave you technically isn't a loop, it was just an example to show how snd_playing() worked. However, everything you need to know about sounds, loops and such are in the manual. I learned from the manual and this forum and the occasional tutorial.

Code:

function playBgMusic()
{
while(1)
{
if(snd_playing(mySnd) != 1)
{
mySnd = snd_play(mySnd,50,0);
}
wait(1);
}
}




Call it in function main.


"Oh no, it's true! I'm a love magnet!" Calvin from Calvin and Hobbes My name's Anonymous_Alcoholic.

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