0 Favourites

Tokens and Variables not working?

  • Hi, I've been encountering a problem with using the TokenAt expression and assigning the output value to a variable. Upon using the NW.JS and readfile expression to read a text file, I use TokenAt(textfile, 1, newline) to get the text contents of the 2nd line and I set the value of a text variable to this.

    However, upon comparing the text variable using the find expression or just comparing two variables (=), it does not seem to work. The condition does not detect the text in that variable to be identical to the string.

    If you are wondering what I mean, assuming textvariable = "asdf", I use compare variable, textvariable = "asdf" but the condition is false. Same thing with replace. It works when I use TokenAt with a single line text file, so I'm not sure what's going on here.

    However, using the debugger, I checked that the values of the variable was accurate, but when I selected the value of it, not change anything but simply press ENTER to deselect, the condition becomes true. Any idea what is going on?

    Thanks!

  • I am not sure TokenAt works with the newline expression. I don't think (not sure) that the newline is a line break character that you can search on.

    Probably use regex.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Tokenat definitely works with newline. Are you sure there is not an extra space in there somewhere? Are you using quotations in the right place?

    It is also possibly a picking/event logic error.

    If you upload a capx it will be easier to diagnose. But I can confirm this is a technique that works, as I utilize it all the time.

    Worst case scenario you possibly found a bug.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)