0 votes
by (200 points)

Using Harlow 1.2.3 and in some of the passages where I am using (if:) and (else:) commands my automatic [[links]] aren't creating new passages. I have tried making new passages with matching names but it does not seem to have helped. 

For example I created a passage which says

{
(if: $fireball is false)[
[[Scream]]
[[Punch]]]
}
{
(else: $fireball is true)[
[[Scream]]
[[Punch]]
[[Cast fireball]]]
}
but "Cast fireball" is the only link that works. 
Any advice? 

1 Answer

+1 vote
by (159k points)

There are a number of syntax issues/errors with your example:

1. The (else:) macro doesn't accept a parameter.

Generally if you need to check for a series of related conditions then you would use an (if:) macro and an (else-if:) macro structure like the following:

(if: $variable is "value")[
	... Do something ...
]
(else-if: $variable is "different value")[
	... Do other thing ...
]

... but in your particular case you don't need to use an (else-if:) macro because the variable can only have one of two values (true or false), so you can use a structure like the following instead.

(if: $variable is "value")[
	... Do something ...
]
(else:)[
	... Do other thing ...
]

2. You don't need to (and shouldn't) use the IS comparison operator when checking if a value is true or false.

Instead you should do one of the following depending if you're checking for Boolean true or false

(set: $variable to true)
(if: $variable)[This texts appears when the value in the varirable equates to Boolean true.]

(set: $variable to false)
(if: not $variable)[This texts appears when the value in the varirable equates to Boolean false.]

... the second above example is using the Boolean Data's NOT operator.

3. You only need to use a single set of Collapsing whitespace markup to achieve the result you require.

The following is a revised version of your original example that takes into consideration the above issues.

{
(if: $fireball)[
[[Scream]]
[[Punch]]
[[Cast fireball]]
]
(else:)[
[[Scream]]
[[Punch]]
]
}

... and if entered into an empty passage should result in the creation of the three related Passages (if they are currently missing from the story's Passage Map)

by (200 points)
I've tried changing this and it doesn't seem to have had any effect. I tried deleting the original passage and creating a new one with the code you gave me and it still hasn't created any new passages and won't connect when I manually create a passage with the same name.

Is there anything else that could be causing this issue?

(Thanks for the (if:) (else:) advice btw that seems a lot simpler than the way I've been doing it)
by (6.2k points)

If it's not working you could temporarily use this while trying to work out what's wrong with it:

{
(if: $fireball)[
(link: 'Scream')[(goto: 'Scream')]
(link: 'Punch')[(goto: 'Punch')]
(link: 'Cast fireball')[(goto: 'Cast fireball')]
]
(else:)[
(link: 'Scream')[(goto: 'Scream')]
(link: 'Punch')[(goto: 'Punch')]
]
}

 

...