PBMAPI:AddTrack(musicTable, path, length)
Adds a track to the track list.
Parameters
- musicTable
- (string) The music table to add the track to
- path
- (string) The path to a music file
- length
- (number) The length of the music file in seconds
Return value
index (number) The index of the track, can be passed to :RemoveTrack to remove the track from the track list.
PBMAPI:GetCurrentTrack()
Returns the current music table as well as the index, path and length of the current track.
Returns nil if no track is playing.
Return values
- musicTable (string/nil) The name of the current music table. This will be nil if no music table has been set yet.
- index (number) The index of the track that's playing
- path (string) The path to track that's playing
- length (number) The length of the track that's playing
PBMAPI:GetOptionValue(option)
Returns the value of an option set in config.lua Can't be used to get a music table, all music table manipulation must be done using the API.
Parameters
- option
- (string) The name of the option
PBMAPI:GetTrackIndexByPath(musicTable, path)
Returns the index of first track with the specified path
Parameters
- musicTable
- (string/nil) The music table to search in. If this is nil, the current music table will be used.
- path
- (string) The path to search for
Return value
index (number) The index of the track
PBMAPI:GetTrackInfo(musicTable, index)
Returns the path and length of the track at index
Parameters
- musicTable
- (string/nil) The music table to search in. If this is nil, the current music table will be used.
- index
- (number) The track index to return information for
Return values
- path (string) The path to the track
- length (number) The length of the track
PBMAPI:IndicesAreSameTrack(musicTable, index1, index2)
Returns whether or not the two indices represent the same track.
Parameters
- musicTable
- (string) The music table to search in
- index1
- (number) A track index
- index2
- (number) A track index
Return value
sameTrack (boolean) true if the two indices represent the same track (or are the same), false if they represent different tracks or if either index does not correspond to a track
PBMAPI:IsPlaying()
Returns whether or not a track is currently playing.
Return value
isPlaying (boolean) true if a track is playing, false if not
PBMAPI:PlayRandomTrack(musicTable, scheduleNext)
Plays a random track.
Parameters
- musicTable
- (string/nil) The music table to play a track from. If this is nil, the current music table will be used.
- scheduleNext
- (boolean) If true, random tracks will continue to be played after this one.
PBMAPI:PlaySpecificTrack(musicTable, index, scheduleNext)
Plays the track at a specified index
Parameters
- musicTable
- (string/nil) The music table to play a track from. If this is nil, the current music table will be used.
- index
- (number) The index of the track to play
- scheduleNext
- (boolean) If true, random tracks will continue to be played after this one.
Return values
- path (string) The path of the track that was played
- length (number) The length of the track that was played
PBMAPI:RemoveTrack(musicTable, index)
Removes a track from the list.
Parameters
- musicTable
- (string) The music table to remove the track from
- index
- (number) The index of the track to remove
Return values
- path (string) The path of the track that was removed
- length (number) The length of the track that was removed
PBMAPI:StopMusic()
Stops the current track.
PBMAPI:ToPathIndex(musicTable, index)
Returns the path index of the track at the given index
Parameters
- musicTable
- index
- (number) A track index (path or length)
Return value
pathIndex (number) The corresponding path index
MusicTables
- general
- The general music table
- wild
- The wild music table
- trainer
- The trainer music table
- player
- The player music table
- victory
- The victory music table
- defeat
- The defeat music table
Facts
- Date created
- Sep 07, 2012
- Last updated
- Jan 10, 2013