Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Calling a file name

Status
Not open for further replies.

Sion

Member

What I'm trying to do, is create a list of the music files in a certain folder so the player can pick one to play during battle. Sounds easy right? However, I don't know what files are in this folder because I want the player to put some of their songs in there.

So for this, I'm editing xLeD's Jukebox Script, which was probably not the best choice.

At the moment, this is the part I'm working on.

Code:
    s1 = "Song 1"
    s2 = "Song 2"
    s3 = "Song 3"
    s4 = "Song 4"
    s5 = "Song 5"
    s6 = "Back"

The script is designed so that the default songs are set up and can't be changed. What I need to do is change these so that it returns the filenames of whatever's in the folder.

So I found this in the help section:

Code:
File.basename(filename[, suffix])
This returns a filename, the problem is you have to actually the type the filename into the script to get the filename. Which is pretty much useless.

So, is there something I can add to that code so it returns the name just based on a directory and a number. So... first file from music folder, or second file or whatever?
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top