Post #1 · Posted at 2015-06-12 04:36:23pm 8.8 years ago
MadkaT | |
---|---|
Member | |
820 Posts | |
Not Set | |
Reg. 2009-11-24 | |
Hello friends, I was wondering how could I create a conditional screen in SM5? I want to create the special ending in SM5 and the shock arrows warning, the conditions are final result in AA or better and a song with mines, but how do I do this? I create the screens in the metrics, but how could SM5 check if the screen meets the conditions to show? Or how can I handle this. Thanks.
Post #2 · Posted at 2015-06-12 05:04:34pm 8.8 years ago
Kyzentun | |
---|---|
Member | |
3,209 Posts | |
Reg. 2008-02-20 | |
"I'm honestly pissed off." |
Each screen has a NextScreen metric and a PrevScreen metric.
You can set these metrics to call lua functions, and then create the lua functions in a file in Scripts. The lua function must return a string that is a valid name for a screen.
For clarity, the default themes use the Branch table to store all the functions they use to control what screen comes next.
If you look at the metrics for ScreenGameplay, you can see that it calls Branch.AfterGameplay. Then you go look at _fallback/Scripts/02 Branches.lua, and you see that it has a function named AfterGameplay. The AfterGameplay function checks a setting in the players' profiles, and sends them off to ScreenHeartEntry if appropriate. Otherwise, it calls Branch.EvaluationScreen to decide where to go. Branch.EvaluationScreen checks whether the game is in online mode, and returns either ScreenNetEvaluation or ScreenEvaluationNormal.
You can set these metrics to call lua functions, and then create the lua functions in a file in Scripts. The lua function must return a string that is a valid name for a screen.
For clarity, the default themes use the Branch table to store all the functions they use to control what screen comes next.
If you look at the metrics for ScreenGameplay, you can see that it calls Branch.AfterGameplay. Then you go look at _fallback/Scripts/02 Branches.lua, and you see that it has a function named AfterGameplay. The AfterGameplay function checks a setting in the players' profiles, and sends them off to ScreenHeartEntry if appropriate. Otherwise, it calls Branch.EvaluationScreen to decide where to go. Branch.EvaluationScreen checks whether the game is in online mode, and returns either ScreenNetEvaluation or ScreenEvaluationNormal.
Post #3 · Posted at 2015-06-12 08:54:59pm 8.8 years ago
MadkaT | |
---|---|
Member | |
820 Posts | |
Not Set | |
Reg. 2009-11-24 | |
Ohh I see, then I have to create a New Branch on my theme folder and assing it on the metrics. Thanks, I will try, if I have troubles I will come back again.
Post #4 · Posted at 2015-06-12 09:23:39pm 8.8 years ago
Kyzentun | |
---|---|
Member | |
3,209 Posts | |
Reg. 2008-02-20 | |
"I'm honestly pissed off." |
Just be careful not to replace the Branch table that is used by all the logic in the _fallback theme. Put your branching logic in your own table with a different name.