Sound Questions

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: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Sound Questions

Post by Gambit37 »

OK, some sound related questions

1) How do I play different sounds for different types of doors opening/closing? Is there a property I can set in door archs, I couldn't find one?
2) How do I play a "one-shot" ambient sound? (Not looped)
3) Related to #2, there seems to be a "noloop = false" exvar, but it doesn't work? At least, I have that exvar on one of my sound objects, no idea where it came from :-?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Graphics Replacement in DSB

Post by Sophia »

Gambit37 wrote:How do I play different sounds for different types of doors opening/closing? Is there a property I can set in door archs, I couldn't find one?
Yes, it's move_sound.
Gambit37 wrote:How do I play a "one-shot" ambient sound? (Not looped)
Set the exvar no_loop to true. (Don't forget the underscore!)
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Sound Questions

Post by Gambit37 »

Sorry about putting those questions in the graphics thread, oops!

It appears that all door sounds are played four times: is this hardcoded or can I override it? I know I could play a local "one_shot" ambient sound instead using dungeon mechanics, and set the door itself to silent, but I wondered if there's a way of overriding the four repeats in the arch itself?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Sound Questions

Post by Sophia »

It's hardcoded. However, this is something that is easy for me to change in the base code.

For 0.55, you'll be able to specify, by doing this:

Code: Select all

obj.my_door.move_silent = true
obj.my_door.open_sound = snd.one_time_clank
obj.my_door.close_sound = snd.one_time_clank
obj.my_door.reverse_sound = snd.one_time_clank
(Open and close sound should be obvious; reverse sound is what plays if the door bangs into something on the way down and changes direction)
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Sound Questions

Post by Gambit37 »

Sophia wrote:(Open and close sound should be obvious; reverse sound is what plays if the door bangs into something on the way down and changes direction)
He he, awesome :-)
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Sound Questions

Post by Gambit37 »

Can I stop a looped sound attached to a monster?

I revisited my code for the buzzing insect that swaps between a walking state and a flying state. When I use qswap to switch the flying version to the walking version, the looped flying sound effect is still playing and gets "left behind" on the tile where the creature was last in its flying state.

How do I fix this?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Sound Questions

Post by Sophia »

In whatever code that you do the dsb_qswap, you also need to call stop_sound_handle with an appropriate description. For example, if you have a looping step_sound, do this:

Code: Select all

stop_sound_handle(id, "step_sound")
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Sound Questions

Post by Gambit37 »

Aha, right, I didn't know about this function. Where should this go in the Wiki, since it's not a dsb_ function?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Sound Questions

Post by Sophia »

We should probably make a separate page for utility functions that are defined as part of the base code.
Right now, what little documentation there is about these is mixed in with the dsb_* functions.

On the other hand, I'm not sure if the end user reading the documentation cares whether the function is defined as part of the base code or as part of the core-- they just want to know what the functions are. So maybe we should just mix them in and change the name of the page.
Post Reply