I am putting in a feature in my game so that people can drop an mp3 file into the music folder in the game so they can have whatever music they want during the game. I think this is the best way to do it, but I just can't get it working at all; it keeps giving me an unrelated error further down the program. However, if I rem out the file loading stuff, it works!
Here is the relevant part of my code:
set dir "DataMusic"
find first
nummusic=0
dim music$(100)
repeat
if get file type()=0
nummusic=nummusic+1
music$(nummusic)=get file name$()
endif
find next
until get file type()=-1 or nummusic=100
if nummusic>0
for a=1 to nummusic
if file exist("DataMusic"+music$(a))
load sound "DataMusic"+music$(a),a+1000
endif
next a
endif
music=1
load object "DataModelsLogo.3ds",1:load image "DataPicturesBolt.jpg",1
texture object 1,1:make object plain 2,100,100:ghost object on 2
load image "DataPicturesLogo.jpg",2:texture object 2,2:load image "DataPicturesLightsSpark1.jpg",10
dim sparkmx#(10):dim sparkmy#(10)
for a=11 to 20
load object "DataModelsSpark.3ds",a:yrotate object a,270:fix object pivot a
texture object a,10:scale object a,7,7,7:ghost object on a:set object a,1,1,0,1,0,1,0:set object rotation zyx a:position object a,0,100,0
next a
If I leave it all 'unremed' then it gives me an 'object does not exists' error at the line where it says 'texture object a,10:scale object a,7,7,7...'. However, if I rem out all the file finding and music loading stuff, then it works fine! I just don't get it, has anyone had a problem similar to this before? There are 4 mp3s in the "DataMusic" folder, and they all work.
EDIT: Well, it was bound to happen. As soon as I give in and decide to post my question, I figure it out. I need to use the 'set dir' command again after finding files, before I load the music. But that brings up another question: How do I access the parent directory of the current directory?
EDIT #2: Well, it was bound to happen again. I figured out my last question; I will just store the current directory in a string before I change directories, then I can switch back to the original...
Xander Moser - Bolt Software - Firewall
