Page 1 of 1

Big problem with AS 6 Scripting

Posted: Wed Jun 03, 2009 12:40 am
by mkelley
Okay, so maybe it was foolish of me to start scripting in AS 6 but that is the future, right?

In any case, I'm having some serious issues and they look to be bugs in AS 6 at least insofar as how it handles scripting. First of all, after successfully (for many iterations) being able to call my script from a custom tool bar, now it no longer appears when I load up AS 6. It doesn't appear even when I move it from my custom toolbar (which itself doesn't appear) to, say, the Camera toolbar. No show -- no ability to execute.

I haven't tried rebooting the machine, but after the last load of AS 6 it suddenly froze all up and then finally crashed (with the old "Do You Want to tell Billy Gates all about it?" message). Now as it loads it "hesitates" as if it might be thinking about my script but getting no further.

I am the first to admit that in adding things (but very very minor things, like one new line) I may have caused a serious hiccup in the Lua interpreter, but 5.6 never did this, it just reported the bad syntax. Without such a report I'm kind of dead in the water -- I'll try removing what I just did but that's kind of hard at times.

So at the very least there is a bug in how it does or doesn't show tools and/or interpret scripts at startup. I'll save my "bad" script in case Mike wants to test this out on his own.

Posted: Wed Jun 03, 2009 12:51 am
by mkelley
Okay, not BIG problems, but a problem.

It's definitely whatever syntax/bug checker Mike is doing. Here's the offending line (pretty obviously bad):

local boneHolder =

I don't have any other way of doing Lua syntax checking other than to load it into AS and, as I said, 5.6 was really good at catching even these kinds of stupid things. 6.0, not so much (even to the point where a pernicious script could crash AS 6).

Anyway, I guess I'll leave this up (while the temptation is to remove it I still think Mike might want to look to see if he can catch this stuff) as it might help someone else.

Posted: Wed Jun 03, 2009 1:00 am
by mkelley
Ooops -- just did it again (this time, with only an extra right paren). This caused a major lockup of AS and system crash.

Okay -- so now you all know I'm clumsy and a fist-fingered programmer (actually my main excuse is that I didn't have my nap this afternoon. Truly. I'm an old man and need more than 4 hours of sleep a day to get by and this afternoon I was baking rolls).

Anyway, I'll keep documenting this because others may run into the same thing -- I guess the motto is "Be careful!" and watch your open and closed parens.

Posted: Wed Jun 03, 2009 1:38 am
by synthsin75
This is very serious. Very, very bad. I tested with some very minor errors I'd be apt to make (in ASD6 registered). It is not reporting syntax errors and not reloading a script opened in an editor.

While I had started to get a grip on the new documentation, this definitely does mean that I am out of the scripting business. :cry: There is just no way I can test anything. Even if it reported syntax errors, not reloading an open file would be just too much for me. I'd forget what I was doing jumping through that many hoops.

I hope this isn't intentional, as this would cut our already sparse scripter ranks in half.

:cry: (that's two times the crying)

Posted: Wed Jun 03, 2009 2:16 am
by mkelley
Well, it's definitely a PITA but it DOES force you to be careful with syntax <bg>.

I'm not sure what the problem is -- Mike has to be running some sort of error checking but it's possible he has just left out some sort of error condition. I hope it's not more serious. Because, as you say, it definitely makes you jump through hoops (as I was working I caused AS 6 to crash three more times just trying to reload things).

If there was some kind of external Lua syntax checker we could use that but with Mike's custom functions I don't know how well that would work (unless it was just a very straightforward checking for open loops and very obvious errors). Then again, these sorts of obvious things SHOULD be caught by AS -- they certainly were in 5.6.

Posted: Wed Jun 03, 2009 6:13 am
by Genete
All the scripts I write I do in a text editor that self check the fault of matching parenthesis. Also I always use identation to check the existence of 'end' staments and the closure of blocks.
I cannot test any of your problems for the moment, until I can play with a linux build.
-G

Posted: Wed Jun 03, 2009 1:15 pm
by mkelley
I use the excellent freeware editor SC177, but while it does indent and help a great deal it does not do any syntactical checking (there's some kind of "compile" option but as it wouldn't have any of Mike's functions I can't see how it could correctly check anything other than very rudimentary syntax).

I'm not about to switch editors right now but I don't think that's the issue. AS need to handle this a whole lot better simply because it hangs up or crashes right now on the load of a "bad" script and that's just plain dangerous. At the very least it should have 5.6's behavior. But I'm confident Mike will look at this because script writing is very very important.

Posted: Wed Jun 03, 2009 10:30 pm
by Lost Marble
Hey guys,

I've been looking into this (reporting syntax errors), and it appears to be a change in Lua. In Anime Studio 6, we moved from Lua 5.0 to Lua 5.1. Apparently, one of the changes is that when Lua loads a script file, sytax errors are not reported in the same way as in the previous version. The workaround looks pretty straightforward and I'll get that in when we have an update.

Mike, I'm not sure what you mean by calling your script from a custom toolbar. If you can post your script here or email it to support@lostmarble.com I'll take a look. Is this a script that runs in 5.x, but not 6.0?

-Mike

Posted: Wed Jun 03, 2009 10:55 pm
by synthsin75
That being the case, I'll just study up on the scripting docs awaiting the next update. Maybe I'll be up to speed and can turn out my scripting ideas with some speed. (Although I already have some wicked ideas)

Posted: Thu Jun 04, 2009 1:40 am
by mkelley
Lost Marble wrote:Hey guys,

I've been looking into this (reporting syntax errors), and it appears to be a change in Lua. In Anime Studio 6, we moved from Lua 5.0 to Lua 5.1. Apparently, one of the changes is that when Lua loads a script file, sytax errors are not reported in the same way as in the previous version. The workaround looks pretty straightforward and I'll get that in when we have an update.

Mike, I'm not sure what you mean by calling your script from a custom toolbar. If you can post your script here or email it to support@lostmarble.com I'll take a look. Is this a script that runs in 5.x, but not 6.0?

-Mike
Thanks for looking into this and I'm definitely looking forward to getting this one handled (because I'm not sure how much scripting I want to do given how little I can see anymore -- even with a large font items like missing parens don't jump out at me the way they used to). And I do have an idea or three that folks have been wanting (and I know that *I* want :>) I even have an idea how to implement the natural motion feature that is even now just in the beta for the new After Effects (and may be the most sought after feature in that program).

I wasn't talking so much about a totally custom toolbar -- just the custom divider in the tools window. When a script doesn't load the icon doesn't show in the window -- makes sense, really, but it's a bit confusing when you have no other indication what is happening. Again, all part of that syntactical checking issue and I'm sure it will go away as soon as you make that change.