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!
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.
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.
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:
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.
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.
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".
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.
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….
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.
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!