GetSoundPlaying requires a reference
There is a problem with global(start) script in Kirel's interior weather mod. Here is full script:
Click to expand
begin k_in_soundscript
float timer
short ran
short thunder
short soundstop
short soundplay
short doonce
if ( cellchanged == 1 )
set k_insound_reset to 0
set kag_mark to 0
endif
if ( getinterior == 0 )
if ( soundstop == 2 )
return
else
set k_insound_reset to 0
set soundstop to 1
endif
else
if ( k_insound_reset == 1 )
if ( kag_mark != 1 )
if ( soundstop == 2 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 3 )
set k_insound_reset to 0
set timer to 0
endif
return
else
set soundstop to 1
set timer to 0
endif
else
set timer to ( timer + GetSecondsPassed )
if ( timer > 3 )
set kag_mark to 0
set timer to 0
endif
set soundstop to 0
endif
else
set soundstop to 0
endif
endif
if ( soundstop == 1 )
if ( Player->GetSoundPlaying "in_rain" == 1 )
Player->StopSound "in_rain"
endif
if ( Player->GetSoundPlaying "in_dust" == 1 )
Player->StopSound "in_dust"
endif
if ( Player->GetSoundPlaying "in_wind" == 1 )
Player->StopSound "in_wind"
endif
set soundplay to 0
set soundstop to 2
return
endif
if ( getinterior == 1 )
if ( getcurrentweather > 3 )
if ( Player->GetSoundPlaying, "in_rain" == 0 )
if ( Player->GetSoundPlaying, "in_dust" == 0 )
if ( Player->GetSoundPlaying, "in_wind" == 0 )
set soundplay to 0
else
set soundplay to 1
endif
else
set soundplay to 1
endif
else
set soundplay to 1
endif
if ( soundplay != 1 )
if ( getcurrentweather == 4 )
if ( Player->GetSoundPlaying "in_rain" == 0 )
Player->PlayLoopSound3DVP, "in_rain" .5 1
endif
elseif ( getcurrentweather == 5 )
if ( Player->GetSoundPlaying "in_rain" == 0 )
Player->PlayLoopSound3DVP, "in_rain" 1 1
Player->PlayLoopSound3DVP, "in_wind" 1 .5
endif
elseif ( getcurrentweather < 8 )
if ( Player->GetSoundPlaying "in_dust" == 0 )
Player->PlayLoopSound3D, "in_dust"
endif
elseif ( getcurrentweather == 9 )
if ( Player->GetSoundPlaying "in_dust" == 0 )
Player->PlayLoopSound3DVP, "in_wind" 1 .5
endif
endif
endif
endif
endif
if ( getcurrentweather != 5 )
return
else
if ( getinterior == 1 )
if ( timer == 0 )
if ( getsoundplaying "in_thunder01" == 1 )
return
elseif ( getsoundplaying "in_thunder02" == 1 )
return
elseif ( getsoundplaying "in_thunder03" == 1 )
return
endif
set ran to Random 101
set ran to ( ran / 3 )
set ran to ( ran + 1 )
endif
set timer to ( timer + GetSecondsPassed )
if ( timer < 3 )
return
endif
if ( timer < ran )
return
else
set thunder to random, 3
if ( thunder == 0 )
playsound "in_thunder01"
elseif ( thunder == 1 )
playsound "in_thunder02"
else
playsound "in_thunder03"
endif
set timer to 0
endif
endif
endif
end k_in_soundscript
I bisected it down (editing mod in openmw-cs) to these lines:
if ( getsoundplaying "in_thunder01" == 1 )
return
elseif ( getsoundplaying "in_thunder02" == 1 )
return
elseif ( getsoundplaying "in_thunder03" == 1 )
return
endif
The error in logs is following: Execution of script "k_in_soundscript" failed: no implicit reference. If I comment these lines, or add Player-> explicit reference, the script works without errors.
- Is the problem OpenMW specific or does it also happen in vanilla Morrowind? I haven't checked it, but presumably bug is Openmw-specific since its an old mod and no complaints
- What is your operating system? Linux
- What version of OpenMW are you using? If you used a bleeding edge build, state the exact revision used. Latest master atm, 5f92d520
- What version of Morrowind are you using (i.e. retail CD or Steam)? What addons (Tribunal, Bloodmoon) do you have installed? What language is your Morrowind install? 1C Ru Morrowind
- Do you use any mods? If so, does the problem also occur in a clean vanilla install without any mods? I disabled all mods except Interior weather mod, and the error persisted
- What are the exact steps to reproduce the problem? Have a rain with thunder weather in exterior (getcurrentweather == 5), then try to enter any interior and observe script error in log. Expected rain and wind sound effects also won't play. Then you can run
startscript k_in_soundscriptmanually, and the same script error inside log repeats, however the sound effects will play as intended. - What did you expect to happen? No error upon entering interior, weather sounds start play automatically.
- Are there any error messages in your
openmw.logfile? If you're not an OpenMW team member, it's best to upload it.
Click to expand
[01:02:54.668 I] L@0x1[scripts/dynamicmusic/player.lua]: new music requested
[01:02:54.668 I] L@0x1[scripts/dynamicmusic/player.lua]: using DEFAULT soundbank
[01:02:54.668 I] L@0x1[scripts/dynamicmusic/player.lua]: activating playlist: DEFAULT_explore
[01:02:54.668 I] L@0x1[scripts/dynamicmusic/player.lua]: playing track: Music/Explore/mx_explore_4.mp3
[01:02:54.668 I] L@0x1[scripts/dynamicmusic/player.lua]: playing track: Music/Explore/mx_explore_6.mp3
[01:02:55.215 W] Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)
[01:02:56.739 I] Playing "music/explore/mx_explore_6.mp3"
[01:02:59.106 I] L@0x1[scripts/dynamicmusic/player.lua]: new music requested
[01:02:59.108 I] L@0x1[scripts/dynamicmusic/player.lua]: using DEFAULT soundbank
[01:02:59.109 I] L@0x1[scripts/dynamicmusic/player.lua]: playlist already playing so continue with current
[01:03:01.409 I] Changing to interior
[01:03:01.410 I] Unloading cell West Gash Region (-2, -3)
[01:03:01.415 I] Unloading cell Balmora (-4, -2)
[01:03:01.423 I] Unloading cell Ascadian Isles Region (-4, -4)
[01:03:01.432 I] Unloading cell Ascadian Isles Region (-2, -4)
[01:03:01.437 I] Unloading cell Balmora (-3, -2)
[01:03:01.458 I] Unloading cell Balmora (-2, -2)
[01:03:01.462 I] Unloading cell West Gash Region (-4, -3)
[01:03:01.466 I] Unloading cell Ascadian Isles Region (-3, -4)
[01:03:01.469 I] Unloading cell Balmora (-3, -3)
[01:03:01.479 I] Loading cell Balmora, Council Club
[01:03:01.625 E] Execution of script "k_in_soundscript" failed: no implicit reference
[01:03:01.697 I] L@0x1[scripts/dynamicmusic/player.lua]: new music requested
[01:03:01.697 I] L@0x1[scripts/dynamicmusic/player.lua]: using DEFAULT soundbank
[01:03:01.697 I] L@0x1[scripts/dynamicmusic/player.lua]: playlist already playing so continue with current
[01:03:07.692 E] Execution of script "k_in_soundscript" failed: no implicit reference
[01:03:09.321 E] Execution of script "k_in_soundscript" failed: no implicit reference
[01:03:18.641 I] Saving shader settings file: /crucial/Projects/MyOpenmw/steamdeck/openmw/config/shaders.yaml
[01:03:18.644 I] Saving Lua storage "/crucial/Projects/MyOpenmw/steamdeck/openmw/config/global_storage.bin" (547 bytes)
[01:03:18.645 I] Saving Lua storage "/crucial/Projects/MyOpenmw/steamdeck/openmw/config/player_storage.bin" (1476 bytes)
[01:03:18.645 I] Quitting peacefully.
[01:03:19.656 I] Saved input bindings: /crucial/Projects/MyOpenmw/steamdeck/openmw/config/input_v3.xml
Edited by GoodBetter