Hey all, so I picked up Dark Basic Pro the other day, and today I finally decided to "churn" out something, not using the tutorials, eyeballing the index of the Help when needed of course.
So I have wrote a basic "music" player that plays different songs from my collection depending on what key number you press (1,2,3,4,5,6) also have a Q key that will quit, and R key that generates a Random number and then activates that song
I know my coding isn't perfect, I am only a couple days old
I have been looking at different "ways" to layout coding etc. So here is what I have achieved in a few hours.
REM Project: My Music Player
REM Created: 2/6/2008 9:12:45 PM
REM By: Maybe123
REM ***** Main Source File *****
REM
Load Music "0150.mp3", 1 : Load Music "1703.mp3", 2 : Load Music "1709.mp3", 3 : Load Music "1720.mp3", 4
Load Music "1721.mp3", 5 : Load Music "1724.mp3", 6 : init=1 : mus#=1
remstart
This Line was used so I could see what I was to "assign" to keys I guess.
PRINT " " : PRINT " " : PRINT "Press 1,2,3,4,5,6 to choose different songs." : PRINT "Q to Quit" : PRINT "R to Randomize"
After the While Command I put in a scancode test to call in a print screen later on to Find out the Keystates.
That is to say (what Code goes with each Key - eg (Q) = 16). Added the Wait Key command so I didnt get spool spammed.
remend
while init=1 : ScancodeValue =SCANCODE()
REM Get Keystates (1-6 for Music)+(R for Random Music)+(Q to Quit) - Store which song is playing into mus#, stop on next song.
If keystate(2)=1 : Stop Music mus# : Play Music 1 : mus#=1 : endif
If keystate(3)=1 : Stop Music mus# : Play Music 2 : mus#=2 : endif
If keystate(4)=1 : Stop Music mus# : Play Music 3 : mus#=3 : endif
If keystate(5)=1 : Stop Music mus# : Play Music 4 : mus#=4 : endif
If keystate(6)=1 : Stop Music mus# : Play Music 5 : mus#=5 : endif
If keystate(7)=1 : Stop Music mus# : Play Music 6 : mus#=6 : endif
If keystate(16)=1 : Stop Music mus# : end : mus#=6 : endif
If keystate(19)=1 : Stop Music mus# : rand#=rnd(5)+1 : Play music rand# : mus#=rand# : endif
Rem Print "Key pressed: ", ScanCodeValue
Rem wait key
endwhile
I dabble in this and I dabble in that; one learns multiples skills by dabbling.