Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DarkBasic Pro offroadtemplate

Author
Message
Guncannon18
15
Years of Service
User Offline
Joined: 21st Dec 2010
Location:
Posted: 21st Dec 2010 14:54
Hello I'm currently working on a DarkBasic Pro project in my high school where im using the offroadtemplate to create an educational video game. We are required to have 2 levels in our game. I am able to get 2 levels to work by having 2 main sections, with the end of my first main section leading into my second main section. My problem is the sound for my pickups in the game. My load sound command is at the bottom of my code where the map is loaded. Every time I try to pick up an object in my second main section I get an error that sound already exists at my loadsound command. This error is also evident in the original offroadtemplate where if you attempt to play the game again you will get the same message. Help would be much appreciated.
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 21st Dec 2010 16:59
Just check if the sound already exists before loading it, like this:



That should fix it.

Cheers

SLAYER RULES! YEAH, MAN!!
Guncannon18
15
Years of Service
User Offline
Joined: 21st Dec 2010
Location:
Posted: 3rd Jan 2011 14:45


This is my code, could you help me find where I would need to alter the code?
Guncannon18
15
Years of Service
User Offline
Joined: 21st Dec 2010
Location:
Posted: 3rd Jan 2011 15:20
My error is runtime error 3003 at the loadsound line near the bottom
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 3rd Jan 2011 15:23
Here you go, this should fix it.
I think you'll probably need to do this for your images, models and other media too. This way, the file will only be loaded if it hasn't been loaded yet.



Cheers

SLAYER RULES! YEAH, MAN!!
Guncannon18
15
Years of Service
User Offline
Joined: 21st Dec 2010
Location:
Posted: 4th Jan 2011 14:34
OMG!!!Thank you so much for all the help, my game finally runs with sound so I should get it completed in time for a grade. Again THANK YOU SO MUCH!!!!
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 4th Jan 2011 18:39
No worries, Guncannon18. Glad I could help.

Cheers

SLAYER RULES! YEAH, MAN!!

Login to post a reply

Server time is: 2026-07-17 18:54:24
Your offset time is: 2026-07-17 18:54:24