Post #1 · Posted at 2014-01-24 02:34:24pm 10.2 years ago
riskofsoundingnerdy | |
---|---|
Member | |
140 Posts | |
Reg. 2011-12-18 | |
"Yeah, nah." |
Hi everyone, I've been working on making a Pop'n Music 19 Tune Street-"esque" theme for SM5. Currently I am working on ScreenSelectMusic (it is still pretty bare) and I have run into an issue. For those of you familiar with Pop'n Music, you'll know the music wheel features the available difficulties and difficulty meter for each song. The problem I am having is getting the meter onto each music wheel item. I have gotten the available difficulties but every time I try to code the meter into it I get the "access violation" crash so I'm pretty sure there are no syntax errors.
I have tried attaching the code to both the music wheel item and the music wheel grades lua. If no one knows a way around this has anyone got any suggestions for this issue?
All help is greatly appreciated.
I have tried attaching the code to both the music wheel item and the music wheel grades lua. If no one knows a way around this has anyone got any suggestions for this issue?
All help is greatly appreciated.
Post #2 · Posted at 2014-01-24 03:03:39pm 10.2 years ago
FlameyBoy | |
---|---|
Member | |
335 Posts | |
Reg. 2011-03-09 | |
Posting a crashlog would probably help some.
Post #3 · Posted at 2014-01-24 03:14:15pm 10.2 years ago
Crashlog:
StepMania v5.0 alpha 3 crash report (build 5, 20120711 @ 00:12:57 Central Daylight Time)
--------------------------------------
Crash reason: Access Violation
Thread: Main thread
RageSurface_Load_PNG.cpp:23
RageSurface_Load_PNG.cpp:23
RageTextureManager.cpp:123 RageTextureManager::LoadTexture(./CDTitles/DanceDanceRevolution 2013.png).
GraphicsWindow.cpp:54 005A18C0, 257, 00000009, c00f0001
GameSoundManager.cpp:557 6.686054, delta 0.131000
Thread: Decode thread
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
Thread: Mixer thread
Thread: Music thread
Thread: Worker thread (MemoryCardWorker)
Thread: Worker thread (/@mc1int/)
Thread: Worker thread (/@mc2int/)
Thread: DirectInput thread
InputHandler_DirectInput.cpp:775
InputHandler_DirectInput.cpp:751
InputHandler_DirectInput.cpp:770
InputHandler_DirectInput.cpp:775
InputHandler_DirectInput.cpp:751
69465c78: StepMania-SSE2!00000000
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
006870bc: void ActorFrame::UpdateInternal(float) [00400000+287000+bc]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0069fda4: void Sprite::Update(float) [00400000+29fd90+14]
77d2f8d1: ntdll!ZwWaitForSingleObject [77d10000+1f8bc+15]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
006870bc: void ActorFrame::UpdateInternal(float) [00400000+287000+bc]
005ebafa: void WheelBase::Update(float) [00400000+1ebae0+1a]
0052932a: void TimingData::GetBeatAndBPSFromElapsedTime(float,float &,float &,bool &,bool &,int &,float &)const [00400000+1292e0+4a]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
6f4b582d: MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::compare [6f4b0000+57e5+48]
004024ca: void Screen::Update(float) [00400000+24b0+1a]
6f4c5962: MSVCP90!std:: operator!=<char,std::char_traits<char>,std::allocator<char> > [6f4b0000+15952+10]
004037e6: float const & ThemeMetric<float>::GetValue(void)const [00400000+37d0+16]
00403819: float const & ThemeMetric<float>::GetValue(void)const [00400000+37d0+49]
00599cba: _int64 ArchHooks::GetMicrosecondsSinceStart(bool)() [00400000+199c80+3a]
0066ebdf: float RageTimer::Ago(void)const [00400000+26ebc0+1f]
0044c82d: void ScreenWithMenuElements::Update(float) [00400000+4c820+d]
00432067: void ScreenSelectMusic::Update(float) [00400000+31fe0+87]
006b1670: void GameState::Update(float) [00400000+2b1600+70]
0066b512: void RageTextureManager::Update(float) [00400000+26b4b0+62]
0058a632: void GameLoop::RunGameLoop(void) [00400000+18a510+122]
6f4b5e43: MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy [6f4b0000+5dfb+48]
6f4b5ec4: MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> > [6f4b0000+5ebb+9]
0058e8f6: main() [00400000+18da70+e86]
729b36c5: MSVCR90!_set_flsgetvalue [72990000+236b6+f]
729b38b3: MSVCR90!initptd [72990000+23753+160]
005a9074: int GetWin32CmdLine(char * * &) [00400000+1a8fc0+b4]
005a8df5: WinMain@16() [00400000+1a8de0+15]
0078bdcf: __tmainCRTStartup() [00400000+38bc8f+140]
77d49f45: ntdll!RtlInitializeExceptionChain [77d10000+39f0f+36]
Static log:
StepMania v5.0 alpha 3
Compiled 20120711 @ 00:12:57 Central Daylight Time (build 5)
Log starting 2014-01-24 18:10:06
Loading window: win32
Windows 6.1 (Win7) build 7601 [Service Pack 1]
Memory: 4095mb total, 4095mb swap (4095mb swap avail)
Video driver: Intel(R) HD Graphics 4000 [Intel Corporation]
8.15.10.2712, 3-26-2012 [pci\ven_8086&dev_0166&subsys_06471025]
Drive: "Hitachi HTS547575A9E38" Driver: iaSto DMA: yes
Drive: "Slimtype DVD A DS8A8S" Driver: iaSto DMA: yes
Drive: "ELBY CLONEDRIVE 1.4" Driver: VClone DMA: N/A
Sound device 0: Speakers (Realtek High Definiti, 6.1, MID 1, PID 100
DirectSound Driver: Primary Sound Driver
DirectSound Driver: Speakers (Realtek High Definition Audio) {0.0.0.00000000}.{c0dae532-51de-4401-b05f-ce253d52ee08}
DirectSound sample rates: 100..200000 (continuous)
Software mixing at 44100 hz
Sound driver: DirectSound-sw
Lights driver: SystemMessage
Lights driver: Export
Video renderers: 'd3d,opengl'
WARNING: RageDisplay_D3D::TryVideoMode( 1, 1067, 600, 32, 0, 1 )
D3D Windowed 1067x600 32 color 32 texture 60Hz Vsync SmoothLines
Found 2 DirectInput devices:
0: 'Keyboard' axes: 0, hats: 0, buttons: 256 (buffered)
1: 'Mouse' axes: 3, hats: 0, buttons: 8 (buffered)
WARNING: Error playing command: [string "ScreenInit::HelpOnCommand"]:12: attempt to get length of global 'BAFFFF' (a nil value)
WARNING: [string "ScreenInit::HelpOnCommand"]:12: unknown(self = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = attempt to get length of global 'BAFFFF' (a nil value))
WARNING: Error playing command: [string "ScreenTitleMenu::HelpOnCommand"]:12: attempt to get length of global 'BAFFFF' (a nil value)
WARNING: [string "ScreenTitleMenu::HelpOnCommand"]:12: unknown(self = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = attempt to get length of global 'BAFFFF' (a nil value))
WARNING: Error playing command: [string "ScreenWarning::HelpOnCommand"]:12: attempt to get length of global 'BAFFFF' (a nil value)
WARNING: [string "ScreenWarning::HelpOnCommand"]:12: unknown(self = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = attempt to get length of global 'BAFFFF' (a nil value))
WARNING: Error playing command: Expected PlayerNumber; got nil
WARNING: [C]: IsHumanPlayer( = (null))
WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
WARNING: Error playing command: Expected PlayerNumber; got nil
WARNING: [C]: IsHumanPlayer( = (null))
WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
Mixing underruns: 1
Players joined: P1
Top Screen: ScreenSelectMusic
Language: en
Current renderer: Direct3D
Theme: Pop
Partial log:
00:19.354: WARNING: [C]: IsHumanPlayer( = (null))
00:19.354: WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
00:19.354: WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
00:19.356: WARNING: Error playing command: Expected PlayerNumber; got nil
00:19.356: WARNING: [C]: IsHumanPlayer( = (null))
00:19.356: WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
00:19.356: WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
00:19.361: Zeroing this update. Was 5.620000
00:19.367: RageBitmapTexture: Loaded './CDTitles/DanceDanceRevolution 2013.png' (64x16); RGBA8, source 49,12; image 49,12.
00:19.493: 1 FPS, 1 av FPS, 3968 VPF, D3D
-- End of report
StepMania v5.0 alpha 3 crash report (build 5, 20120711 @ 00:12:57 Central Daylight Time)
--------------------------------------
Crash reason: Access Violation
Thread: Main thread
RageSurface_Load_PNG.cpp:23
RageSurface_Load_PNG.cpp:23
RageTextureManager.cpp:123 RageTextureManager::LoadTexture(./CDTitles/DanceDanceRevolution 2013.png).
GraphicsWindow.cpp:54 005A18C0, 257, 00000009, c00f0001
GameSoundManager.cpp:557 6.686054, delta 0.131000
Thread: Decode thread
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
RageSoundDriver_Generic_Software.cpp:197
Thread: Mixer thread
Thread: Music thread
Thread: Worker thread (MemoryCardWorker)
Thread: Worker thread (/@mc1int/)
Thread: Worker thread (/@mc2int/)
Thread: DirectInput thread
InputHandler_DirectInput.cpp:775
InputHandler_DirectInput.cpp:751
InputHandler_DirectInput.cpp:770
InputHandler_DirectInput.cpp:775
InputHandler_DirectInput.cpp:751
69465c78: StepMania-SSE2!00000000
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
006870bc: void ActorFrame::UpdateInternal(float) [00400000+287000+bc]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0069fda4: void Sprite::Update(float) [00400000+29fd90+14]
77d2f8d1: ntdll!ZwWaitForSingleObject [77d10000+1f8bc+15]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
006870bc: void ActorFrame::UpdateInternal(float) [00400000+287000+bc]
005ebafa: void WheelBase::Update(float) [00400000+1ebae0+1a]
0052932a: void TimingData::GetBeatAndBPSFromElapsedTime(float,float &,float &,bool &,bool &,int &,float &)const [00400000+1292e0+4a]
0067d813: void Actor::UpdateInternal(float) [00400000+27d390+483]
6f4b582d: MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::compare [6f4b0000+57e5+48]
004024ca: void Screen::Update(float) [00400000+24b0+1a]
6f4c5962: MSVCP90!std:: operator!=<char,std::char_traits<char>,std::allocator<char> > [6f4b0000+15952+10]
004037e6: float const & ThemeMetric<float>::GetValue(void)const [00400000+37d0+16]
00403819: float const & ThemeMetric<float>::GetValue(void)const [00400000+37d0+49]
00599cba: _int64 ArchHooks::GetMicrosecondsSinceStart(bool)() [00400000+199c80+3a]
0066ebdf: float RageTimer::Ago(void)const [00400000+26ebc0+1f]
0044c82d: void ScreenWithMenuElements::Update(float) [00400000+4c820+d]
00432067: void ScreenSelectMusic::Update(float) [00400000+31fe0+87]
006b1670: void GameState::Update(float) [00400000+2b1600+70]
0066b512: void RageTextureManager::Update(float) [00400000+26b4b0+62]
0058a632: void GameLoop::RunGameLoop(void) [00400000+18a510+122]
6f4b5e43: MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy [6f4b0000+5dfb+48]
6f4b5ec4: MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> > [6f4b0000+5ebb+9]
0058e8f6: main() [00400000+18da70+e86]
729b36c5: MSVCR90!_set_flsgetvalue [72990000+236b6+f]
729b38b3: MSVCR90!initptd [72990000+23753+160]
005a9074: int GetWin32CmdLine(char * * &) [00400000+1a8fc0+b4]
005a8df5: WinMain@16() [00400000+1a8de0+15]
0078bdcf: __tmainCRTStartup() [00400000+38bc8f+140]
77d49f45: ntdll!RtlInitializeExceptionChain [77d10000+39f0f+36]
Static log:
StepMania v5.0 alpha 3
Compiled 20120711 @ 00:12:57 Central Daylight Time (build 5)
Log starting 2014-01-24 18:10:06
Loading window: win32
Windows 6.1 (Win7) build 7601 [Service Pack 1]
Memory: 4095mb total, 4095mb swap (4095mb swap avail)
Video driver: Intel(R) HD Graphics 4000 [Intel Corporation]
8.15.10.2712, 3-26-2012 [pci\ven_8086&dev_0166&subsys_06471025]
Drive: "Hitachi HTS547575A9E38" Driver: iaSto DMA: yes
Drive: "Slimtype DVD A DS8A8S" Driver: iaSto DMA: yes
Drive: "ELBY CLONEDRIVE 1.4" Driver: VClone DMA: N/A
Sound device 0: Speakers (Realtek High Definiti, 6.1, MID 1, PID 100
DirectSound Driver: Primary Sound Driver
DirectSound Driver: Speakers (Realtek High Definition Audio) {0.0.0.00000000}.{c0dae532-51de-4401-b05f-ce253d52ee08}
DirectSound sample rates: 100..200000 (continuous)
Software mixing at 44100 hz
Sound driver: DirectSound-sw
Lights driver: SystemMessage
Lights driver: Export
Video renderers: 'd3d,opengl'
WARNING: RageDisplay_D3D::TryVideoMode( 1, 1067, 600, 32, 0, 1 )
D3D Windowed 1067x600 32 color 32 texture 60Hz Vsync SmoothLines
Found 2 DirectInput devices:
0: 'Keyboard' axes: 0, hats: 0, buttons: 256 (buffered)
1: 'Mouse' axes: 3, hats: 0, buttons: 8 (buffered)
WARNING: Error playing command: [string "ScreenInit::HelpOnCommand"]:12: attempt to get length of global 'BAFFFF' (a nil value)
WARNING: [string "ScreenInit::HelpOnCommand"]:12: unknown(self = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = attempt to get length of global 'BAFFFF' (a nil value))
WARNING: Error playing command: [string "ScreenTitleMenu::HelpOnCommand"]:12: attempt to get length of global 'BAFFFF' (a nil value)
WARNING: [string "ScreenTitleMenu::HelpOnCommand"]:12: unknown(self = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = attempt to get length of global 'BAFFFF' (a nil value))
WARNING: Error playing command: [string "ScreenWarning::HelpOnCommand"]:12: attempt to get length of global 'BAFFFF' (a nil value)
WARNING: [string "ScreenWarning::HelpOnCommand"]:12: unknown(self = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = (null),(*temporary) = attempt to get length of global 'BAFFFF' (a nil value))
WARNING: Error playing command: Expected PlayerNumber; got nil
WARNING: [C]: IsHumanPlayer( = (null))
WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
WARNING: Error playing command: Expected PlayerNumber; got nil
WARNING: [C]: IsHumanPlayer( = (null))
WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
Mixing underruns: 1
Players joined: P1
Top Screen: ScreenSelectMusic
Language: en
Current renderer: Direct3D
Theme: Pop
Partial log:
00:19.354: WARNING: [C]: IsHumanPlayer( = (null))
00:19.354: WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
00:19.354: WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
00:19.356: WARNING: Error playing command: Expected PlayerNumber; got nil
00:19.356: WARNING: [C]: IsHumanPlayer( = (null))
00:19.356: WARNING: /Themes/_fallback/Scripts/02 Actor.lua:132: player(self = (null),p = (null),(*temporary) = (null),(*temporary) = (null))
00:19.356: WARNING: /Themes/Pop/BGAnimations/ScreenSelectMusic decorations/default.lua:15: unknown(self = (null))
00:19.361: Zeroing this update. Was 5.620000
00:19.367: RageBitmapTexture: Loaded './CDTitles/DanceDanceRevolution 2013.png' (64x16); RGBA8, source 49,12; image 49,12.
00:19.493: 1 FPS, 1 av FPS, 3968 VPF, D3D
-- End of report
Post #4 · Posted at 2014-01-25 02:42:07am 10.2 years ago
Access violations are beyond me (C++ stuff), but can you share you pertinent Lua (and Metrics, if any)? I can try to help you with that.
I'm actually quite curious to see how you got each song's steps' meter in its MusicWheelItem, because I was unable to figure anything useful out after the last hour of tinkering with it...
I'm actually quite curious to see how you got each song's steps' meter in its MusicWheelItem, because I was unable to figure anything useful out after the last hour of tinkering with it...
Post #5 · Posted at 2014-01-25 05:51:27am 10.2 years ago
riskofsoundingnerdy | |
---|---|
Member | |
140 Posts | |
Reg. 2011-12-18 | |
"Yeah, nah." |
This is what I used in the .lua for MusicWheelItem Song NormalPart. I also used basically the same code to display the meter in ScreenSelectMusic decorations and it seemed to work so I'm thinking maybe stepmania doesn't allow the meter to be attached to music wheel items.
t[#t+1] = LoadFont("_broadway becker caps 50px") .. {
InitCommand=cmd(diffusealpha,1;draworder,1;zoom,0.92;x,SCREEN_CENTER_X+9;y,SCREEN_CENTER_Y-59;horizalign,center;queuecommand,"Set");
CurrentSongChangedMessageCommand=cmd(queuecommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set");
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong();
if song then
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMeter()
self:settext(meter);
else
self:settext("");
end
end
};
I also tried playing around with metrics and inserting a meter into [MusicWheelItem] but had no luck there.
t[#t+1] = LoadFont("_broadway becker caps 50px") .. {
InitCommand=cmd(diffusealpha,1;draworder,1;zoom,0.92;x,SCREEN_CENTER_X+9;y,SCREEN_CENTER_Y-59;horizalign,center;queuecommand,"Set");
CurrentSongChangedMessageCommand=cmd(queuecommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set");
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong();
if song then
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMeter()
self:settext(meter);
else
self:settext("");
end
end
};
I also tried playing around with metrics and inserting a meter into [MusicWheelItem] but had no luck there.
Post #6 · Posted at 2014-01-28 05:51:27am 10.2 years ago
Hi riskofsoundingnerdy, sorry it took me so long to get back to you.
Your Lua is causing StepMaina to crash because (to my knowledge) you can't queue additional commands from InitCommand. If you were to move your queuecommand,"Set" down to an OnCommand like:
StepMania no longer raises an access violation.
As it stands, however, your code is (probably) not quite what you're going for and you're bumping into the same problem(s) I was when I tried last week. By putting meter code into MusicWheelItem Song NormalPart, every MusicWheelItem will display the same meter. They'll update as you scroll from song to song, but EVERY MusicWheelItem will display the meter of the current song.
You might have better luck with TextBanner because each song gets a unique TextBanner, but I'm not entirely sure how inject text other than Title, Subtitle, and Artist into a TextBanner.
If you figure anything useful out, please post here; I'd be curious to see how you handled it! As always, the SM5 Lua documentation is your friend.
Your Lua is causing StepMaina to crash because (to my knowledge) you can't queue additional commands from InitCommand. If you were to move your queuecommand,"Set" down to an OnCommand like:
Quote
LoadFont("_broadway becker caps 50px")..{
InitCommand=cmd(zoom,0.92; horizalign,center;);
OnCommand=cmd(queuecommand,"Set");
CurrentSongChangedMessageCommand=cmd(queuecommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set");
SetCommand=function(self)
local song, steps, meter;
song = GAMESTATE:GetCurrentSong();
if song then
steps = GAMESTATE:GetCurrentSteps(PLAYER_1);
if steps then
meter = steps:GetMeter();
if meter then
self:settext(meter);
else
self:settext("");
end
end
else
self:settext("");
end
end
};
InitCommand=cmd(zoom,0.92; horizalign,center;);
OnCommand=cmd(queuecommand,"Set");
CurrentSongChangedMessageCommand=cmd(queuecommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set");
SetCommand=function(self)
local song, steps, meter;
song = GAMESTATE:GetCurrentSong();
if song then
steps = GAMESTATE:GetCurrentSteps(PLAYER_1);
if steps then
meter = steps:GetMeter();
if meter then
self:settext(meter);
else
self:settext("");
end
end
else
self:settext("");
end
end
};
StepMania no longer raises an access violation.
As it stands, however, your code is (probably) not quite what you're going for and you're bumping into the same problem(s) I was when I tried last week. By putting meter code into MusicWheelItem Song NormalPart, every MusicWheelItem will display the same meter. They'll update as you scroll from song to song, but EVERY MusicWheelItem will display the meter of the current song.
You might have better luck with TextBanner because each song gets a unique TextBanner, but I'm not entirely sure how inject text other than Title, Subtitle, and Artist into a TextBanner.
If you figure anything useful out, please post here; I'd be curious to see how you handled it! As always, the SM5 Lua documentation is your friend.
Post #7 · Posted at 2014-01-29 03:53:32am 10.2 years ago
Quote: dbk2
Your Lua is causing StepMaina to crash because (to my knowledge) you can't queue additional commands from InitCommand.
You can queue commands from InitCommand, I do it all the time.In general, with poorly explained errors, your best bet is to remove chunks of code until the error goes away, and then add them back one line at a time until you find exactly what is causing the problem.
If I had to guess, I would expect that your crash is caused by:
Quote
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMeter()
If steps is nil it would cause a crash of some kind, I'm not sure if it would be an Access Violation or not.Beyond that, your code would be getting the text for the meter of the selected steps, not the steps associated with that particular MusicWheelItem.
You'll probably want to use "SetMessageCommand". Each time a MusicWheelItem changes what it is displaying, it is given the "Set" message. Here are the parameters that come along with the message:
Quote
Message msg( "Set" );
msg.SetParam( "Song", pWID->m_pSong );
msg.SetParam( "Course", pWID->m_pCourse );
msg.SetParam( "Index", iIndex );
msg.SetParam( "HasFocus", bHasFocus );
msg.SetParam( "Text", pWID->m_sText );
msg.SetParam( "DrawIndex", iDrawIndex );
msg.SetParam( "Type", MusicWheelItemTypeToString(type) );
msg.SetParam( "Color", pWID->m_color );
msg.SetParam( "Label", pWID->m_sLabel );
msg.SetParam( "Song", pWID->m_pSong );
msg.SetParam( "Course", pWID->m_pCourse );
msg.SetParam( "Index", iIndex );
msg.SetParam( "HasFocus", bHasFocus );
msg.SetParam( "Text", pWID->m_sText );
msg.SetParam( "DrawIndex", iDrawIndex );
msg.SetParam( "Type", MusicWheelItemTypeToString(type) );
msg.SetParam( "Color", pWID->m_color );
msg.SetParam( "Label", pWID->m_sLabel );
If you want to display the Meter for all steps the song has, you'd need something along the lines of:
Quote
SetMessageCommand=function(self,params)
local song = params.Song
local steps = SongUtil.GetPlayableSteps( song )
for i,step in ipairs(steps) do
local child = ( some child based on step:GetDifficulty() )
child:settext( step:GetMeter() )
end
end
local song = params.Song
local steps = SongUtil.GetPlayableSteps( song )
for i,step in ipairs(steps) do
local child = ( some child based on step:GetDifficulty() )
child:settext( step:GetMeter() )
end
end
I'm not 100% sure on the syntax for GetPlayableSteps, but I think that's right. You could use song:GetStepsByStepsType( <steps type> ) instead if you wanted.
You'd also probably want to set the text of all of the difficulty meter children to "" before setting based on existing chart meters, so difficulties without steps for that song will have a blank string.
Post #8 · Posted at 2014-01-29 07:45:07am 10.2 years ago
dbk2 | |
---|---|
Member | |
332 Posts | |
Not Set | |
Reg. 2012-04-30 | |
I used SongUtil.GetPlayableSteps() once in all my theming, but had since forgotten it existed. Thank you for causing me to remember it!
Post #9 · Posted at 2014-01-29 05:52:31pm 10.2 years ago
riskofsoundingnerdy | |
---|---|
Member | |
140 Posts | |
Reg. 2011-12-18 | |
"Yeah, nah." |
Thanks for your help guys. I am pretty new to coding so I'm not quite sure where things are supposed to go yet. Just testing and playing around now.