Post #1 · Posted at 2015-10-12 10:53:40pm 8.5 years ago
Hello, I have various sorted theming related questions, if someone could help me to solve them would be nice.
1. I've been noticed than in some screens the announcer plays the hurry up in some screens that is not needed like title or game over screens, most of them have a hidden timer that is causing the hurry up condition to trigger, there is a way to avoid the announcer in a screen? Or a different method to make a screen maintain still by a determinated time?
2. The second question is related to the PlayAnnouncer, I have a condition like this:
It works ok, but the announcer sound immediately the screen loads, and I want to delay the play announcer command by X seconds, like the sleep command, but I don't know how to do that.
3. For the DDRX theme I've created a Shock Arrow warning screen, but I don't have and idea how to create the branch to check if the song has mines to show the shock arrow warning, could someone guide me a little bit with this?
That's all, thanks for reading.
1. I've been noticed than in some screens the announcer plays the hurry up in some screens that is not needed like title or game over screens, most of them have a hidden timer that is causing the hurry up condition to trigger, there is a way to avoid the announcer in a screen? Or a different method to make a screen maintain still by a determinated time?
2. The second question is related to the PlayAnnouncer, I have a condition like this:
if GAMESTATE:Something() then
SOUND:PlayAnnouncer("something")
end;
SOUND:PlayAnnouncer("something")
end;
It works ok, but the announcer sound immediately the screen loads, and I want to delay the play announcer command by X seconds, like the sleep command, but I don't know how to do that.
3. For the DDRX theme I've created a Shock Arrow warning screen, but I don't have and idea how to create the branch to check if the song has mines to show the shock arrow warning, could someone guide me a little bit with this?
That's all, thanks for reading.
Post #2 · Posted at 2015-10-19 11:57:47pm 8.5 years ago
VR0 | |
---|---|
Member | |
969 Posts | |
Reg. 2012-03-20 | |
"ムーン ゴーシュス メヂィデーション" |
Disable emoticons if you posting codes!!
Post #3 · Posted at 2015-10-20 12:21:46am 8.5 years ago
2. LoadActor( 'anySound' ) .. {
OnCommand=cmd(sleep,1;queuecommand, 'Play');
PlayCommand=cmd(play);
};
input the sleep value to your preference.
Post #4 · Posted at 2015-10-20 01:13:10am 8.5 years ago
BemaniHyper | |
---|---|
Member+ | |
1,434 Posts | |
Reg. 2013-09-13 | |
Quote: VR0
Disable emoticons if you posting codes!!
use the code tags
like this
Post #5 · Posted at 2015-10-20 01:35:01am 8.5 years ago
Regarding your first question, the StepMania source code indicates that there is a metric under MenuTimer for HurryUpTransition that appears to be an integer: https://github.com/stepmania/stepmania/blob/master/src/MenuTimer.cpp#L55
It looks like it's used as a threshold value to trigger the "Hurry Up" announcer. When the MenuTimer value becomes less than the HurryUpTransition value, the announcer file is played.
So, one strategy might be to create a custom MenuTimer metric group for screens where you don't want the Hurry Up announcer to play. Something like this maybe:
# this assumes that you have a group called "MenuTimer"
# to fallback on; change it to whatever else as needed
[MenuTimerWithoutHurryUp]
Fallback="MenuTimer"
HurryUpTransition=-1
[ScreenGameOver]
TimerMetricsGroup="MenuTimerWithoutHurryUp"
I haven't tested that, but it should work. Maybe.
It looks like it's used as a threshold value to trigger the "Hurry Up" announcer. When the MenuTimer value becomes less than the HurryUpTransition value, the announcer file is played.
So, one strategy might be to create a custom MenuTimer metric group for screens where you don't want the Hurry Up announcer to play. Something like this maybe:
# this assumes that you have a group called "MenuTimer"
# to fallback on; change it to whatever else as needed
[MenuTimerWithoutHurryUp]
Fallback="MenuTimer"
HurryUpTransition=-1
[ScreenGameOver]
TimerMetricsGroup="MenuTimerWithoutHurryUp"
I haven't tested that, but it should work. Maybe.
Post #6 · Posted at 2015-10-20 02:26:16pm 8.5 years ago
Quote: VR0
Disable emoticons if you posting codes!!
Sorry, I haven't checked the post, I've removed them.Quote: razorblade
2. LoadActor( 'anySound' ) .. {
OnCommand=cmd(sleep,1;queuecommand, 'Play');
PlayCommand=cmd(play);
};
input the sleep value to your preference.
It works with a fixed sound file and path, but I'm using the PlayAnnouncer command, also I have it outside a table, I am creating the load announcer for the stage information screen with nested Ifs. This is a bit of the code:
if GAMESTATE:GetCurrentStage() == 'Stage_1st' then
SOUND:PlayAnnouncer("stage 1")
elseif GAMESTATE:GetCurrentStage() == 'Stage_2nd' then
SOUND:PlayAnnouncer("stage 2")
SOUND:PlayAnnouncer("stage 1")
elseif GAMESTATE:GetCurrentStage() == 'Stage_2nd' then
SOUND:PlayAnnouncer("stage 2")
It works perfectly, except for the delay, the announcer is playing immediately the screen shows. And this code is working outside a table.
Quote: dbk2
Regarding your first question, the StepMania source code indicates that there is a metric under MenuTimer for HurryUpTransition that appears to be an integer: https://github.com/stepmania/stepmania/blob/master/src/MenuTimer.cpp#L55
I haven't tested that, but it should work. Maybe.
I haven't tested that, but it should work. Maybe.
Thanks dbk2, I'll try this later, looks strange the game over or the title screen with the hurry up message.
Post #7 · Posted at 2015-10-20 05:46:55pm 8.5 years ago
Th3_Ov3rHell_3XoduZ | |
---|---|
Member | |
313 Posts | |
Reg. 2012-09-13 | |
"ITG, The Best Dance Machine!" |
Quote: MadkaT
It works with a fixed sound file and path, but I'm using the PlayAnnouncer command, also I have it outside a table, I am creating the load announcer for the stage information screen with nested Ifs. This is a bit of the code:
if GAMESTATE:GetCurrentStage() == 'Stage_1st' then
SOUND:PlayAnnouncer("stage 1")
elseif GAMESTATE:GetCurrentStage() == 'Stage_2nd' then
SOUND:PlayAnnouncer("stage 2")
SOUND:PlayAnnouncer("stage 1")
elseif GAMESTATE:GetCurrentStage() == 'Stage_2nd' then
SOUND:PlayAnnouncer("stage 2")
It works perfectly, except for the delay, the announcer is playing immediately the screen shows. And this code is working outside a table.
Just a little tip here, since I am learning how to use "for" in almost everything I can... you can edit that a little to prevent use so many "if" and "elseif".
for i = 1,6 do
if GAMESTATE:GetCurrentStage() == 'Stage_'..FormatNumberAndSuffix(i) then
SOUND:PlayAnnouncer("stage "..i)
else
SOUND:PlayAnnouncer("stage final")
end
end
if GAMESTATE:GetCurrentStage() == 'Stage_'..FormatNumberAndSuffix(i) then
SOUND:PlayAnnouncer("stage "..i)
else
SOUND:PlayAnnouncer("stage final")
end
end
With that, you don't need to specifically compare if is Stage 1st to play the corresponding sound and it is coded and executed by itself, you should edit the "stage final" to your correct name... If something is wrong just tell me.
Im still n00by using "for". But it is better to learn to coding a better script, you save a lot of time instead making every "if" or "elseif".
Post #8 · Posted at 2015-10-20 05:49:26pm 8.5 years ago
razorblade | |
---|---|
Member | |
1,099 Posts | |
Not Set | |
Reg. 2011-03-01 | |
Try this code instead: http://codepad.org/VLxUn2wQ
Post #9 · Posted at 2015-10-20 08:36:45pm 8.5 years ago
Quote: MadkaT
I don't have and idea how to create the branch to check if the song has mines
local HasMines = false;
for _,pn in ipairs( GAMESTATE:GetHumanPlayers() ) do
local steps = GAMESTATE:GetCurrentSteps( pn );
local rv = steps:GetRadarValues( pn );
if rv:GetValue( "RadarCategory_Mines" ) ~= 0 then
HasMines = true;
break;
end
end
if HasMines then
-- at least one player has mines
else
-- neither player has mines
end
for _,pn in ipairs( GAMESTATE:GetHumanPlayers() ) do
local steps = GAMESTATE:GetCurrentSteps( pn );
local rv = steps:GetRadarValues( pn );
if rv:GetValue( "RadarCategory_Mines" ) ~= 0 then
HasMines = true;
break;
end
end
if HasMines then
-- at least one player has mines
else
-- neither player has mines
end
Quote: Th3_Ov3rHell_3XoduZ
Just a little tip here, since I am learning how to use "for" in almost everything I can... you can edit that a little to prevent use so many "if" and "elseif".
First, that code will play "stage final" at least 5 times, because the if statement is evaluated each time the loop executes and it can evaluate as true at most 1 time. for i = 1,6 do
if GAMESTATE:GetCurrentStage() == 'Stage_'..FormatNumberAndSuffix(i) then
SOUNDlayAnnouncer("stage "..i)
else
SOUNDlayAnnouncer("stage final")
end
end
if GAMESTATE:GetCurrentStage() == 'Stage_'..FormatNumberAndSuffix(i) then
SOUNDlayAnnouncer("stage "..i)
else
SOUNDlayAnnouncer("stage final")
end
end
Second, the possible values of GAMESTATE:GetCurrentStage() are already contained in the enum table Stage. You could instead do the following, if you only want to consider stages 1 through 6.
local CurrentStage = GAMESTATE:GetCurrentStage();
local StageIndex = "final"
for i = 1, 6 do
if Stage[i] == CurrentStage then StageIndex = i; break; end
end;
SOUNDlayAnnouncer("stage " .. StageIndex );
There is also a GameState method GetCurrentStageIndex. On event mode it will count up indefinitely, so you might want to clamp it and have a maximum value. You'd also still need to check directly for final stage if you want that to have a different sound than whatever the number of that happens to be.
if GAMESTATE:GetCurrentStage() == "Stage_Final" then
SOUNDlayAnnouncer("stage final" );
else
SOUNDlayAnnouncer("stage " .. math.min( 6, GAMESTATE:GetCurrentStageIndex() ) );
end
You could also use Stepmania's Enum:Reverse as follows
local CurrentStage = GAMESTATE:GetCurrentStage();
if CurrentStage == "Stage_Final" then
SOUNDlayAnnouncer("stage final" );
else
SOUNDlayAnnouncer("stage " .. math.min( 6, Stage:Reverse()[CurrentStage] + 1 ) );
end
Of course, that still doesn't handle extra stage, nonstop, oni, etc.
Basically, the first step is to write out the logic of exactly what you want to do, then you can turn that into code using conditional statements and/or loops and/or function calls and/or etc.
Post #10 · Posted at 2015-10-20 09:55:57pm 8.5 years ago
Th3_Ov3rHell_3XoduZ | |
---|---|
Member | |
313 Posts | |
Reg. 2012-09-13 | |
"ITG, The Best Dance Machine!" |
Quote: Mad Matt
2pro4mePost #11 · Posted at 2015-10-21 02:20:10pm 8.5 years ago
MadkaT | |
---|---|
Member | |
820 Posts | |
Not Set | |
Reg. 2009-11-24 | |
Thanks razorblade and Mad Matt, your codes worked like a charm! Now I have to test the dbk2 codes thanks a lot for the help.