Logo

GetCurrentCombo command help

Register Log In Back To Forums

Post #1 · Posted at 2020-05-10 04:15:47pm 3.9 years ago

Offline ECas1995
ECas1995 Avatar Member
4 Posts
Not Set
Reg. 2020-05-10

Hi! I need some help on a lua script. (I'm using Stepmania 5)

Here is my code:

https://i.imgur.com/1KisGPL.jpg

local combo_condition = STATSMAN:GetCurStageStats():GetPlayerStageStats(0):GetCurrentCombo() == 0;

local function optional_actor(cond, actor)
if cond then return actor end
return Def.Actor{}
end

local t = Def.ActorFrame{};

t[#t+1] = Def.ActorFrame{
optional_actor(combo_condition,LoadActor( "./GA.lua" )..{});
};

return t;


I want to replicate the gimmick in DDR games, that when you reach a certain combo (In this case, 100) it will load an Actor (In this case is an image) (In this case I'm using it as a FGChange at second 0:00:00)

Ironically, it works, but only when GetCurrentCombo == 0. I only can think that it's because when the FGChange is loaded, the current combo is 0, that's why it works. But when I reach como 100 nothing happen because the FGChange already read that the combo was 0.

My question is, Is there some way to make the FGChange reads the combo in "real time" so when I get combo 100 it will load the actor I need? I don't know that much of Lua scripting so maybe there is something like a "for" function that let me do it, but nothing I've tried works. Sad

Thanks in advance. Big Grin

Post #2 · Posted at 2020-05-10 07:59:00pm 3.9 years ago

Offline ZTS
ZTS Avatar Member
139 Posts
Not Set
Reg. 2015-01-13

"But enough talk! Have at you!"

Last updated: 2020-05-10 08:12pm
You can add an actor in real time but that would be less efficient than just loading it and keeping it inactive/hidden until you reach 50 or 100 combo, since loading takes some amount of CPU cycles to parse the file. The ActorFrame class has a function called "AddChildFromPath" that does exactly what you want, though.

This is what I did to check in real time. img is just the name of a file but you can load anything you want. pn is the name of a player.
https://arcofswords.s-ul.eu/sojYnLpS.png

Alternatively if you're trying to display something above the judgment or combo text you should modify player judgment or player combo instead, because ComboCommand has the current combo has a parameter. But I assume in this case you are limited to using the FGChanges of a simfile and not a theme file.
Get Rave It Out! https://sites.google.com/view/riodevs/home
Want your theme made? I take commissions, PM for details.

Post #3 · Posted at 2020-05-10 09:36:14pm 3.9 years ago

Offline ECas1995
ECas1995 Avatar Member
4 Posts
Not Set
Reg. 2020-05-10

Quote: ZTS
You can add an actor in real time but that would be less efficient than just loading it and keeping it inactive/hidden until you reach 50 or 100 combo, since loading takes some amount of CPU cycles to parse the file. The ActorFrame class has a function called "AddChildFromPath" that does exactly what you want, though.

This is what I did to check in real time. img is just the name of a file but you can load anything you want. pn is the name of a player.
https://arcofswords.s-ul.eu/sojYnLpS.png

Alternatively if you're trying to display something above the judgment or combo text you should modify player judgment or player combo instead, because ComboCommand has the current combo has a parameter. But I assume in this case you are limited to using the FGChanges of a simfile and not a theme file.

Thanks! I'll try with your code to see if It works. Do you have any example of using "AddChildFromPath"? I've searching on internet but no luck. Sad

Post #4 · Posted at 2020-05-10 09:43:45pm 3.9 years ago

Offline ZTS
ZTS Avatar Member
139 Posts
Not Set
Reg. 2015-01-13

"But enough talk! Have at you!"

Last updated: 2020-05-10 09:46pm
Quote: ECas1995
Quote: ZTS
You can add an actor in real time but that would be less efficient than just loading it and keeping it inactive/hidden until you reach 50 or 100 combo, since loading takes some amount of CPU cycles to parse the file. The ActorFrame class has a function called "AddChildFromPath" that does exactly what you want, though.

This is what I did to check in real time. img is just the name of a file but you can load anything you want. pn is the name of a player.
https://arcofswords.s-ul.eu/sojYnLpS.png

Alternatively if you're trying to display something above the judgment or combo text you should modify player judgment or player combo instead, because ComboCommand has the current combo has a parameter. But I assume in this case you are limited to using the FGChanges of a simfile and not a theme file.

Thanks! I'll try with your code to see if It works. Do you have any example of using "AddChildFromPath"? I've searching on internet but no luck. Sad
For the theme I worked on it is used for the noteskin preview in the OptionsList.
Because you cannot pass parameters when using AddChildFromPath the variable is global and then read again from Noteskin.lua.
(Actually this code was contributed by Jousway, I don't use AddChildFromPath. But I think it's the only way to load/unload noteskins on the fly.)

https://github.com/RhythmLunatic/raveitout/blob/master/BGAnimations/ScreenSelectMusic%20overlay/default.lua#L538L574
Get Rave It Out! https://sites.google.com/view/riodevs/home
Want your theme made? I take commissions, PM for details.

Post #5 · Posted at 2020-05-12 02:17:43pm 3.9 years ago

Offline ECas1995
ECas1995 Avatar Member
4 Posts
Not Set
Reg. 2020-05-10

Quote: ZTS
Quote: ECas1995
Quote: ZTS
You can add an actor in real time but that would be less efficient than just loading it and keeping it inactive/hidden until you reach 50 or 100 combo, since loading takes some amount of CPU cycles to parse the file. The ActorFrame class has a function called "AddChildFromPath" that does exactly what you want, though.

This is what I did to check in real time. img is just the name of a file but you can load anything you want. pn is the name of a player.
https://arcofswords.s-ul.eu/sojYnLpS.png

Alternatively if you're trying to display something above the judgment or combo text you should modify player judgment or player combo instead, because ComboCommand has the current combo has a parameter. But I assume in this case you are limited to using the FGChanges of a simfile and not a theme file.

Thanks! I'll try with your code to see if It works. Do you have any example of using "AddChildFromPath"? I've searching on internet but no luck. Sad
For the theme I worked on it is used for the noteskin preview in the OptionsList.
Because you cannot pass parameters when using AddChildFromPath the variable is global and then read again from Noteskin.lua.
(Actually this code was contributed by Jousway, I don't use AddChildFromPath. But I think it's the only way to load/unload noteskins on the fly.)

https://github.com/RhythmLunatic/raveitout/blob/master/BGAnimations/ScreenSelectMusic%20overlay/default.lua#L538L574

Hi again, sadly I can't get it work. I used your code example, but no luck. Sad

Post #6 · Posted at 2020-05-12 03:23:16pm 3.9 years ago

Offline ZTS
ZTS Avatar Member
139 Posts
Not Set
Reg. 2015-01-13

"But enough talk! Have at you!"

Last updated: 2020-05-12 03:27pm
I can't exactly diagnose your code without seeing what it looks like. Are you using an ActorFrame and not an actor? And you have ComboChangedMessageCommand and params?

I've never attempted to do it from FGChanges so in all honesty it might not work or the path may require something like getting the current directory of the song.
Get Rave It Out! https://sites.google.com/view/riodevs/home
Want your theme made? I take commissions, PM for details.

Post #7 · Posted at 2020-05-15 12:08:43pm 3.9 years ago

Offline ECas1995
ECas1995 Avatar Member
4 Posts
Not Set
Reg. 2020-05-10

Quote: ZTS
I can't exactly diagnose your code without seeing what it looks like. Are you using an ActorFrame and not an actor? And you have ComboChangedMessageCommand and params?

I've never attempted to do it from FGChanges so in all honesty it might not work or the path may require something like getting the current directory of the song.

I'm so sorry, I was really busy with other projects. Sad

Here's my code.

https://i.imgur.com/uQSg3D9.jpg

I've seen some examples of doing it in FGChanges, like in Mawaru charts, and it seems to work, but I can't manage them work on my chart.

This is an example I found, but got no luck.

https://i.imgur.com/Hm8XnV7.jpg

Post #8 · Posted at 2020-05-15 04:04:13pm 3.9 years ago

Offline ZTS
ZTS Avatar Member
139 Posts
Not Set
Reg. 2015-01-13

"But enough talk! Have at you!"

Last updated: 2020-05-15 04:06pm
Your issue might just be that you need to add sleep,999 to the OnCommand of the ActorFrame since you are loading it in the beginning, try that.

FGChanges is not displayed unless there's a tween active.

(I should have mentioned it earlier but it slipped my mind until I looked at some files yesterday)
Get Rave It Out! https://sites.google.com/view/riodevs/home
Want your theme made? I take commissions, PM for details.
Register Log In Back To Forums

0 User(s) Viewing This Thread (Past 15 Minutes)

©2006-2024 Zenius -I- vanisher.com -5th style- IIPrivacy Policy
Web Server: 3% · Database: 4% · Server Time: 2024-04-27 04:32:10
This page took 0.006 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language