Logo

Prevent announcer in some screens (SM5) and two theming questions

Register Log In Back To Forums

Post #1 · Posted at 2015-10-12 10:53:40pm 8.5 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24


Last updated: 2015-10-20 02:17pm
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:

if GAMESTATE:Something() then
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

Offline VR0
VR0 Avatar Member
969 Posts
Chile
Reg. 2012-03-20

"ムーン ゴーシュス メヂィデーション"
Disable emoticons if you posting codes!!
AC Score Tracker: DDR EXTREME // SN2 (JP)
My username in these games:
DDR(1st)-EXTREME: VRC
StepMania 3.9+ REDUX: VRC
DDR Supernova onwards / IIDX ID: VR0

Post #3 · Posted at 2015-10-20 12:21:46am 8.5 years ago

Offline razorblade
razorblade Avatar Member
1,099 Posts
Not Set
Reg. 2011-03-01


Last updated: 2015-10-20 12:25am
1. Remove the Announcer files that trigger it.

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

Offline BemaniHyper
BemaniHyper Avatar Member+
1,434 Posts
United States
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

Offline dbk2
dbk2 Avatar Member
332 Posts
Not Set
Reg. 2012-04-30


Last updated: 2015-10-20 01:55am
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.

Post #6 · Posted at 2015-10-20 02:26:16pm 8.5 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24


Last updated: 2015-10-20 03:23pm
Quote: VR0
Disable emoticons if you posting codes!!
Sorry, I haven't checked the post, I've removed them.

Quote: razorblade
1. Remove the Announcer files that trigger it.

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")


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.

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

Offline Th3_Ov3rHell_3XoduZ
Th3_Ov3rHell_3XoduZ Avatar Member
313 Posts
Chile
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")


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


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".
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released

Post #8 · Posted at 2015-10-20 05:49:26pm 8.5 years ago

Offline razorblade
razorblade Avatar 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

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26


Last updated: 2015-10-20 08:36pm
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


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".

for i = 1,6 do
if GAMESTATE:GetCurrentStage() == 'Stage_'..FormatNumberAndSuffix(i) then
SOUNDTonguelayAnnouncer("stage "..i)
else
SOUNDTonguelayAnnouncer("stage final")
end
end
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.

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;
SOUNDTonguelayAnnouncer("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
SOUNDTonguelayAnnouncer("stage final" );
else
SOUNDTonguelayAnnouncer("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
SOUNDTonguelayAnnouncer("stage final" );
else
SOUNDTonguelayAnnouncer("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

Offline Th3_Ov3rHell_3XoduZ
Th3_Ov3rHell_3XoduZ Avatar Member
313 Posts
Chile
Reg. 2012-09-13

"ITG, The Best Dance Machine!"
Quote: Mad Matt
2pro4me
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released

Post #11 · Posted at 2015-10-21 02:20:10pm 8.5 years ago

Offline MadkaT
MadkaT Avatar 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 Big Grin thanks a lot for the help.
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: 4% · Database: 4% · Server Time: 2024-04-23 20:44:33
This page took 0.008 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language