Howdy, Stranger!

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

Help with Harlowe: If X then Goto Y?

I'm having trouble getting a block of code to work I'd hoped someone could help me with.
It's basic Twine 2 Harlowe. I'm just checking a score, then looping back until one of the characters has won. Once one does, depending on the outcome, you go to a win or lose screen.

PROBLEM: It just skips to the first passage listed, regardless of scores. Seems to run this:
(goto: "D1.0 - END GAME : Won")

CODE IN QUESTION
Duder = $dScore
Blowhard = $bScore


(if: $dScore >= 3) [ (goto: "D1.0 - END GAME : Won")] 
(elseif: $bScore >= 3) [(goto: "D1.0 - END GAME : Lost")] 
(else:)[(goto: "D1.0 - BB NewRound")]

The var iterates in a previous passage, ex: (set: $dScore +=1)
Anyone know what's wrong?

Comments

  • Adding extra space characters in the wrong place can break code, which is what is happening. Removing the ones between the (if:)/(elseif:) macros and their associated hooks and things will work again:
    Duder = $dScore
    Blowhard = $bScore
    
    (if: $dScore >= 3)[ (goto: "D1.0 - END GAME : Won")] 
    (elseif: $bScore >= 3)[(goto: "D1.0 - END GAME : Lost")] 
    (else:)[(goto: "D1.0 - BB NewRound")]
    
  • That solved it! Thanks!
Sign In or Register to comment.