You need to call GetSongBackground() on a Song object, which you generally get from GAMESTATE. The magic incantation is GAMESTATE:GetCurrentSong():GetSongBackground(). oops. GetSongBackground() is global, you'd use it like so: LoadActor(GetSongBackground()). The other option (no built in fallback) is GAMESTATE:GetCurrentSong():GetBackgroundPath() as the argument for LoadActor.
Here's some examples that should work (loads image and makes it invisible first thing, then fades in when a judgment happens)
Code:
local container = Def.ActorFrame {}
local background = LoadActor(GetSongBackground())
function background:InitCommand(params)
self:diffusealpha(0.0)
end
function background:JudgmentMessageCommand(params)
self:linear(0.5)
self:diffusealpha(1.0)
end
table.insert(container, background)
return container
(same thing, written another way)
Code:
local t = Def.ActorFrame {}
t[#t+1] = LoadActor(GetSongBackground())..{
InitCommand=cmd(diffusealpha,0),
JudgmentMessageCommand=cmd(linear,0.5;diffusealpha,1.0)
}
return t
or the simplest example:
Code:
return LoadActor (GetSongBackground())..{
InitCommand=cmd(rainbow)
}
Make sure the default.lua file is in a folder, or it will most likely not work at all.
EDIT: my lua-fu is bad, fsx has informed me that GetSongBackground() is a global function, I was thinking GAMESTATE:GetCurrentSong():GetBackgroundPath().
Plugging the different method in should work just the same unless the background image is missing.
Also note, FSX's method using LoadFromCurrentSongBackground might work if this stuff doesn't.