ID:162110
 
I have a object(obj/flute) when you have this flute you can Play() is causing music to start and the icon_state to change. You also have a Stop() where the icon_state changes back to normal. How can i have the music stop too?

flute
name = "Flute"
icon = 'turfs.dmi'
icon_state = "flute"
verb
Get()
set src in oview(0)
usr << "You get the flute."
Move(usr)
Play()
set category = "Inventory"
usr<< 'tapion.mid'
usr.playing = 1
usr.icon_state = "play"
Stop()
set category = "Inventory"
usr.playing = 0
usr.icon_state = ""

As you see the Stop() is always going to be in my Inventory tab as long as i have the flute object, how can i also have the Stop() only be available while im playing. so that its not always there. Mainly i want to know how to:
-Stop music from playing using the Stop() verb, and not just changing icon_state
-The Stop() verb only comes up while the player is usr.playing = 1
Use the sound() proc, and set the file, were you would normally define the file that needs to be played, to being null.

Just make sure you set a channel when playing the file, and when sending the null file use the same channel.
just use this copy and paste it then put ur portals in it and the midi file ull love it so much more

map1to2
turf
all
house
door3
icon = 'mapstuff.dmi'
icon_state = "portal3"
Entered(mob/M)
if(istype(M,/mob))//is it a mob that entered?
M<<sound(null)
M<<sound('7scastle.mid',repeat=1)
M.loc=locate(32,62,1)//if it is a mob move it to the x,y,z coordinates
name = "portal3"
door2
icon = 'mapstuff.dmi'
icon_state = "portal4"
Entered(mob/M)
if(istype(M,/mob))//is it a mob that entered?
M<<sound(null)
M<<sound('map.mid',repeat=1)
M.loc=locate(3,10,1)//if it is a mob move it to the x,y,z coordinates
In response to Opop1
Don't provide bad, irrelevant advice to people.
Make Stop() into a proc (so that it isn't a verb by default), then add it to the verbs list whenever you start playing:

flute
verb
Play()
usr << sound('tapion.mid')
verbs += /flute/proc/Stop
verbs -= /flute/verb/Play
proc
Stop()
usr << sound(null)
verbs -= /flute/proc/Stop
verbs += /flute/verb/Play
In response to Garthor
K thnks Garthor, ill try it when i get home from school, XD.