In one of my stacks I'm using the skinning code that David demonstrated in the Games Academy.
Pretty cool stuff, until it all goes wrong.
"can't find card".
Huh...that's strange. The card is *there*. When I type it in the message box it works. What gives?
I finally twigged that the name of the skin card is kept in a custom property cSkin. Somehow, instead of 'skin' it was 'skin '. Of course there was no card called that.
Can the error messages please list the offending bit like this:
can't find card "skin "
I know this would be too big a job to implement retrospectively right now, but going forward error messages shouldn't just be on line x, char y, they should give slightly more of a clue to us clueless.
Thanks,
-Ken
Errors with offending parts listed.
Moderator: Klaus
Re: Errors with offending parts listed.
Hi,
The name of the card is not included to make programming easier. If the name were included, the error were different each time a card couldn't be found. Without the name, you can always write the same:
This way, you can always know which card can't be found.
Kind regards,
Mark
The name of the card is not included to make programming easier. If the name were included, the error were different each time a card couldn't be found. Without the name, you can always write the same:
Code: Select all
go cd x
if the result is "can't find card" then
beep
answer error "Card" && x && "cannot be found." with "OK"
end if
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Errors with offending parts listed.
To directly answer your post, you could always do this:
if char 1 to 15 of the result is "can't find card" then
I think you'll agree that's hardly a burden compared to the benefit.
However, you bring up a larger issue: internationalisation. Is the error in fact "can't find card" even if the language setting of the device is Finnish, Japanese, Urdu?
Seems to me a "proper" way to be able to handle errors programatically is to provide access to the numbers already internal to LiveCode (the first argument to errorDialog).
So then the code reduces to:
if errorCode=225 then
-- some error handling here.
Which would be more likely to work in more languages.
-Ken
if char 1 to 15 of the result is "can't find card" then
I think you'll agree that's hardly a burden compared to the benefit.
However, you bring up a larger issue: internationalisation. Is the error in fact "can't find card" even if the language setting of the device is Finnish, Japanese, Urdu?
Seems to me a "proper" way to be able to handle errors programatically is to provide access to the numbers already internal to LiveCode (the first argument to errorDialog).
So then the code reduces to:
if errorCode=225 then
-- some error handling here.
Which would be more likely to work in more languages.
-Ken
Re: Errors with offending parts listed.
Hi Ken,
Yes, the errors are always the same. Actually, one could argue that they are not in English but in the LiveCode language.
Kind regards,
Mark
Yes, the errors are always the same. Actually, one could argue that they are not in English but in the LiveCode language.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode