Tokens and Variables not working?

Get help using Construct 2

Post » Fri Jul 15, 2016 1:13 pm

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?

Posts: 4
Reputation: 183

Post » Fri Jul 15, 2016 3:38 pm

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.
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
Posts: 1,419
Reputation: 4,867

Post » Fri Jul 15, 2016 5:21 pm

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.
Mistakes were made.
Posts: 1,785
Reputation: 67,472

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests