XPMCK icon indicating copy to clipboard operation
XPMCK copied to clipboard

Add #NEXTSONG kind of directive

Open bazz1tv opened this issue 7 years ago • 0 comments

As of now, only the #SONG n directive exists, which requires a hard-coded index for each and every song. I don't like it. For my coding style I need something less explicit and more dynamic and automated.

With this dynamic style, if songs (which in itself is a misleading directive name, as you could put any audio there including SFX. so yeah, I might actually rename the whole directive to something like ENTRY) were to be "un-included" based on the existence of definitions, then a song list can still be created "without gaps"

I would like to create the option to dynamically set the song indices. In fact, simply adding support for the #SONG directive without an argument would be sufficient

#SONG 1
#INCLUDE "song1.mml"
#SONG
#INCLUDE "song2.mml"

#SONG 50
#INCLUDE "sfx.mml"
#SONG
#INCLUDE "sfx2.mml"

In this case, song2 would be given the index of 2, and sfx2 would have an index of 51

Implementation Notes

  • have song_index state variable, set to 1 at startup
  • if a #SONG directive is encountered with an argument, set the song_index to that argument
  • if a #SONG directive is encountered without an argument, increment the song_index and set that song's index to the incremented value.

bazz1tv avatar Jun 18 '17 04:06 bazz1tv