GUI going away

Started by LociOiling

LociOiling Lv 1

In case anyone missed the announcement, support for GUI recipes is slated to be removed in 2021.

There's now a Python-based converter called MacroScanner that can extract GUI recipes from your cookbook. Check out Python eats GUI for a quick overview of MacroScanner. The entire script can be downloaded from GitHub.

MacroScanner seems to work, but it's not very smart. The wiki has additional resources for refining the Lua scripts it generates.

Check out GUI to Lua - converting Co lapse's Settle for a detailed example of converting a GUI recipe by hand. The results are similar to what MacroScanner does. Then GUI to Lua - refining Co lapse's Settle shows how to refine the intial version by grouping repeated statements into a Lua function.

For reference, GUI commands to Lua functions, which gives the Lua V2 equivalents for each of the 21 GUI recipe commands. Each of the GUI commands now has its own wiki page, too.

See GUI commands Lua V2 equivalents for same information in table format.

Finally, GUI Recipe JSON names gets into the actual structure of the cookbook, giving the names used for various parts of a recipe. The cookbook is stored in a file called all.macro, which uses a format that it almost, but not quite compatible with the JSON data interchange format. (MacroScanner does a little bit of hammering to get JSON format, then uses standard Python functions to get at the data.)

BootsMcGraw Lv 1

How can I tell if a recipe needs to be converted to LUA V2? I think I can tell the difference between a GUI recipe and a LUA-based recipe. But how do I tell the difference between LUA V1 and LUA V2?

I can't find the post, but I remember someone writing that there is a program to convert our recipes to LUA 2. Where do I find that program?

LociOiling Lv 1

Just to bump this thread back up, I finally got around to testing rav3n_pl's FolditLuaConverter.

It seems mostly harmless.

It opens two text boxes. You paste your Lua V1 recipe into the one on the left, click "Convert", and the translated recipe appears in the box on the right. You can then copy and paste the result.

In my test, I used a large V1 recipe, with 1,462 lines. Unfortunately, the converted output stopped in the middle. It's not clear why that happened. I believe that a large file could simply be divided into pieces and translated, then the results combined. Some further testing is needed for that.

The executable for FolditLuaConverter seems to have made it to the new website. Through the magic of redirects, the old URL still works as a result: https://fold.it/portal/files/FolditLuaConverter.exe

jflat06 Staff Lv 1

Huh… it's probably not ideal that we're hosting an exe (that isn't ours). Leave it to drupal to allow us to host it. That one might be ok, but it still makes me nervous.

LociOiling Lv 1

As a further test of FolditLuaConverter, I divided the large recipe into two halves, converted each half separately, then combined the results.

The converted output had some problem spots, indicated by the text "#NEED EDIT", which is mentioned when you run the converter. The "#NEED EDIT" messages are a syntax error, so you must remove them to allow the converted recipe to run.

The recipe I converted used tlaloc's Foldit library, which involves messing with the standard functions quite a bit.

There were several spots like this one, where structure.WiggleAll merely gets mentioned:

_WiggleBackbone = structure.WiggleAll(iters, true,false) #NEED EDIT! put number to iters#

The solution in that case is to remove the parameters, along with the comment

_WiggleBackbone = structure.WiggleAll

Another problem spot was current.GetEnergyScore. The recipe assigned that to a new function, foldit.GetScore, which it then called in a lot of spots, passing the argument TRUE. Unfortunately, current.GetEnergyScore doesn't want an argument.

The solution was to change lines like
` local scoreStart = foldit.GetScore(true) to local scoreStart = foldit.GetScore()`

There did seem to be one genuine problem. The converter seems think there is a function selection.Select_range, but it's actually called selection.SelectRange. Just changing Select_range to SelectRange fixed that issue.

With those fairly simple changes (no major rewrites, really just a few edit commands needed), I have a working V2 recipe.

My test case is probably about as large and complicated as V1 recipes get. FolditLuaConverter did a good job, and the needed fixes were quick and easy.

Thanks to @Rav3n_pl for his work on FolditLuaConverter from long ago!

LociOiling Lv 1

jflat06 wrote:

Huh… it's probably not ideal that we're hosting an exe (that isn't ours). Leave it to drupal to allow us to host it. That one might be ok, but it still makes me nervous.

Yes, I was a little worried, but I ran procmon during this last test. I didn't see anything sinister in the output. It is amazing how much stuff .NET ends up doing just to put up a very simple window, however.