Howdy, Stranger!

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

I can't get the simplest of IF macro's working

Hello All,

I'm going crazy here. I've got huge amounts of variable combinations, datamaps, CSS and HTML and it's all going swimmingly. Not a problem in sight!

But the most ridiculously simple IF macro just won't work.

I even made a separate test story and bareboned it and it still won't work.
As far as I can tell, I've tried pretty much any combination of colons, quotation marks and brackets, assuming that that could be the problem. But none of it works.
The example below ... unless I'm somehow blind ... copies the exact syntax from many 2.+ harlowe tutorials found online.

Here's my code from my sample test:

(set: $variable to "john")
(print: $variable)
(if: $variable is "john") [well that worked]

This will print out "john" correctly (showing that the variable itself contains the right info); but the next line it'll throw an error saying: "The (if:) command should be assigned to a variable or attached to a hook."

Ironically, if I add a colon after the closing if bracket:

(set: $variable to "john")
(print: $variable)
(if: $variable is "john"): [well that worked]

Now it will correctly conclude the IF macro ... but it prints out the colon as well.
So basically my output then is:

John
: well that worked


Am I completely insane?
Has anybody got a clue as to what I'm doing wrong?

Comments

  • You're putting a space between the (if:) and its hook […]. Don't do that.

    For example, the following:
    (if: $variable is "john") [well that worked]
    
    Should be:
    (if: $variable is "john")[well that worked]
    
  • You have saved my sanity! Thank you
Sign In or Register to comment.