Another Bard Mudlet Question

ZiliasZilias Member Posts: 24 Apprentice
I am hoping somebody has done this. Due to there being no line to trigger off of in regards to a song ending, how are people keeping there songs up? Is there a way to trigger to refrain when a song is dying out, or maybe use a timer of some sort? 

Once a song is up, it dies in 270 second unless you refrain it, so I have been trying to set up a way to have it refrain when the time is right. Any input on this would be greatly appreciated!
image

Comments

  • YarithYarith Member Posts: 997 Mythical
    edited December 2016

    There are a few ways to approach this but I think the correct way it to use a bound tempTimer.  Personally I'd do something like this:

    if not resong_timer_id then
        resong_timer_id = tempTimer( <delay in seconds>, [[ send("perform refrain <songname> [target]") ]])
    else
        killTimer(resong_timer_id)
        resong_timer_id = tempTimer( <delay in seconds>, [[ send("perform refrain <songname> [target]") ]])
    end

    I'd have this triggered to whatever stanzas I'd be comfortable refraining on and fugue lines. This can probably be optimised or done in a neater fashion but it's what I used when I was just starting out and I've not seen the need to change it.

    EDIT: Reading back over this I think the word 'bound' is probably misleading because the timer isn't actually bound in anyway. tempTimers, like pretty much everything else in mudlet, return their location. You can think of it as returning a copy of itself. If you don't assign a variable to the tempTimer's location you'll end up instantiating a new one each time you refrain and, if you manually refrain by using crowcaw or any other triggered stanza active, x seconds down the track your subsequent tempTimers will all fire in series and send you in a refraining sequence. This is why you check for an existing tempTimer and purge it first if it exists before replacing it.

    Post edited by Yarith on
    (I'm the mom of Hallifax btw, so if you are in Hallifax please call me mom.)

    == Professional Girl Gamer == 
    Yes I play games
    Yes I'm a girl
    get over it
Sign In or Register to comment.