line 1 column 19?

I am getting an error message from a variable I am trying to set. How can I find line 1 column 19?
And why can't I add two variables? They seem to be spelled accurately.


Line and column numbers tend to be a bit weird in Quest; it's not always obvious which line it's referring to. Usually easier to look at the error message it gives you, especially if it tells you the offending line of code.

As far as adding variables together, it should work for most types except objects.
Are you getting an error message?


Yes
Error running script: Error compiling expression 'player.cat + player.cat': SyntaxError: Unexpected character: Line: 1, Column: 19
I went through the script afterward looking for spaces and typos, but there wasn't anything wrong with it.

I also tried looking for line 1 column 19, but was completely lost with it.
This is not the first time the exact same error message has come up. For all I know it comes up every time the script is triggered. Similar texts in the same group seem to be unaffected, and it has no typos or extra spaces.


  player.mic = player.cat + player.cat
  player.mice = player.mice + player.mic

That is the script.
Player.cat starts at 1 and goes up. If someone dies, it goes back to one.


Does line 1 refer to line 1 of the script that includes player.cat + player.cat?
does column 19 refer to just the words player.cat + player.cat?
or to the entire line of script? or line and column to all enter script?
Is it happening because I die (which I did last time) immediately after the calculations have begun, so that the amount of player.cat has changed mid-solving? because maybe I could delay death effects by 1 second.


Usually line 1 means a line of that script; but there are some cases where it behaves oddly. If it quotes a piece of code, it probably means that line. Column 19 would normally mean the 19th character on the line; although I'm not sure if it counts the leading spaces or not.

I've seen a few people on here have problems due to invisible characters (such as byte-order marks, zero-width spaces, or similar oddities) inserted into scripts, and I've never been able to figure out how that happens. It might be worth erasing the line in question and typing it again to see if that's happened here.

Is it happening because I die (which I did last time) immediately after the calculations have begun, so that the amount of player.cat has changed mid-solving? because maybe I could delay death effects by 1 second.

I don't think that should be an issue. But this one looks pretty confusing, so it could be worth trying if nothing else helps.


I retyped it, and I rearranged the death script, and the error message has not come back, at least not the same one, and that is good, because it was a repetitive one. Thank you for the advice.


What was the change? (curious minds want to make a note in case they have similar errors as they grow up).


What was the change? (curious minds want to make a note in case they have similar errors as they grow up).

Where I've seen errors like this before, it is often fixed by deleting the offending line and typing it out again. It can be caused by things such as having   (u3000, ideographic space) instead of (u0020, ASCII space) in your code; or variable names spelled with Χ (Greek letter chi) instead of X (Roman letter X).

I've seen a couple of people on here have problems we couldn't track down, and when I looked at their files I could see some random character was actually something that looks the same from a foreign alphabet. Most often spaces, dots, dashes, or similar (which there are dozens of variations of). But I still have no idea how these are getting into people's code in the first place; especially given that the people having these problems often don't even know how to type those characters.

The only guess I can come up with is if you're copying and pasting code from somewhere else. If you put your script in a word processor, autocorrect could change a standard space to a narrow space, a non-breaking space, or an italic space without you noticing. That can make text look better on the page, but the Quest interpreter won't realise that a weird character is supposed to be a space. Some forums might do the same thing if you post code; although I'm pretty sure this one doesn't.

So, if you get an error that doesn't seem to make any sense (especially "unexpected character"), sometimes it's worth just remembering what the line says, deleting it, and typing it in again by hand.


Thanks for the Mr. Angel!

When using/learning code here from Quest, I intend to use only English, but I am in the habit of using Hebrew, Spanish, and occasional Greek characters too.

Sometimes I accidentally switch keyboards and confuse myself for a second. So I'll have to watch that for these types of errors!


Generally speaking, those characters should be fine in quotes, or in string attributes. They might just confuse Quest if they're in the names that the script needs to look up. So object names, attribute names, variable names, function names etc.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums