Revision of Twine: "link-and-set" syntax possibilities from Tue, 05/07/2013 - 21:25

One thing I've been thinking about is the addition of links that, when clicked, set or alter variables while simultaneously going to passages. Many would agree that this could potentially simplify a number of Twine coding cases.
A proprietary "Twine clone" program called AXMA has this functionality in the form of this extension to the link syntax:

[[Kiss her once|Flower Patch{$kisses = 1}]]
[[Kiss her twice|Flower Patch{$kisses = 2}]]
[[Kiss her four times|Flower Patch{$kisses = 4}]]

As in, an additional parameter after the passage name, enclosed in curly braces, that contains a <<set>>-style declaration. I feel ambiguous about this syntax - it seems like it doesn't mesh with the rest of Twine's syntax, using curly braces just for this one occurrence.

In my mind, I've been turning over a possible alternative, one which continues the use of the pipe character as a separator between parameters of the link syntax:

[[Kiss her once|Flower Patch|$kisses = 1]]
[[Kiss her twice|Flower Patch|$kisses = 2]]
[[Kiss her four times|Flower Patch|$kisses = 4]]

I was thinking of writing a script to add this, but then I noticed that this can be replicated in Twine already, simply by combining my <<insert>> and <<goto>> macros:
<<insert "rush off">><<set $stealth = 0>><<goto "Glasshouse">><<endinsert>>
<<insert "sneak off">><<set $stealth = 1>><<goto "Glasshouse">><<endinsert>>

What I like about this is that it's extensible - any quantity of macros can be placed inside the <<insert>> as long as it finishes with <<goto>>. It also makes use of already extant macros in a clever way.
Of course, its main flaw is that it's altogether a bit too verbose to be used all that often. So, I'm still considering whether to create that link syntax extension, and what form it might take.

P.S: This example, I think, reveals an under-appreciated genericity in <<insert>>/<<replace>> that I didn't notice before. I'm considering making a short alias to <<insert>>, called <<link>>. While its functionality would of course be identical to <<insert>>, it would be meant for use by the author in making a "custom link" - a link that executes a set of enclosed macros when clicked. I like this notion of encouraging authors to combine these macros to create higher-level link functionality.

(Of course, this requires the use of "immediate macros" - macros that run immediately. These only include <<set>>,<<remember>>, <<display>> (when made to display other immediate macros), <<refresh>> (in Sugarcane only), my <<timed...>> macros (including <<goto>>), <<toggletag>> etc. and <<playsound>> etc.)