Howdy, Stranger!

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

Passage won't link to another?

edited November 2016 in Help! with 2.0
Sugarcube 2.11.0

I hesitate to ask for fear of getting told off for not paying attention and checking my code properly, but can someone explain why this code won't result in a link to a passage named 'village'. I know the game auto-creates the passage if it doesn't exist, and was surprised when it failed to do so. So I created the passage afterwards and it still won't link the two.

NB: When I say won't link, I mean there's no line connecting the two on the Game Grid.

I've double checked the spellings match.
\ The car's been ransacked more than once and a thorough search reveals nothing of value.
\ <<if $hasGas>><<link "Two wires" "village">><<audio "car_start" play>><</link>> hang from the broken plastic under the steering wheel.
\ <<else>>
\ <<link "Two wires">><<audio "car_fail" play>><</link>> hang from the broken plastic under the steering wheel.<</if>> 

The road <<link "contines" "road">><</link>> on.

Comments

  • edited November 2016
    Okay, so in-game it works, but odd that there's no line on the grid, yes?
  • edited November 2016
    Twine 2 only recognizes double square bracketed links—e.g. link. Programmatic links offered by the various story formats are not recognized, thus no story map linkage lines are drawn and passages are neither automatically created or updated via modifications of said links, or vice versa.

    There are plans to allow story formats to help out with this—allowing them to tell Twine 2 that a link exists. That said, links that cannot be resolved until run time will never be able to be automatically handled by Twine 2.


    And now for a few suggestions.

    You're repeating yourself again with the following:
    \ <<if $hasGas>><<link "Two wires" "village">><<audio "car_start" play>><</link>> hang from the broken plastic under the steering wheel.
    \ <<else>>
    \ <<link "Two wires">><<audio "car_fail" play>><</link>> hang from the broken plastic under the steering wheel.<</if>>
    
    I'd suggest the following instead:
    \ <<if $hasGas>><<link "Two wires" "village">><<audio "car_start" play>><</link>>
    \ <<else>><<link "Two wires">><<audio "car_fail" play>><</link>>
    \ <</if>> hang from the broken plastic under the steering wheel.
    
    Or the equivalent:
    \ <<link "Two wires">>
    	<<if $hasGas>>
    		<<audio "car_start" play>>
    		<<goto "village">>
    	<<else>>
    		<<audio "car_fail" play>>
    	<</if>>
    <</link>> hang from the broken plastic under the steering wheel.
    


    I'm unsure why you're using <<link>> rather than a regular link markup in the following:
    The road <<link "contines" "road">><</link>> on.
    
    And you also misspelled "continues". I'd suggest the following instead:
    The road [[continues|road]] on.
    
  • edited November 2016
    Uum, yes, I'm unsure too. I think I thought you had to use <<link>> if you needed the link to say something other than the name of the passage it was going to. Didn't know about goes to this passage

    Can you just confirm my game will operate correctly even though there's no visible line linking the 'village' passage on the Game Grid.
  • edited November 2016
    The normal link markup—i.e. double square bracketed links—allow the following in all current Twine 2 story formats:
    [[passage_name]]
    [[link_text|passage_name]]
    [[link_text->passage_name]]
    [[passage_name<-link_text]]
    
    NOTE: Do not add leading/trailing whitespace around the components within double square bracketed links as the current Twine 2 release erroneously treats the whitespace as significant—i.e. foo will create a passage named " foo".

    SEE: Markup > Links for SugarCube v2's link markup documentation.
Sign In or Register to comment.