Stack getting flaky

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
M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Stack getting flaky

Post by M-A Kuttner » Tue Jan 11, 2022 5:57 am

Hi again. I'm encountering some serious flakiness in my stack. A few warning flags:
  • I tried copying a script from a button (ctrl-C, not by code) and then pasting it into a field. I have done this many times before with this field and no problem, but in this case, LC refuses to paste the text into this or any other field.
  • A very basic script that was working just stopped working. The script was: set the loc of graphic "GuideLine" to horizNum, vertNum (where the 2 variables were taken from the locations of a couple of graphics onscreen). I didn't even modify the script and it just started throwing the error "Object: can't set object property"
  • This one is the kicker: Error Type - "Handler: error in statement" Line: "go next card"
Looks like my stack is corrupted. I've been working on this stack for a few months and it's been rock solid. I've just moved from Community 9_6_2 to 9_6_5 and I'm hoping that isn't the root of the problem, but the timing does seem a bit suspicious. Any tips on how I might try salvaging this? I've got pervious versions saved, but I'm looking at losing a solid day's work. Also, should I go back to 9_6_2, or am I being paranoid?

Thanks in advance for any advice!
M-A
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

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

Re: Stack getting flaky

Post by Klaus » Tue Jan 11, 2022 2:53 pm

Did you reboot LC and/or your computer?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Stack getting flaky

Post by dunbarx » Tue Jan 11, 2022 3:27 pm

If you save your current work back in 9.6.2 does it work there?

Can you copy another script?
Can you go to another card from the message box?
Are you sure the H,V values are numbers?

Not saying these are issues, since I get a sense of a stack suddenly going south. Just making sure.

Craig

andresdt
Posts: 156
Joined: Fri Aug 16, 2019 7:51 pm
Contact:

Re: Stack getting flaky

Post by andresdt » Tue Jan 11, 2022 3:45 pm

Hi @MA Kuttner
Sometimes something similar has happened to me. In my case what has happened to me is that the script gets corrupted in the clipboard. I don't know when or why. But if I copy the same script to Notepad ++ and copy it back, everything is solved. Apparently non-printable characters appear that cause everything to break.
Be kind, we all have our own wars.
https://torocruzand.com/

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Stack getting flaky

Post by M-A Kuttner » Tue Jan 11, 2022 4:49 pm

Thank you for your replies everybody. I've tried the following:
  • Quit LC and rebooted the computer. Same errors still happening.
  • Opening in 9_6_2 and saving as a Livecode 7 stack. Same errors still happening.
  • Copying script to Notepad and then pasting into field. Text still won't paste. I did get the script into the field by using the "put the script of button x into field y" command in the message box, but that didn't resolve any errors unfortunately.
I previously checked the H and V values by opening a previous version and confirming that nothing changed in the script or the graphics that were being referred to. No change. HOWEVER, I just checked that particular script in debug mode and an interesting thing is happening:
I'm asking for the following:

Code: Select all

put item 1 of the loc of graphic "Framepointer" into HorizNum --I want the x value of Framepointer in HorizNum
put item 2 of the loc of graphic "Guideline" into VertNum --I want the y value of Guideline in VertNum
set the loc of graphic "Guideline" to HorizNum,VertNum --I want the graphic Guideline to follow the moveable graphic "Framepointer" on the x axis
Previously this was all working, but now in the debugger I'm seeing that LC is putting both the x and y axes for "Framepointer" into HorizNum and that VertNum is empty. It seems that the interpreter is now treating the entire location as item 1 and that it is not recognizing an item 2. If it were just this I'd look for another way around, but combined with the other stuff it's looking like the entire stack is corrupted. :/
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

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

Re: Stack getting flaky

Post by Klaus » Tue Jan 11, 2022 5:02 pm

It seems that the interpreter is now treating the entire location as item 1 and that it is not recognizing an item 2.
Did you set the itemdelimiter to something other than COMMA before these lines?
If not, then I'm afraid the stack is corrupted.

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Stack getting flaky

Post by M-A Kuttner » Tue Jan 11, 2022 5:29 pm

Ahhh, that is exactly what I did when I changed an unrelated part of the script!

This has fixed both the H,V problem and the "go next" problem. I was still having copy / paste problems but I then saved the stack and re-opened it. When I tried again, the copy / paste problem was resolved as well.

Klaus, thank you very much. And thank you to everyone else who responded. Your help has salvaged a very long day of coding!

---

Adding the following tags to help anyone else who encounters this problem:
can't paste to a field
x and y coordinates are not separated
get location getting both coordinates at the same time
itemdelimiter causing copy paste problems
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Stack getting flaky

Post by dunbarx » Tue Jan 11, 2022 5:36 pm

Aha.

You have to be careful when changing the itemDelimiter. I flag each line where I change it, to be sure that it is what I want the next time I even mention the word "item".

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Stack getting flaky

Post by richmond62 » Wed Jan 12, 2022 9:35 am

Personally, every time I use a delimiter it is prefaced by a line setting the delimiter to what I want
so that I don't mix up my commas, tabs and semi-colons.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Stack getting flaky

Post by stam » Wed Jan 12, 2022 10:49 am

Not sure if it’s actually worth doing but I always store the existing delimiter in a temp variable, set it to what I want, then at the end of the handler I set the delimiter back to what’s in the temp variable.

I say I don’t know if it’s worth doing because I think the delimiter is reset to comma once the change goes out of scope. But I do this just in case….

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Stack getting flaky

Post by dunbarx » Wed Jan 12, 2022 3:14 pm

Stam
I think the delimiter is reset to comma once the change goes out of scope.
What is "out of scope"?

The delimiter reverts to comma whenever any handler that changes it ends. Is that what you meant?

Craig

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Stack getting flaky

Post by stam » Wed Jan 12, 2022 5:34 pm

dunbarx wrote:
Wed Jan 12, 2022 3:14 pm
Stam
I think the delimiter is reset to comma once the change goes out of scope.
What is "out of scope"?

The delimiter reverts to comma whenever any handler that changes it ends. Is that what you meant?

Craig
Well yes that too - but also if another handler is called from the parent handler.

I’m sure you know more about scope than me. But just in case: https://en.m.wikipedia.org/wiki/Scope_( ... r_science)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Stack getting flaky

Post by dunbarx » Wed Jan 12, 2022 5:53 pm

Stam.

Ah, yes. In a sense, the calling handler "ends" when it transfers flow elsewhere. Same as local variables, which, unless explicitly declared above both handlers, do not persist.

We both get it.

Craig

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Stack getting flaky

Post by M-A Kuttner » Sat Jan 15, 2022 11:23 pm

Well yes that too - but also if another handler is called from the parent handler.
This is exactly what was causing my problem.
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Stack getting flaky

Post by stam » Sun Jan 16, 2022 8:53 pm

Yep I’ve fallen for that before. If setting an environment variable (such as using the system date) in a parent handler it goes out of scope immediately on switching handlers - if you call another handler that will run as if you had not changed anything. The same goes for itemDelimiter I suppose!

Post Reply