ID:166240
 
I'm working on a jukebox for my game, I can't seem to create a code that works.

I need a code that, you can add music to a list, and then when you or someone else clicks it, you can play other music that someone added. Can anyone show me how to do that?
obj/jukebox
var/list
sounds = list("default" = 'def.mid', "default2" = 'def2.mid') // list of sounds
verb/Playsound()
set src in oview(1)
var/Sound = input("Which one?") in sounds
usr << sounds[Sound] // play Sound to usr

obj/jukebox/JukeBox1
sounds = list("DefaultSpecial" = 'defspecial.mid')
...


and then to add:

obj/jukebox/verb/addsound(s as sound)
set src in oview(1)
sounds[copytext(s, 1, findtext(".dmi"))] = s


Something like that should work. =)
In response to DivineO'peanut
I dont understand the findtext(".dmi") part, what exactly does that do, and what does it have to do with dmi files?
In response to Jay1
Jay1 wrote:
I dont understand the findtext(".dmi") part, what exactly does that do, and what does it have to do with dmi files?

Whoops, I meant that to be mid =p.