Howdy, Stranger!

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

Can't find mistake in code. Also, very weird things happening in test mode.

edited February 2015 in Help! with 2.0
Problem solved! Thanks.


I'm using Harlowe.

Test mode is acting very weird for me. When I make a change to my story and then open it in test mode, half of the time the change does not appear. This isn't with anything coding related that I could have messed up. Very simple text isn't changing. But. even weirder, sometimes I'll change something in the story, then that will change in test mode. BUT, when I open up test mode later, that text will revert back to what it was a few hours ago. These changes happen even if I haven't even opened the passage that's reverting back to an older version, so it's not like I'm changing anything.

I'm also having issues with some code.




Four Years Pass (Passage Name)

It's your fourth birthday! Your parents tell you that it's time to choose your name.

Who do you want to be?

(if: $Gender is "M")[

(link: "Clint")[(set $Name to "Clint")(goto: "StartSchool")]

(link: "David")[(set $Name to "David")(goto: "StartSchool")]

(link: "Brian")[(set $Name to "Brian")(goto: "StartSchool")]

(Link: "Batman")[(set $Name to "Bruce")(goto: "NameChosen")]]


(if: $Gender is "F")[

(link: "Mindy")[(set $Name to "Mindy")(goto: "StartSchool")]

(link: "Sarah")[(set $Name to "Sarah")(goto: "StartSchool")]

(link: "Jenny")[(set $Name to "Jenny")(goto: "StartSchool")]

(link: "Velociraptor")[(set $Name to "Vel")(goto: "NameChosen")]]



NameChosen (Passage Name)

(if: $Name is "Bruce")[Your name is Batman! All the kids in your neighborhood think you have the coolest name ever. But their parents are starting to judge. To avoid embarrassment, your parents decide to call you Bruce in public. Soon they start calling you Bruce at home too.]

(if: $Name is "Vel")[Your name is Velociraptor! All the kids in your neighborhood think you have the coolest name ever. But their parents are starting to judge. To avoid embarrassment, your parents decide to call you Vel in public. Soon they start calling you Vel at home too. This pisses you off.]

[[A year passes->StartSchool]]


StartSchool (Passage Name)

(content not relevant to my issue.



So, here's what happens. I start my story and choose my gender in an earlier passage. I get to "Four Years Pass" and everything is displayed perfectly. If I'm a female, the four female names appear. If I'm a male, the four names appear. If I choose any of the first three names, I'm taken to "StartSchool" and everything seems to be working fine. But, if I choose Velociraptor or Batman, I end up in the "NameChosen" passage and it's blank. Neither of the hook messages are displaying. The "A year passes->StartSchool" link appears though and works just like it's supposed to.


I've been using the exact same type of code for tons of other places in the story, and they all work great. But I can't figure out what's different about this one.


Comments

  • First a couple of hints on including example code in a post.

    a. On the tool bar above the post text edit box there is a button with a hash # on it, if you click it a set of [][/] will appear with the word code in them. Write your example code between the the first ] and the [/ and it wil appear like the following example.
    b. You can include multiple passages in a single code example by prefixing the Passage Titles with a double colon ::, this is known as TWEE notation.

    :: Four Years Pass

    It's your fourth birthday! Your parents tell you that it's time to choose your name.

    Who do you want to be?

    (if: $Gender is "M")[

    (link: "Clint")[(set $Name to "Clint")(goto: "StartSchool")]

    (link: "David")[(set $Name to "David")(goto: "StartSchool")]

    (link: "Brian")[(set $Name to "Brian")(goto: "StartSchool")]

    (Link: "Batman")[(set $Name to "Bruce")(goto: "NameChosen")]]


    (if: $Gender is "F")[

    (link: "Mindy")[(set $Name to "Mindy")(goto: "StartSchool")]

    (link: "Sarah")[(set $Name to "Sarah")(goto: "StartSchool")]

    (link: "Jenny")[(set $Name to "Jenny")(goto: "StartSchool")]

    (link: "Velociraptor")[(set $Name to "Vel")(goto: "NameChosen")]]



    :: NameChosen

    (if: $Name is "Bruce")[Your name is Batman! All the kids in your neighborhood think you have the coolest name ever. But their parents are starting to judge. To avoid embarrassment, your parents decide to call you Bruce in public. Soon they start calling you Bruce at home too.]

    (if: $Name is "Vel")[Your name is Velociraptor! All the kids in your neighborhood think you have the coolest name ever. But their parents are starting to judge. To avoid embarrassment, your parents decide to call you Vel in public. Soon they start calling you Vel at home too. This pisses you off.]

    [[A year passes->StartSchool]]


    :: StartSchool

    (content not relevant to my issue.)
    The reason your example code is not working is because all your (set:) macros are missing the colon : after the macro name. Add the missing colon and your (set:) macros will work.
  • Thank you very much, GreyElf.
  • Hmm... I'm trying to think of a way in which this error can be reported - in most cases the incomplete (set) macro syntax would be printed as passage text, the main reason it's masked like this is due to the (goto:) acting immediately.

    Maybe an error could be displayed if a (goto:) command appears in the same hook as a span of text:

    {(if: $hasFuel)[
    Whoosh!
    (goto:"liftoff")
    ]} <!-- Because of the non-whitespace text "Whoosh!", this would produce an error instead of going to a passage -->
    What do you think?
  • L wrote:

    What do you think?

    How smart would the error checking have to be, would it be able to (or even need to be able to) catch things like any one of the following things that can produce non-whitespace text:

    {(if: $hasFuel)[
    $some_string
    (print: Whoosh!)
    (text: 123)
    (display: "Some Passage")
    /* some comment */
    (goto:"liftoff")
    ]} <!-- Because of the non-whitespace outputs, this would produce an error instead of going to a passage -->
    Because some end-user is going to do one or more of the above.
Sign In or Register to comment.