0 votes
by (460 points)
edited by

Hi,

 

Here are two codes :

Action :
<<if not $Start>><<link "Let's Start">><<set $Start to true>><<script>>state.display(state.active.title)<</script>><</link>><<else>><<include "Dropdown">><</if>>
Who's there :

and the include passage :

<span class="Observantchoice"><<link "Search">><<lookaround>><<script>>state.display(state.active.title)<</script>><</link>></span><br>
\<<if $Manor is "Laboratory">><<if $Labo_book is 1>>blablabla<</if>><br>
\<<if $Labo_note is 1>><<link "Take the note">>blablabla<</link>><</if>><</if>>

And I always got a space between "Search" and "Who's There" because of the two last line of Dropdown passage.

 

I don't understand why, I do multiple combinaison of \ and <br>, and always this space ...

 

1 Answer

+1 vote
by (68.6k points)
selected by
 
Best answer

You're always seeing line breaks there because you've misplaced your <br> elements.  The following:

<</link>></span><br>
\<<if $Manor is "Laboratory">><<if $Labo_book is 1>>blablabla<</if>><br>
\<<if $Labo_note is 1>><<link "Take the note">>blablabla<</link>><</if>><</if>>

Should look something like this instead:

<</link>></span>
\<<if $Manor is "Laboratory">><<if $Labo_book is 1>><br>blablabla<</if>>
\<<if $Labo_note is 1>><br><<link "Take the note">>blablabla<</link>><</if>><</if>>

Notice how I placed the <br> tags are within each of the nested <<if>> macros, leading the content.


PS: The following is v1 code:

<<script>>state.display(state.active.title)<</script>>

While it works because of compatibility shims, you really should not be using it in v2.  The correct way to do that in v2 would be one of the following:

<<script>>Engine.play(State.passage)<</script>>

That said, you don't need to do that either.  In the examples you've shown, you don't need it as the <<link>> macro takes a second argument which is the passage to forward the player to when activated.  Thus the following two links:

<<link "Let's Start">><<set $Start to true>><<script>>state.display(state.active.title)<</script>><</link>>

<<link "Search">><<lookaround>><<script>>state.display(state.active.title)<</script>><</link>>

Would be better written as:

<<link "Let's Start" `passage()`>><<set $Start to true>><</link>>

<<link "Search" `passage()`>><<lookaround>><</link>>

I used the passage() function in the above example, instead of State.passage, as it's a bit shorter to type.  They're mostly equivalent, however, so use whichever you prefer.

Finally.  In cases where you might want to use logic internal to the <<link>> to determine where it sends the player, then you're probably better off using the <<goto>> macro.  For example:

<<link "Do the thing!">>
	<<if /* a condition */>>
		<<goto "Passage A">>
	<<elseif /* another condition */>>
		<<goto "Passage B">>
	<<else>>
		<<goto "Passage C">>
	<</if>>
<</link>>

 

by (460 points)
Hi thx for the answer TheMadExile, work perfect.

And thx for the P.S. ^^.

 

So, I mark it has answered.
...