ID:146555
 
Code:
mob/Admin/verb/Music(S as sound){set category="GM";world << sound(S,1)}


Problem description:
The code works, but I'm trying to get that sound code to work the way I want it to. It won't because when I run my game and play a sound, it plays over and over and over. How do I get it that it only plays once?
Jay1 wrote:
Code:
> mob/Admin/verb/Music(S as sound){set category="GM";world << sound(S,1)}
>

Problem description:
The code works, but I'm trying to get that sound code to work the way I want it to. It won't because when I run my game and play a sound, it plays over and over and over. How do I get it that it only plays once?

It repeats because you put in a second argument, and "1" at that. This is the prototype for sound:

sound(file,repeat=0,wait,channel)

In response to Audeuro
Gave me a few errors. I took out wait and channel and now I have this error:

TestSoundVerb.dm:1:error:file:undefined var
In response to Jay1
Nevermind, I fixed my own problem. I was just screwing with it and all I had to do was change (S,1) to (S,0)

Thanks,
Jay1
In response to Jay1
Jay1 wrote:
Nevermind, I fixed my own problem. I was just screwing with it and all I had to do was change (S,1) to (S,0)

Thanks,
Jay1

You don't even need the second argument, unless you want the sound to loop back, or want the other two arguments. ( the second argument defaults to 0 )
In response to Jay1
Lol, I was about to suggest that until I read you fixed it, anyway lemme explain how I learned it. I learned that 0 = null in this Verb, meaning it's only gonna play once. 1 = Repeat like on a stereo. Lol, oh well I gave it a shot.
In response to Audeuro
In response to Jay1
... What is it ...
In response to Chwgt
okay i have a object that has a verb, when it does the verb, i want a sound to play. whats the code to insert that it plays when i do the verb? yeah, the file is in the folder with my game
In response to Jay1
obj/JukeBox/verb/Play( S as sound )
usr << sound( S )


To play it for the user.
In response to Audeuro
Audeuro wrote:
> obj/JukeBox/verb/Play( S as sound )
> usr << sound( S )
>

To play it for the user.

Of course that would work, but if you wan't it to be pre-loaded into the Jukebox then:

obj/JukeBox/verb/Play()
switch(input("What song?","Jukebox")in list("1","2"","Cancel"))
if("1")
usr << sound('Song 1.mid',0)
if("2")
usr << sound('Song 2.mid',0)
if("Cancel")
return


That should work.


~C
In response to Chwgt
Ah,thats what I needed C, thanks.
In response to Jay1
Np.
In response to Chwgt
1) Chris, you added an extra >"< thingy.
2) If the jukebox isn't supposed to be in the players inventory, you can make it so the verb appears if it's 1 step away.

set src in oview(1)


Put that before the switch statement.
In response to Mega fart cannon
Typos happen.