PlayfulGuy wrote: Tue Dec 07, 2021 11:20 pmThe function call thing will probably require a parsing function to more or less manually split it up. I ended up doing several parsing functions for the Script Engine and the new downloader to handle similar stuff. If you want I can send you some of my current code.
Thanks for the offer, but that one's dealt with now, no binary release yet but it's already merged into the develop branch on my repository.
The thing I realized when I thought about it is that since GuideMe uses Rhino, it's already *got* a javascript parser. I just had to find somebody explaining how to feed it in to do what I wanted it to do, and then write some functions to handle the resulting syntax tree.
The default behavior is to just split things into strings and throw them at the function; they shouldn't include delimiters but my understanding is that behavior was inconsistent anyway so it should be fine either way. Turn on ConvertArgumentTypes in the settings node, and it'll turn every literal type I could find except regular expressions and template strings (but including arrays and objects, though the latter may require different handling of the result than normal) into suitable object types, as well as pulling values from ScriptVars when it finds a name. Seems like those could both save a whole bunch of repetitive horsing around.
I'll refresh my memory and try to come up with some examples, but it will probably be a week at least before I get to that. Life is a little crazy right now and I'm mostly exhausted.
What version of Guideme did you test the eval issue in? I ran into that while working on the downloader in a couple cases.
At that point I'd only tried it on mine, but I just ran a test on 4.4 and it came up the same. But my example is pretty trivial, and it's possible something less trivial would produce issues... but I really don't understand how based on what it looks like the code is doing.
No rush on the examples, I'm trying to squish all the bugs that I can find references to, but I've still got others to pursue. Not to mention new development. I've got this idea that it'd be much more pleasant to write this:
Code: Select all
addButton({target: "exit", text: "Stop", hotkey: "s"})
than this:
Code: Select all
addButton("exit", "Stop", "", "", "", "", "s")
And so on for the various functions that often have multiple versions, some with very long parameter lists, which sometimes require numbers to be in strings and sometimes to not be, and adding any new features (like some of the things you've mentioned liking to be able to do with buttons) would make them even longer... It'd be nice to not have to keep checking that I have the right number of empty strings.
Auto: Replaces selected instances of the word "not" with the word "definitely".