Forums » General StepMania » auto advance to next screen with lua?

1
I'm making a stepmania theme and it uses a video for a game over screen. How to I go back to the main screen (Like simulating the enter key) after the video ends?

I also need some help with the Options screen... It's loading the video I use for my game select screen along with the background I use for the options screen and displaying them both at once.

Last edited: 15 February 2015 6:39pm

Reply
If you look in Docs/Luadoc/Lua.xml, you'll find the function StartTransitioningScreen under ScreenWithMenuElements. You can use that to make the screen start transitioning, and if you use the "SM_GoToNextScreen" message, it'll go to the next screen.
I have this function that I use everywhere in my theme for changing to a different screen:

function trans_new_screen(name)
SCREENMAN:GetTopScreen():SetNextScreenName(name)
:StartTransitioningScreen("SM_GoToNextScreen")
end


For the background problem, I'd have to see the actual theme to figure out why it's loading both videos.
< cybik> til Kyzentun fixes bugs for breakfast
--
< maxvg1> shakesoda: then why do i still play lol
<@shakesoda> because you're an ITG player. And thus, a masochist
--
<@shakesoda> Kyzentun: I think you might need to put down the meshes for a bit
Reply
But that doesn't handle when the video ends, does it? Don't I need a timer or something?

...sorry, I don't know lua

Last edited: 22 February 2015 2:31pm

Reply
Well, then you're in for a long road of experimenting and reading Lua.xml and lua.org and the Docs/Themerdocs folder and asking questions until you gradually understand how things work.
If you don't understand the core language of lua, you're better off reading stuff on lua.org, like the first edition of the Programming In Lua book, rather than asking questions on forums, because the writers of that book are better at explaining than random people on the internet.

Here's an example of a screen that loads some image into a sprite (which can also be any supported video format), and waits some amount of time before transitioning.


return Def.ActorFrame{
Def.Sprite{
Texture= THEME:GetPathG("", "some_movie"), OnCommand= function(self)
local movie_length= 15
self:xy(_screen.cx, _screen.cy):sleep(movie_length):queuecommand("End")
end,
EndCommand= function(self)
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenTitleMenu")
:StartTransitioningScreen("SM_GoToNextScreen")
end
}
}
< cybik> til Kyzentun fixes bugs for breakfast
--
< maxvg1> shakesoda: then why do i still play lol
<@shakesoda> because you're an ITG player. And thus, a masochist
--
<@shakesoda> Kyzentun: I think you might need to put down the meshes for a bit
Reply
I can't figure it out... This is my code. intro is a sound effect, and background is a video. All I get is "graphic missing" and "attempt to index a nil value"

return Def.ActorFrame {

LoadActor("intro")..{
OnCommand=cmd(play);
};
Def.Sprite{
Texture= THEME:GetPathG("", "background"), OnCommand= function(self)
local movie_length= 5
self:xy(_screen.cx, _screen.cy):sleep(movie_length):queuecommand("End")
end,
EndCommand= function(self)
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenTitleMenu")
:StartTransitioningScreen("SM_GoToNextScreen")
end
}
}
Reply
Stepmania only supports the following video formats: avi, f4v, flv, mkv, mp4, mpeg, mpg, mov, ogv, webm, wmv

The video would have to be in your Graphics folder for the above code to find it.

Are you using 5.0.6? The above code uses function chaining, which was added in 5.0.5.
< cybik> til Kyzentun fixes bugs for breakfast
--
< maxvg1> shakesoda: then why do i still play lol
<@shakesoda> because you're an ITG player. And thus, a masochist
--
<@shakesoda> Kyzentun: I think you might need to put down the meshes for a bit
Reply
That explains it. I was still on Beta 4a.

Thanks, it works great!
Reply