Error while compiling script [SOLVED]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Error while compiling script [SOLVED]

Post by atout66 » Mon Apr 07, 2014 1:19 pm

Hi to all,

After a nice sunday, I come back with this problem syntax the code editor returns while compiling this:

Code: Select all

put char (IT+8) of ligneCourante  to the number of chars of ligneCourante into tTmp
put char IT+8 of ligneCourante to length(ligneCourante) into tTmp
The <ligneCourante> var exist and is declared as a string. ligneCourante means currentLine and is a piece of text
"Normally" (as far as I know!), the same lines do the same thing here.
However, I get this error message: < compilation error at line 201 (Commands: missing',') near "into", char 73 >
BTW, is there a way to see the char position in a script in the script editor ?
I don't see where is my error ?

Could you switch the light on for me please ? :wink:

Kind regards, Jean-Paul.
Last edited by atout66 on Mon Apr 07, 2014 1:36 pm, edited 1 time in total.
Discovering LiveCode Community 6.5.2.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Error while compiling script

Post by Dixie » Mon Apr 07, 2014 1:23 pm

try something like..

Code: Select all

put char 1 to 8 of line X into temp

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Error while compiling script

Post by Klaus » Mon Apr 07, 2014 1:27 pm

Bonjour Jean-Paul,

you first need to define the RANGE of chars and then the source of the range!
-> char X to Y of tSource...

Hint: Never use IT more than neccessary, use a variable instead!
...
## Bad:
## put char (IT+8) of ligneCourante to the number of chars of ligneCourante into tTmp

## Correct, but still clumsy:
## put char (IT+8) to (the number of chars of ligneCourante) of ligneCourante into tTmp

## Better use this:
put the num of chars of ligneCourante into tTotalChars
put char (IT+8) to tTotalChars of ligneCourante into tTmp
...

Best

Klaus

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: Error while compiling script

Post by atout66 » Mon Apr 07, 2014 1:34 pm

Arght ! Of course, it's much clearer like that.
I mixed up myself with the number of chars in a string <length()>, with the chars (themself) of that string!!!!!

Sorry, it's Monday, but I'm not sure this is enough to explain everything in my case :shock:

Thanks for your lights.
Discovering LiveCode Community 6.5.2.

Post Reply