Stopping sounds with a lost sound handle?

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Stopping sounds with a lost sound handle?

Post by Gambit37 »

I seem to lose the sound handle of background sounds when restoring a save game. But DSB is still playing that sound upon restore -- and I can't stop it without a handle ID.

Is there a way to either

* ensure the handle is retained when saving?
* or stop all sounds upon restore even if the handle has been lost (and then run my own code to re-initialise and re-start any necessary sounds -- mainly background ambience)
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Stopping sounds with a lost sound handle?

Post by Sophia »

You can save the handle by putting it in a variable that you dsb_export, or adding it to an exported table. If you control background sounds with some object in the dungeon, you can also store it in that object's exvar which is also saved.

This should probably do what you want it to, but I could add some brute-force way to stop all sounds if that is needed.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Stopping sounds with a lost sound handle?

Post by Gambit37 »

Great, thanks, I'll see if storing the sound handle upon save works.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Stopping sounds with a lost sound handle?

Post by Gambit37 »

So after a lot of experimenting, I think a brute force stop_all_sounds() function would be very, very useful. Please would it be possible for you to add one?
Post Reply