"THEN" being identified as a keyword in text string array and other oddities

Previous topic - Next topic

Ian Price

While working on my new game (you know the one Gernot ;)), I discovered that certain pieces of text cause syntax errors when being used in an array string. This happens in V7.XX and v8.XX

EG

Code (glbasic) Select

DIM help$[200]

help$[1]="Well then, let's explain the game, shall we?"
help$[2]="From here, let's remember through practice"
help$[3]="through"


"then" gets changed into THEN and won't run = syntax error

Comment out the first line of text [1] and the second line [2] won't run = syntax error. However remove the word "practice" and it runs fine. However still, if you use "practice" in another indivudual array string on its own, it works fine.
But, even though "through" was accepted in the "through practice" line [2], if you put "through" in it's own array line [3], it brings up a syntax error.

Weird!!

Good luck sorting this out Gernot!
I came. I saw. I played.

MrTAToad

The odd thing about "practise" is if you delete it, and then put it back in, all is fine  :blink:

Ian Price

Yeah, the whole thing is really odd. They're not reserved words as far as I can tell. It's totally bonkers.
I came. I saw. I played.

Kitty Hello

the quotes used are not all " characters!!!!


Ian Price

I can perhaps understand "THEN", but "practice" and "through" causing errors? And the odd behaviour that they are accepted at certain times. Who knows what other word combinations aren't accepted?

Admittedly in the above case I can (perhaps) use alternatives, but at some point someone will want these words within a text array.

Another point to note is that I can use IF, FROM, TO and AND in the same text (as I do) and they are fine. It's only THEN that turns back into a keyword.
I came. I saw. I played.

Moru

Works fine for me if I type it in myself. If I copy your text I get funny characters in two of the lines. Retype the lines and they will work fine.

Ian Price

Ah yes - in daylight I can see that the quote char (") wasn't the usual one and the whole text isn't coloured as a text string. I didn't notice this last night. Any idea how this occured originally then Gernot?
I came. I saw. I played.

MrTAToad


Ian Price

I just copied the code from GLB. I didn't even know the quotemarks were different until this morning. I've no idea why they are/were different.  With the standard IDE colour scheme the string text on my laptop doesn't look very different from non-string text. And the quotemark char wasn't too obviously different either. Tired eyes didn't help. But it wasn't really obvious.
I came. I saw. I played.

Kitty Hello

I have no idea. Did you copy/paste from another editor?
I've fixed the Paste command to repleace these 2 quotes into regular ones now.
Must I fix the typing functions, too?  mean - I don't even know how to type these 2.

MrTAToad

Code (glbasic) Select
DIM help$[200]

help$[1]="Well THEN, let's explain the game, shall we?"
help$[2]="From here, let's remember through practice"
help$[3]="through"


That posted okay :)

Ian Price

I wouldn't worry about it now tbh - we're all aware of the problem, so if it rears it's head again we'll know how to sort it.

:)
I came. I saw. I played.