Howdy, Stranger!

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

Trying to do: if this, goto here scenarios.

Can someone please tell me why this:
(if: $farmer's isCollected is true)[[(goto: "Farmer Role Model")]]

gives me this:

D4DB7zc-rE_u14uI8COZEZNIMzMY3x_XkGZVpDRzcWM?size=1600x1200&size_mode=3

Please note the goto inside, instead of just the name. Also, I am trying to create an if then else scenario, but the only way I know to do this is this way:
(if: $farmer's isCollected is true)[[(goto: "Farmer Role Model")]]

(if: $gourmet's isCollected is true)[[(goto: "Chef Role Model")]]

(if: $conservationalist's isCollected is true)[[(goto: "Park Ranger Model")]]

(if: $teacher's isCollected is true)[[(goto: "Teacher Role Model")]]

(if: $publicServant's isCollected is true)[[(goto: "Mayor Role Model")]]

(if: $techie's isCollected is true)[[(goto: "Front End Developer Role Model")]]

This isn't even working, so if someone could kindly tell me the correct way, I would appreciate it. Thank you!

Comments

  • The problem is you've got too many square brackets around the (if:) macro's hook. Try this
    (if: $farmer's isCollected is true)[(goto: "Farmer Role Model")]
    
  • Further to what prof_yaffle said:-

    An Associated Hook (ones used with macros like (if:)) consist of a single open/close square bracket pair, this is the same as Named Hooks:
    (if:)[ .... ]
    (link:) [ ... ]
    |hookname>[ ... ]
    [ ... ]<hookname|
    
    A markup link consists of a double open/close square bracket pair:
    [[Link Text is the same as the Target Passage Name]]
    [[Link Text->Target Passage Name]]
    [[Target Passage Name<-Link Text]]
    
  • I'd also be cautious about that single quote in the variable name ($farmer's). Although it appears to be working for you at the moment, there's nothing like unusual characters - especially punctuation - to throw up surprises down the line.
  • the 's in $farmer's isn't part of the variable name, it's how you access an element of an array or datamap in Harlowe
    $farmer's isCollected
    

    accesses the isCollected element of the datamap held in $farmer.
  • Urmmm. Yuck. I'll stick with the JSON format...
  • mykael wrote: »
    Urmmm. Yuck. I'll stick with the JSON format...
    Do you mean the Javascript Object and Array literial formats?

    Because JSON is a data interchange format, which is based on Javascript's.
  • Yeah, the Javascript representation of JSON variables which works with Sugarcane and Sugarcube.
  • Thank you everyone for sharing and helping!
Sign In or Register to comment.