ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.15k stars 2.22k forks source link

Read the Current Song #15925

Open MarkAwesomeness opened 1 day ago

MarkAwesomeness commented 1 day ago

What is your question?

Is there some sort of way to read the current song from a file or something? For example, like how Discord Rich would output the song title and current timestamp of the song. Is there a way to access that?

Shiho-cmd commented 1 day ago

you can use songName in a lua script to get the song name if that's what you want

but if you want to get the name from a file you can use getTextFromFile to get the contents of a txt file

here's an example with both!!!

function onCreate()

    -- it creates a text in the center of the screen with the current song name
    makeLuaText("name", songName, 0, 0, 0)
    setTextSize("name", 30)
    screenCenter("name", "xy")
    addLuaText("name")

    -- same thing but getting it from a file instead
    makeLuaText("nameFile", getTextFromFile("data/epicSongName.txt"), 0, 0, 0)
    setTextSize("nameFile", 30)
    screenCenter("nameFile", "xy")
    addLuaText("nameFile")
end
MarkAwesomeness commented 1 day ago

The second option doesn't function for me. Is there a specific file that it's supposed to reference, or is it epicSongName.txt?

Shiho-cmd commented 1 day ago

The second option doesn't function for me. Is there a specific file that it's supposed to reference, or is it epicSongName.txt?

The data/epicSongName.txt is the path of the txt file so on the example there should be a txt file on the data folder with the "epicSongName" name but the file name here is just an example you can put anything you want and put the txt wherever you want too