ID:231903
 
Keywords: music, sound
Code:
mob/verb
music_stop()
set name = "Music Stop"
set hidden = 1
usr<<sound(null)
return


Problem description: I have music playing when the game starts and the verb is listed as a menu item, but will not work when I click it. The music continues to play, regardless. I'd like it to stop any sounds when the verb is activated.

Try using a specific channel
src<<sound('Music.mid',channel=1)
src<<sound(null,channel=1)
Nothing, unfortunately. It still refuses to null sounds.

Here is an example of my next bit, upon log in (without edits).

mob/Login()
usr.loc=locate(8,7,1)
usr<<sound('To the Sky.ogg', repeat=1)
return
Are you sure the verb is being called? Try adding a simple text output to the user to be certain.
I re-edited the post right before, but I suppose a recap of both would be.

mob/Login()
usr.loc=locate(8,7,1)
usr<<sound('To the Sky.ogg', repeat=1)
return

mob/verb
music_stop()
set name = "Music Stop"
set hidden = 1
usr<<sound(null)
return


Another re-edit, I added your idea and it's apparently not being called, I'm not sure why. Should I provide a screenshot of my menus on interface? Also, new verb code.

mob/verb
music_stop()
set name = "Music Stop"
set hidden = 1
usr<<output("Yup...", "output1")
usr<<sound(null, channel=1)
return
A thing of note, you don't need to call return at the end of every procedure, as it's already called by default.

I'm not quite sure why you would give a name to a hidden verb. Are you calling "music-stop" or "Music-Stop"?
@LordAndrew

Another edit, I removed the name and made sure it was calling "music_stop" but it doesn't seem to be responding, the text input won't even work.

mob/verb
music_stop()
set hidden = 1
usr<<output("Yup...", "output1")
usr<<sound(null, channel=1)
return
_s should be typed as -s for interface commands.
In response to LordAndrew
LordAndrew wrote:
A thing of note, you don't need to call return at the end of every procedure, as it's already called by default.

I'm not quite sure why you would give a name to a hidden verb. Are you calling "music-stop" or "Music-Stop"?

If its text based like a MUD for example, you would do this ..
In response to Ryu-Kazuki
Ryu-Kazuki wrote:
@LordAndrew

Another edit, I removed the name and made sure it was calling "music_stop" but it doesn't seem to be responding, the text input won't even work.

> mob/verb
> music_stop()
> set hidden = 1
> usr<<output("Yup...", "output1")
> usr<<sound(null, channel=1)
> return
>


Silly question but are you SURE that is the correct output name? output1 ?
I just removed it from hidden to test it normally, and it will work, there must be something wrong with my menu. In any case, I appreciate all the help you guys gave me, and as well any you may continue to.

Edit: And yes, that's the correct output.