Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

[Twine2.1.1][Sugarcube 2.14] Is there a way to call a macro from JavaScript?

$
0
0
Hey there,

I'm getting tired of duplicating my JS code to define a macro and then define a normal JS function to do exactly the same thing.
Is there a way for me to invoke a macro that I previously defined in JS inside a JS function?

Simple place holder code:
Macro.add('MySugarCubeMacro',
{
    handler: function()
    {
       console.log ("MySugarcubeMacro() invoked!");
    }
});

window.macro_invoker = function()
{
    // i have no clue how you do this...
    Macro.Invoke("MySugarCubeMacro");
}

Thank you for your answer!

Viewing all articles
Browse latest Browse all 1844

Trending Articles