Logo

[SM5] Change "MusicWheel expand" sound file depending on folder?

Register Log In Back To Forums

Post #1 · Posted at 2017-11-25 05:47:24am 6.4 years ago

Offline leadbman
leadbman Avatar Member
263 Posts
Australia
Reg. 2016-02-01

"Working On: 5thMix BGA bgchanges"

Last updated: 2017-11-25 05:47am
Hi all,

I had an idea a while back I would like to try out since I understand the scripting a bit better now and I was wondering if it was possible. Would I be able to tell the engine that if I was over a specific folder, it should play a sound I choose (this way I could have for example, multiple expand sounds rather than the one set in the "sounds" folder)?

Not sure if it's possible but I think it'd be a pretty neat feature. I have code working right now to get a different song looping while focused on a folder so I'm assuming it could be done with that code as a base to set the sound, but I'm not sure how I could go about "setting" the sound for that folder as I wouldn't just want it to play when you hover the folder, I'd want it to play when the folder expands - otherwise that would definitely get annoying over time.

If any of you lua/SM5 boffins out there could help/let me know if it's possible that'd be greatly appreciated.

Cheers.

EDIT: Ok, so I worked out this call:
local wheelitem_expanded = GAMESTATE:GetExpandedSectionName()

I've got it working to where if you expand the folder and then go back over the folder it'll play the sound (by running the code with CurrentSongChangedMessageCommand then running a function), but I want it to trigger when the user expands the folder - is there a ChangedMessageCommand for expanding the folders or a way that I could see if the user opens/closes a folder?

I found this in the WheelBase.cpp:
if( m_sExpandedSectionName == sThisItemSectionName ) // already expanded
{
SetOpenSection( "" ); // collapse it
m_soundCollapse.Play(true);
}
else // already collapsed
{
SetOpenSection( sThisItemSectionName ); // expand it
m_soundExpand.Play(true);
}

Which is the games call to play the "MusicWheel expand" file, but would it be possible to use this within my code somehow to then trigger my separate sound effects?
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #2 · Posted at 2017-11-25 02:56:10pm 6.4 years ago

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

Maybe you could do de trick using the expanded graphic, put the audio in there, and to control it check if the graphic is visible, if the graphic is not visible it means that the section is collapsed.

Post #3 · Posted at 2017-11-25 06:16:57pm 6.4 years ago

Offline leadbman
leadbman Avatar Member
263 Posts
Australia
Reg. 2016-02-01

"Working On: 5thMix BGA bgchanges"
That was a fantastic idea MadkaT! Thanks a lot for the suggestion. I had a look into doing it that way, but I was running into issues due to the way the base theme I am building from does things, but while I was trying your way I had another idea that did end up working for me!

I wanted to see if I could use a code message from the metrics file - similar to how we can do things like speed mods within gameplay etc.

This is what I came up with:


CodeMessageCommand=function(self,params)

local wheel = SCREENMAN:GetTopScreen():GetMusicWheel()
local wheelitem_type = wheel:GetSelectedType()
local wheelitem_name = wheel:GetSelectedSection()
local wheelitem_expanded = GAMESTATE:GetExpandedSectionName()

local pn = params.PlayerNumber;

if wheelitem_type == "WheelItemDataType_Section" then

if wheelitem_name == wheelitem_expanded then

if params.Name == "Start" then

--This is where I have my code for specific groups and calls to play a sound, for example:

if wheelitem_name:find("groupname") then
SOUND:PlayOnce(THEME:GetPathB("ScreenSelectMusic", "underlay/Sound/soundfile.mp3"))

end; --END Find which group


end;

end; --END Wheel Expanded

end; --END Wheel Type

end; --END CODE MESSAGE


Within my metrics I have in my [ScreenSelectMusic] section:
CodeStart="~Start"

My code checks to see if the folder isn't open before triggering (otherwise it triggers the audio call on collapse and expand and I just wanted the call for the expand) and also won't trigger unless you're over a folder.

Hope this helps someone either do something like this or possibly even use the codes to pull off other things. I for one will be investigating new things I can do with this now I understand it a bit better! If anyone has any suggestions to clean up my code, please feel free to let me know.

Thanks again MadkaT! :)
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #4 · Posted at 2017-11-25 11:37:59pm 6.4 years ago

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

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-27 11:16:34
This page took 0.005 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language