Compiling error
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Compiling error
I am having a problem compiling my code. I also noticed that my functions have disappeared from the left column of the script window. (That happened to me before but I realized at that time that there was a syntax error in the code, corrected it and they all came back. This time I can't find the error.)
The first error I got was:
"compilation error at line 68 (Handler: bad command), char 1.
That line read:
set the gSelected of card "cardHome" to myVar1
I'm trying to create a custom property on the card with that line. So I commented that whole line out and tried again and it gave me the same error. After searching the forum on compiling errors on lines commented out, I saw that there could be some invisible codes that could be a problem. The suggestion was to comment out the entire function to see what happens. I did that and got a new error which was:
compilation error at line 52 (Script: garbage character in script.)
Line 52 is where the commented area begins. I'm confused why anything in a commented area would throw an error at all. But, more importantly, I can't see any weird characters or why the first line above would be a problem?
UPDATE: OK, through completely deleting certain sections of the code, I can see that the problem is clearly with how I'm trying to set the value of the custom property. But I'm using examples I have found on various tutorials and chapter 7 of the User Guide. Any thoughts or suggestions on what I'm doing wrong there?
Thanks in advance.
Athelene
The first error I got was:
"compilation error at line 68 (Handler: bad command), char 1.
That line read:
set the gSelected of card "cardHome" to myVar1
I'm trying to create a custom property on the card with that line. So I commented that whole line out and tried again and it gave me the same error. After searching the forum on compiling errors on lines commented out, I saw that there could be some invisible codes that could be a problem. The suggestion was to comment out the entire function to see what happens. I did that and got a new error which was:
compilation error at line 52 (Script: garbage character in script.)
Line 52 is where the commented area begins. I'm confused why anything in a commented area would throw an error at all. But, more importantly, I can't see any weird characters or why the first line above would be a problem?
UPDATE: OK, through completely deleting certain sections of the code, I can see that the problem is clearly with how I'm trying to set the value of the custom property. But I'm using examples I have found on various tutorials and chapter 7 of the User Guide. Any thoughts or suggestions on what I'm doing wrong there?
Thanks in advance.
Athelene
Re: Compiling error
UPDATE: I figured it out!! Thank you to anyone who had taken some time to look at this.
For future reference should anyone ever find this searching for answers, I simply had to take the name of the card out of quotes. Interestingly, I had used this link as a guide: http://www.hyperactivesw.com/mctutorial/rrfeatures.html, and found this sample in the user guide: put the lastCall of this card into field "Date".
But once I removed the quotes around the card name, it all worked fine.
Athelene
For future reference should anyone ever find this searching for answers, I simply had to take the name of the card out of quotes. Interestingly, I had used this link as a guide: http://www.hyperactivesw.com/mctutorial/rrfeatures.html, and found this sample in the user guide: put the lastCall of this card into field "Date".
But once I removed the quotes around the card name, it all worked fine.
Athelene
Re: Compiling error
Hi Athelene,
If you copied the code from some external source it can easily happen that you have curly quotes copied. At times depending also on font they are hard to tell apart.
You should always put literals = names and such in quotes.
field "date" is OK
field date is bad since date is a reserved name in livecode and livecode gets confused.
Although Livecode can work with a name without quotes it is easy to mix up variable names with names and then you have a hard time to figure out what happened.
Please try to put the name of the field into straight quotes and see if it compiles.
Kind regards
Bernd
you really should quote the name of the card. The only thing that would explain to me what you have seen is that you accidentally had curly quotes instead of straight quotes.But once I removed the quotes around the card name, it all worked fine.
If you copied the code from some external source it can easily happen that you have curly quotes copied. At times depending also on font they are hard to tell apart.
You should always put literals = names and such in quotes.
field "date" is OK
field date is bad since date is a reserved name in livecode and livecode gets confused.
Although Livecode can work with a name without quotes it is easy to mix up variable names with names and then you have a hard time to figure out what happened.
Please try to put the name of the field into straight quotes and see if it compiles.
Kind regards
Bernd
Re: Compiling error
Hi Athelene,
You can set your comment preference in the Edit > Preferences > Script editor.
In there they show
--
#
//
I think you have to actually set it to get it to work.
--
is the default.
Simon
edit
Rats they all seem to work without setting them in preferences.
Ok go with Bernds idea, yeah, sounds like it's the quotes or possibly an invisible character. If you are copying and pasting, paste it into a text editor then copy that.
You can set your comment preference in the Edit > Preferences > Script editor.
In there they show
--
#
//
I think you have to actually set it to get it to work.
--
is the default.
Simon
edit
Code: Select all
on mouseUp
#beep
//beep
--beep
end mouseUp
Ok go with Bernds idea, yeah, sounds like it's the quotes or possibly an invisible character. If you are copying and pasting, paste it into a text editor then copy that.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Compiling error
I'll look at it again. But I'm aware that quotes can be a problem when copying. I typed them in manually. Very confused but I'll go back (now that I've slept since!) and try it again to be sure I did use quotes that I actually typed in.
Re: Compiling error
Don't forget about invisible characters, they are ummm hard to see
Simon

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!