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?

Thanks!
B
3
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.
https://www.ravenheart.ca/home
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."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830

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.
B
52
S
26
G
109
Posts: 1,615
Reputation: 61,651


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, ignaciosimo, nickar and 47 guests