Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Feature request - more informative link arrows between passages

Because I'm more comfortable with a more featured programing language (even if javascript is a giant pile of terrible) and I keep adding game-type complexity to my twine story I find myself falling back to macros + javascript to generate many of my passages.

This is fine and works well enough (really wish I could have the javascript view visible at the same time as browsing passages, oh well) but it makes the overview page somewhat misleading as twine is unable to suss out links between passages that are being generated entirely in javascript.

Parsing function calls to suss out what they would generate, while an interesting problem, is probably excessively out of scope for twine development, but would it be possible to add a feature where, as a story writer, I could manually add arrow links between passages just for my own recordkeeping? They could/should be a different color to signify their comment rather than deduced nature, but it would still be nice to have.

Related, it would be quite nice if, rather than all passage links being the style of arrow, there were two types - the current "solid" arrows for links that are always possible, and a dotted-line arrow for links that are conditional (ie: appearing in if/else/switch statements), even fancier to incorporate the same for goto's.

If there's interest in the above I might be willing to help on the development side - I hate UI development with the combined nuclear intensity of every star in the galaxy but if someone wanted to pair up with me to handle that side of things and just dump the parsing logic on my plate I could code that back-end logic.

Comments

  • edited April 2017
    I don't know if this works across all story formats, but Twine 2.1.1 with Sugarcube 2.14 draws link arrows for links for any and all text it finds between square brackets, regardless of where those square brackets are. This has benefits and drawbacks:

    Manual arrows
    You can manually force arrows via passage comments:
    /* [[myPassage]] */
    
    This will create an arrow to a passage called myPassage

    Automatic arrows
    You can have arrows automatically created for your macros if you use the square bracket notation for passage names in your variables and then trimming off the brackets later on in your JavaScript:
    <<customMacro "[[myPassage]]">>
    
    This will create an arrow to a passage called myPassage
    Macro.add("customMacro", {
        handler: function () {
            Engine.play(this.args[0].slice(2,-2));
        }
    });
    
    Adding slice(2,-2) gets rid of the brackets so your code keeps working.


    Accidental buggy arrows
    And last but not least, you can create horrific monstrosities by trying to build a passage string via concatenation:
    <<set $next_passage to  "[[" + $someVar + "]]">>
    
    This will create an arrow to a passage called " + $someVar + ", quote marks and all. This will even automatically create a passage with that name if it does not already exist.

    Be very very careful about renaming such passages if you accidentally create them. I have not been able to reproduce the error since, but on one occasion I managed to pretty badly corrupt a story file while fiddling with this stuff. I suspect there's some kind of code injection vulnerability going on with passage names, but I have not been able to nail down exactly where or why.
Sign In or Register to comment.