Music Widget only plays one song

Music Widget only plays one song

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Music Widget only plays one song

Post by Forboding Angel »

then stops. If shit gets destroyed, then it will play one war track and then stop.

Can someone please help maek fixie?

http://code.google.com/p/evolutionrts/s ... /music.lua
User avatar
KingRaptor
Zero-K Developer
Posts: 838
Joined: 14 Mar 2007, 03:44

Re: Music Widget only plays one song

Post by KingRaptor »

The way Spring.GetSoundStreamTime() works was apparently changed in 84.0. It now returns (0, 0) if there is no running track (e.g. if the last one already ended).

See line 181

Code: Select all

-if ( (musicType ~= lastTrackType and musicType == 'war') or (playedTime > totalTime)) then
+if ( (musicType ~= lastTrackType and musicType == 'war') or (playedTime == 0 and totalTime == 0)) then

or you could just change the > to a >=
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Music Widget only plays one song

Post by Forboding Angel »

Thanks KR. The transitions are actually a little nicer now from song to song it seems, so that's a win.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Music Widget only plays one song

Post by Forboding Angel »

Arugh, when it switches to war tracks it starts playing two at once :-(

pastebin of current widget:

http://pastebin.com/rVAEvPkJ
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Music Widget only plays one song

Post by Forboding Angel »

KR helped me fix it.

Needed moar stopsoundstream.
Post Reply

Return to “Lua Scripts”