benank / everyone.dance

A realtime score sharing system for Stepmania. ⚠️ NOTE: This service is deprecated and no longer works, but you can still self host it.
https://everyone.dance
GNU General Public License v3.0
15 stars 1 forks source link

Lua script breaks upon song playback #3

Closed JoseVarelaP closed 3 years ago

JoseVarelaP commented 3 years ago

This is caused as the initial segment of the script (RefreshActiveSongData()) looks for the wheel on ScreenGameplay, which doesn't have one. And since it does not have a check to verify that it's there, it can break.

Captura de Pantalla 2021-02-03 a la(s) 16 24 30

local mw = SCREENMAN:GetTopScreen():GetChild("MusicWheel")
player_data.ingame = mw == nil

Here's a possible solution, that can check for the validation of the object.

local mw = nil --Initialize the object
if SCREENMAN:GetTopScreen() then -- Verify that the screen exists first before doing anything.
    mw = SCREENMAN:GetTopScreen():GetChild("MusicWheel") --Check that the object is valid.
end
player_data.ingame = mw == nil
benank commented 3 years ago

Thanks! Included in next version.