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

Custom macros in Harlowe?

$
0
0
I have used Twine a pretty good amount and am getting into its more advanced features, and wanting to extend it to do some more advanced things. I've searched far and wide, but am finding it difficult to find the answer to this one question: Is it possible to create custom macros in Harlowe? And if so, how would I go about implementing one?

For example, I want to make a macro that will compute the intersection of two arrays; that is, given two arrays:

a1["a", "b", "c", "d"], a2["c", "d", "e", "f"]

I want to be able to compute the common elements between the two:

result["c", "d"]

I have a good idea for how to do this in Javascript; I just need to know the exact syntax for the Story Javascript section to be able to call it in Twinescript:

(intersection: $a1, $a2)

Thank you for any help/insight! :)

Viewing all articles
Browse latest Browse all 1844

Trending Articles