Howdy, Stranger!

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

Addition link not working

As I was told, I should make another thread for new questions (I was told this after being told to use the same thread). I already searched the forum without finding anything related (sum, harlowe, adding, add, +, nothing gave me a related question)

There is another problem in my game, addition is not working.

First page has the "set" sentence correctly done, and second page shows first a counter, so I know if the links are working or not, and a way to add and take away from the variable:

Memories: ($memories)
(link: "add memory")[(set: $memories to $memories + 1)(goto: "second page")]
(link: "remove memory")[(set: $memories to $memories - 1)(goto: "second page")]

The problem is, it is freezing Twine after I click on the links

This
(link: "add memory")[(set: $memories to $memories + 1)]
(link: "remove memory")[(set: $memories to $memories - 1)]
Shows an error without freezing: the string "0" isn't the same type of data as the number 1
0 is a number same as 1, so I do not know what is going wrong there

Comments

  • edited June 2015
    Your first example works fine for me and does not freeze so your syntax is correct.

    As for the type mismatch error, are you initializing the $memory variable to "0" or 0? The first is a string data type and the second is a numeric data type. They are not the same and would generate the error you mentioned if you tried arithmetic operators on them in the same (set:).

    Without seeing additional lines of code, that's the best suggestion I can make.

  • edited June 2015
    Dominia wrote: »
    Your first example works fine for me and does not freeze so your syntax is correct.

    Uhm... I copied it back from my first message (since I made so many changes to the original code, that it was a completely different thing now) and it works fine. I do not know what happened yersterday. It froze every time I clicked "add"
  • That's happened to me so many times in various languages. No worries!
Sign In or Register to comment.