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.

Newcomers DBPro Corner / storing sounds in variables

Author
Message
Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 4th May 2004 15:56
okie am learning darkbasic and I am familar with coding but is it possible to store data in a variable like
Monstersound1 = "Cry.wav"
Play sound Monstersound1
?
or is there another way of doing this?

A 1 man team
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 4th May 2004 16:26
load sound "x.wav",1
play sound 1

see the help files, they help


* DBP_NETLIB_v1 - PLUGIN FOR DBP * Click LogoMooooooo!
FROGGIE!
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 4th May 2004 16:29
really you should load a sound and set it as a number:

LOAD SOUND "cry.wav",1

monstersound1# = 1

PLAY SOUND monstersound1#

or better still, skip the variable bit and just remember numbers:

LOAD SOUND "cry.wav",1

PLAY SOUND 1

I should have changed my signature when asked
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 4th May 2004 17:01



* DBP_NETLIB_v1 - PLUGIN FOR DBP * Click LogoMooooooo!
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 4th May 2004 18:06
@FROGGIE!
Quote: "LOAD SOUND "cry.wav",1

monstersound1# = 1

PLAY SOUND monstersound1#

or better still, skip the variable bit and just remember numbers:

LOAD SOUND "cry.wav",1

PLAY SOUND 1
"


Your way is not very reliable. First of all, you are storing the sound number in a float variable. Load sound uses string,integer parameters. So using a float variable could result in errors/crashes. (1.000 in a float variable could be stored as 0.9999)

@Oneka production
Just grab a piece of paper and write down the numbers and their description. That's easier (you dont have to remember the variable-names) and if you want to load new media you can see which numbers are free.

Quote: "
UPDATED

Amd 2800+ 1024mb pc3200 A7N8X - Deluxe Ati Radeon 9800PRO 256mb
"
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 4th May 2004 19:41
Emperor Baal is correct, also aim to use as few variables as possible and if you do use variables, make them as short as possible.

Login to post a reply

Server time is: 2024-09-22 08:44:27
Your offset time is: 2024-09-22 08:44:27