ID:134369
 
So here is how the current sound proc works.

sound('example.midi',1,1,8,100)

Example.midi being the name of the soundfile and the extensions that BYOND supports...

1 being to repeat

1 being to wait for the current sound to wait

8 to play on chennal 8

and 100 to play at full volume.

What I would like to see is an extra var, a delay time. This way to make codeing a bit easier. It will delay itself for x amount of milliseconds before repeating itself again. :)

ex, sound('example.midi',1,1,8,100,600) //Play every minute.
A MIDI set on repeat will automatically restart from the beginning, and a Mod with loop instructions should loop as according to those. Why is the delay needed?

Lummox JR
Why not put a delay in the MIDI file?
In response to Lummox JR (#1)
Perhaps an alert that repeats every 30 seconds hm? Such as those featured in Star Trek and the famous game Star Ocean, and it shouldn't me limited to midis either.
In response to Stevenw9 (#3)
Having a sound effect played once every 30 or so seconds would be much better handled with a loop in your own code, so you'd be able to stop the sound from playing simply by no longer attempting to play it again.
In response to Jtgibson (#4)
Loops require more processing power and not only that, but I have to time the spawn() correctly and use a variable to know when to start/stop it and make sure I call it on the right people... the whole point of my suggestion was to make it simple and easier, especially for people who are starting to pick up BYOND's programming now.
In response to Stevenw9 (#5)
Stevenw9 wrote:
Loops require more processing power and not only that, but I have to time the spawn() correctly and use a variable to know when to start/stop it and make sure I call it on the right people...

Uh, a loop isn't going to require any more processing power than any delay mechanism you propose building in. Moreover, how hard is it to time a spawn() for 30 seconds? spawn(300). Easy.

As for making sure the right people hear the sound, just find the right mobs every time through the loop. This is not difficult, and in fact is necessary if you want the sound to be limited by where people are, etc.

the whole point of my suggestion was to make it simple and easier, especially for people who are starting to pick up BYOND's programming now.

There's nothing simpler and easier about what you're proposing, except that it gets you out of having to solve an incredibly simple problem on your own. That would be at the expense of having a solution that doesn't work the way you want it to, that pretty much nobody else would ever need. There's no value in implementing your suggestion.

Lummox JR