Howdy, Stranger!

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

(replace:) macro is adding a lot of unwanted white space.

Hello all,

I'm using the (replace:) macro. When I click on the associated text, it replaces it properly, but also adds a lot of white space to the page, forcing other parts of the text very low (or even off) the page.

I'm using these guys: { }
And I thought they would remove white space. Maybe there's something about that I'm not understanding?

Here's a bit of code from one such page:
{
(else-if: $sFruitHave is true)[**Moonshine Mike:** *Tell you what, traveler. If you give me (print: $south's fruit), I'll give you a bottle.*

<BR><BR>

[Trade]<trade1|

(click: ?trade1)[

	(set: $sFruitHave to false)
	(set: $boozeHave to true)
	(replace: ?trade1)[I gave him (print: $south's fruit) and he 
	handed me a bottle.]

				]
								]
}

I thanked him and headed back.

When I run the page, with $sFruitHave set to true, and then click ?trade1, it displays something like this:
I gave him the fruit and he handed me a bottle.







I thanked him and headed back.

That's seven lines of blank space added! And I don't know where it's coming from! Ack!

Any ideas?

Many thanks in advance.

-James



Here is the entire page in question, in case that helps:
Inside the shack was a guy with bushy hair and a rainbow scarf.

He had a distillery cooking in the back. 

{
(if: $boozeHave is true)[**Moonshine Mike:** *Hope you are enjoying what I gave you, friend.*]

(else-if: $boozeHave is false)[**Moonshine Mike:** *Finish that up already? Well I'm not allowed to sell you more. That's the law around here.*]

(else-if: $nFruitHave is false and $sFruitHave is false and $eFruitHave is false and $wFruitHave is false)[<BR><BR>**Moonshine Mike:** *Tell you what, traveler. Bring me some fruit and I'll give you a bottle.*]

(else-if: $sFruitHave is true)[**Moonshine Mike:** *Tell you what, traveler. If you give me (print: $south's fruit), I'll give you a bottle.*

<BR><BR>

[Trade]<trade1|

(click: ?trade1)[

	(set: $sFruitHave to false)
	(set: $boozeHave to true)
	(replace: ?trade1)[I gave him (print: $south's fruit) and he 
	handed me a bottle.]

				]
								]

(else-if: $eFruitHave is true)[**Moonshine Mike:** *Tell you what, traveler. If you give me (print: $east's fruit), I'll give you a bottle.*

<BR><BR>

[Trade]<trade2|

(click: ?trade2)[

	(set: $eFruitHave to false)
	(set: $boozeHave to true)
	(replace: ?trade2)[I gave him (print: $east's fruit) and he 
	handed me a bottle.]

				]
								]

(else-if: $nFruitHave is true)[**Moonshine Mike:** *Tell you what, traveler. If you give me (print: $north's fruit), I'll give you a bottle.*

<BR><BR>

[Trade]<trade3|

(click: ?trade3)[
	(replace: ?trade3)[I gave him (print: $north's fruit) and he 
	handed me a bottle.]
	(set: $nFruitHave to false)
	(set: $boozeHave to true)
	
				]
								]
								
(else-if: $wFruitHave is true)[**Moonshine Mike:** *Tell you what, traveler. If you give me (print: $west's fruit), I'll give you a bottle.*

<BR><BR>

[Trade]<trade4|

(click: ?trade4)[

	(set: $wFruitHave to false)
	(set: $boozeHave to true)
	(replace: ?trade4)[I gave him (print: $west's fruit) and he 
	handed me a bottle.]

				]
								]

}

I thanked him and headed [[back|sArea]].
<hr>\
[INVENTORY]<inv|(click: ?inv)[(set: $lastPassage to "sAreaSecret")(goto: "inventory")]

Comments

  • Welp. I figured out a workaround.

    I just put all the code using (replace:) below the last line ("I thanked him and headed...")

    That way whatever blank space it is adding gets added at the very bottom of the page.

    I'd still like to know what the problem is with (replace:), if anybody knows.

  • Generally each line-break you add to your passage content is converted to a HTML br element.

    The Collapsing whitespace markup only works on content that being display at the time the passage is show to the Reader, the content within the (replace:) macro is not displayed until after the link is selected so it's contents is not processed as shown by the following example.
    {This text will not contain any line-breaks
    when it is displayed
    because of the Collapsing Whitespace Markup.
    
    [Click Me]<link|
    
    (click: ?link)[
    This replacement text will contain line-breaks
    because it was appead to the page after the 
    Collapsing whitespace markup had finished processing
    the page content.]
    }
    

    If you want the content of the (replace:) macro to have the line-breaks removed then you will also need to use Collapsing Whitespace markup within the macro's associated hook.
    {This text will not contain any line-breaks
    when it is displayed
    because of the Collapsing Whitespace Markup.
    
    [Click Me]<link|
    
    }(click: ?link)[
    {This replacement text will also not contain 
    any line-breaks because it includes it's own 
    Collapsing whitespace markup.}]
    
  • greyelf: Brilliant! Thank you. That will make cleaning up the code in my game a LOT easier. Thanks.
Sign In or Register to comment.