Label Macro via Variable

  • Hi!

    I need help with labeling macros with variables.

    The macro does this:
    1: SetGlobalVar "FadeX" ("What fade time?")

    2: Label Macro 306 "FadeX Time = "$FadeX" "

    If I set variable "FadeX" to be 1, the macro is labeled "FadeX Time = 1", but if I use punctuation, i.e "1.4", the macro is still labeled as "1".
    Same thing with "0.4", will give me a label of "FadeX Time = 0"

    Any tips?


  • even if fixing your quote inside quote issue:

    Label Macro 306 "FadeX Time = "$"FadeX"

    what you are trying to do is not possible, as dot is not a valid character for object name.

    e.g. try directly

    Label Macro 306 "FadeX Time = 1.4"

    and look at commandline history

  • punctuation characters will be stripped when naming objects

    there is no way to have e.g. dot as part of the name.

    to avoid having 1.2 being changed to 12, you could label via Lua, and in that process replace the dot with a valid character

    e.g. replace dot with s, so "1.2" is displayed as "1s2" instead of "12"

    1.  SetGlobalVar "FadeX" ("What fade time?") 

    2.  Lua "DataPool().Macros[306].Name='FadeX Time = '..GetVar(GlobalVars(),'FadeX'):gsub('%.','s')" 

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!