ChapelR / custom-macros-for-sugarcube-2

A collection of systems and macros for Twine.
https://macros.twinelab.net/
The Unlicense
166 stars 44 forks source link

On-event doesn't properly utilize capture #59

Closed killamocingbird closed 2 years ago

killamocingbird commented 2 years ago

This code doesn't work

<<for _idx, _title range $player.titles>>
    <<capture _title>>
        <<on "click" `"#char_" + _title`>>
            <<set $selected_title = _title>>
            <<popover>>
                <<include titleTutorial>>
            <</popover>>
        <</on>>
    <</capture>>
<</for>>

Specifically, when the event is fired, $selected_title is always set to the last title (IE not the _title that was captured).

ChapelR commented 2 years ago

Thanks for the issue. I'll add support for capture when I have time.

ChapelR commented 2 years ago

Sorry this took so long.