A Very Strange Error

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
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

A Very Strange Error

Post by RossG » Mon Oct 03, 2016 1:41 am

I have a function which sometimes works and sometimes
doesn't.

The problem is a repeat loop...

repeat with r = 16 to 36.

The error occurs on the first iteration of the loop.

The value of r is somehow changed - to 15 - so the loop
is exited.

This happens even when I add a line before to put 16 into r.

Other functions which have the same code work as expected.

What's up here???????
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9838
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: A Very Strange Error

Post by FourthWorld » Mon Oct 03, 2016 3:01 am

We won't be able to determine we what's happening in the handler until you post the full handler.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Very Strange Error

Post by RossG » Mon Oct 03, 2016 6:03 am

Richard

I've never needed to figure out "handlers".

Can you explain or direct me to an explanation?
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Location: Vicenza (Italy)
Contact:

Re: A Very Strange Error

Post by Neurox66 » Mon Oct 03, 2016 6:39 am

Hi RossG,
I've never needed to figure out "handlers".
post your LiveCode script with the while loop :)

Paolo
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Very Strange Error

Post by RossG » Mon Oct 03, 2016 5:37 pm

Neurox66 wrote:Hi RossG,
I've never needed to figure out "handlers".
post your LiveCode script with the while loop :)

Paolo
The while loop is OK sometimes.
Usually after the first run it goes wrong.

The first stack I've had which crashes LC and
the stand-alone.

I'll try adding this code to the Explicator stack and
see if it crashes.

Also...
After ten years using LC (from Rev 3) it's occurred to me
that it would be very convenient if, when compiling a stack,
a copy of it was saved with the .exe.

Is there a setting or a way to do this?
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Very Strange Error

Post by RossG » Mon Oct 03, 2016 11:29 pm

Made some progress on this.

the loop...

repeat with x = 16 to min(sCount,36)

Somehow sCount wasn't what it should have been.
Should be between 16 and 200(say).
It was reduced to 2, so naturally the loop failed.

Now I have to find where this change is occurring
which brings me to my next question.

Had a look for info about using the Watch Window but
can't figure out if I can set it up to tell me when sCount
is being changed.

I expect it's possible.

Some clues would really be appreciated.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9665
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: A Very Strange Error

Post by dunbarx » Tue Oct 04, 2016 2:28 am

Ross.

I think it was Richard who said we need to see the entire handler before we have any hope at all of helping you.

He was correct.

Craig Newman

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Very Strange Error

Post by RossG » Tue Nov 29, 2016 9:00 pm

Would still like to know how I can watch a variable
so that the stack stops when it changes as I now
have an array which "disappears" at some point
after it's been initialized.

A fairly usual facility in all the programming languages
I've used.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9665
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: A Very Strange Error

Post by dunbarx » Tue Nov 29, 2016 9:06 pm

Ross.

What does stepping through each line of a handler in the debugger not do for you? Breakpoints, soft or hard, or watchpoints for that matter, may be placed anywhere.

Another big advantage and feature of the LC debugger is that array variables are visible as the handler proceeds

Craig

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Very Strange Error

Post by RossG » Wed Nov 30, 2016 2:43 am

Craig

Tried all the usual but as usual I'd found a new way
to confuse LC.

I'd declared the array as global but when I added it
to the list I'd separated it from the previous global
with a "." instead of a ",". Took a bit of finding
what with these hi-res monitors and low-res eyes.

Must try harder but as usual a post here seemed to
solve it nicely!

Thanks again for your attention.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7237
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: A Very Strange Error

Post by jacque » Wed Nov 30, 2016 6:29 pm

"Low-res eyes" -- lol. That's me too. I'm stealing that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Very Strange Error

Post by RossG » Sat Dec 03, 2016 7:00 am

Due to advances in display technology the human eye
can't discern any difference between the latest
display resolution and the previous one so in
fact we all have "low-res" eyes now.

Waiting for the bionic eye implant before I
get a new monitor.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9838
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: A Very Strange Error

Post by FourthWorld » Sat Dec 03, 2016 5:18 pm

RossG wrote:I'd declared the array as global but when I added it
to the list I'd separated it from the previous global
with a "." instead of a ",".
I'd used Andale Mono for years, and many others for years before, and I found that they often made the descending tail on the comma too small to be readily distinguished from a period.

No more. I came across Ubuntu Mono a few years ago, one of the few monospaced fonts that understands its role in coding and makes the comma very easily distinguishable from a period.

The Ubuntu font family is available for free as open source, downloadable here:
http://font.ubuntu.com/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”