Meta scripts

Case number:845813-987800
Topic:Game: Tools
Opened by:Tlaloc
Opened on:Thursday, June 3, 2010 - 10:20
Last modified:Monday, November 15, 2021 - 04:40

It would be cool to allow scripts to call other scripts. I want to be able to set up a script that does my five favorite scripts. Then I can head off to bed and have it run for the next six hours finding me points. A simple do_execute_recipe('foo') function would be sufficient.

(Thu, 06/03/2010 - 10:20  |  20 comments)

Joined: 09/18/2009
Groups: SETI.Germany

...and you needn't reprogram basic functions for each script time and again, like integer or random values.

So, you mean that the scripts could be loaded like modules in VB?
The only problem i can imagine could sometimes be of scopic ones.

Tlaloc's picture
User offline. Last seen 15 weeks 2 days ago. Offline
Joined: 08/04/2008
Groups: Mojo Risin'

I mean simply that a script can call another script synchronously. Ideally you'd also like to pass parameters, but I suspect that would be much harder to implement. The lua standard library has ability to load modules and such, but I think that is overkill, more difficult to implement right, and possibly a security issue. Instead I just want the ability of a lua script to call another lua script that is in your cookbook, by name. A small issue is that two scripts can have the same name (why?), in which case, it can arbitrarily call the first one. Example:

print('Executing contract and fuze until no improvement')
prevScore = get_score()
do_execute_recipe('tlaloc contract')
do_execute_recipe('Blue Fuse v.1.1')
score = get_score()
until score <= prevScore

This would repeat the two recipes until the score didn't improve.

Now the one thing that could cause trouble is if one of the recipes used quicksave slot #5, so it would be nice if the do_execute_recipe() created its own quicksave set, plus recent best. Depending on how foldit code is written, this might be pretty easy to implement, but if it is a bear, I could live without it and try to find quicksave slots that aren't being used by the scripts rather than not have the feature at all.

I think this would get very heavy use by people.

Joined: 09/18/2009
Groups: SETI.Germany

You are right, and the problems you mentioned are "just" scopic ones.

I don't know how the system handles the quicksave slots, but I guess it is possible that lua can also handle them scopic, so if a script is finished, the slots can get out of scope and won't do confusion.

For beginners:
What I mean is, that already now, you can call a function within a loop (called k for example), and IN this function, you can use the variable k again (as long as it is not passed as parameter or not changed).
Leaving the function, k gets its old value again.

The only thing would be that you have to declare if the save slots are handled global (like now) or local.

Joined: 06/23/2009

Or just have a simple GUI window that acts as sort of a "playlist" or "queue" where players can click on recipes in their Cookbook and have them be added and executed in that order.
It would be a bit more friendly to the less tech-savvy players that aren't as adept with scripting and such.

Joined: 09/18/2009
Groups: SETI.Germany

Maybe an extra-function in the GUI-recipes, so that they can call Lua-recipes stackwise?

Joined: 12/06/2008
Groups: Contenders

Digging this thread from the bowels of the Feedback pages, since many of our fellow players weren't here four years ago, and this request is still as relevant today is it was, then.

Joined: 09/06/2013
Groups: None

As someone who is not as savvy with writing scripts, I am very much in favor of what Wilderbeast52 suggested.

spmm's picture
User offline. Last seen 17 weeks 5 days ago. Offline
Joined: 08/05/2010
Groups: Void Crushers

Grom has a recipe Constructor, which I haven't tried, it doesn't call scripts though, so it is more of a workaround, may be of interest.

Joined: 03/18/2014
Groups: Gargleblasters

I agree that it should be either a queue feature in game or a UI script feature (but not a LUA feature). It would also be very handy to include a timeout value (some scripts are designed to run forever, but you might want to run them only an hour at a time before moving on to the next script)

example: DRW for 2 hours -> wiggle walker for 1 hour -> back to DRW

Doing this as an in game feature is preferable because it then can't be shared, if you make it a script function you'll quickly get masses of prerequisite script issues in the community, which would be bad bad news for everyone.

frood66's picture
User offline. Last seen 2 hours 39 min ago. Offline
Joined: 09/20/2011
Groups: Marvin's bunch

I'm sure there could be much argument as to how such a 'work queue' might operate. But this seems a logical progression of what we already have.

This is not a new request. Nor is it a request purely of longstanding vets.

I'm for the opportunity. In my view NC has created an increased script dependency so this requirement is more obvious now than it was before.

What this route achieves is entirely another argument.

jeff101's picture
User offline. Last seen 8 hours 20 min ago. Offline
Joined: 04/20/2012
Groups: Go Science

LUA V2 Recipes with user inputs (Dialogs) will be tricky to do within queues. Imagine the recipes 'Tvdl enhanced DRW' or 'AA Copy Paste Compare v 1.1.1 -- Brow42' within a queue. How would you tell them all the input parameters you want?

Perhaps if no parameters are sent, the recipe could automatically use its default values. Perhaps you could make some simple syntax like below:

recipe_name < {5.03; 15; ; 'LLHELEEE'; '1 3 10 12'; 'a g r k'; 1; ; 0; ; 0; ; 1; 0; 1; 0; 0; 1}

where all the values between the {} are inputs in the order the Dialog wants them from top to bottom and left to right. The ; tell when one input ends and the next input begins. Each pair of ; with nothing in between means to use a default value. The 'LLHELEEE', '1 3 10 12', and 'a g r k' are text inputs for filling Textboxes. The 5.03 and 15 are numeric inputs for Sliders. The 0's and 1's could be for Checkboxes and Buttons. For Checkboxes, 0 means leave the Checkbox blank, and 1 means mark the Checkbox. For Buttons, 0 means don't press the Button, and 1 means press the Button.

God forbid you enter the wrong set of values for a particular Recipe, like something outside the range of a particular Slider. What should happen then?

Joined: 06/20/2019
Groups: Go Science

To address Jeff's 6-year old problem:

"God forbid you enter the wrong set of values for a particular Recipe, like something outside the range of a particular Slider. What should happen then?"

If the wrong set of values are passed on or entered into a particular Recipe, like something outside the range of a particular slider, there are straightforward preventative measures that can be taken by the recipe's developer in order for this issue to be fully resolved.

In the unfortunate event that a number is passed on that is outside the range of a particular slider, there can be a conditional that restricts the range of the number of the slider. If the value is greater than the maximum value or if the value is less than the minimum value, then reset the value into the closed value that is within the range of the slider.

If the wrong type of value is transmitted, like a word or a checkmark for a number or vice versa, then you should have the recipe only use the parameter if it is within the specified type as it is used in the code of the recipe, and have the parameter set to the default value.

Another solution to your problem is that you could have a confirmation dialog-box pop-up when a parameter from a recipe are transmitted to another recipe. That way the players are involved more in the game.

These are some of the things experienced coders do. It is also sorta common sense.

jeff101's picture
User offline. Last seen 8 hours 20 min ago. Offline
Joined: 04/20/2012
Groups: Go Science

Some Recipes will run forever unless you stop them. For these, it would be useful to have Meta Script options to limit how long they run:

(1) You could set an absolute time (like 3PM CDT Wed June 25) when they should stop.

(2) You could set a CPU time (like 12 CPU hours after starting) when they should stop.

(3) You could set a relative time (like 12 clock hours after starting) when they should stop.

(4) You could introduce a new LUA command to mark good stopping points within the program. Foldit could keep track of how many of these stopping points have passed and stop after say 100 stopping points. Stopping points would be places where the latest score is the best score so far and no Recipe-only bands or frozen segments are in place.

(5) You could let the user interrupt the Meta Script by pushing STOP. There could be several kinds of STOP's: one to STOP the latest Recipe and move on to the next Recipe in the Meta Script, one to STOP the latest Recipe at the next stopping point before moving on to the next Recipe in the Meta Script, and another to STOP the entire Meta Script.

jeff101's picture
User offline. Last seen 8 hours 20 min ago. Offline
Joined: 04/20/2012
Groups: Go Science

All the Recipes called from the Meta Script could output to the same scriptlog.default.xml file. There could be a command you can insert in a Meta Script to move the present scriptlog.default.xml contents to scriptlog.old.xml (or some other file that the user can specify) but that keeps putting future Recipe outputs in scriptlog.default.xml. There could also be a command that simply erases the contents of scriptlog.default.xml to make room for new output there.

Joined: 09/24/2012
Groups: Go Science

May be an idea for a quick solution:

When clicking on a recipe, ctrl click to add another recipe afterwards etc. Then right click to run starting from recipe 1.

(of course, the player should learn to run only recipes without dialog after recipe 1).

With this, I can run several basic short recipes one after the other and go to sleep.

Enzyme's picture
User offline. Last seen 52 years 4 weeks ago. Offline
Joined: 07/10/2008
Groups: None

I agree. Some simple method of creating a recipe que should be created. Either of Wilderbeast or Bruno's method would work beautifully. So far, few of us have implemented a master script to control other scripts but it would greatly benefit many of us.

Joined: 06/20/2019
Groups: Go Science

Digging this thread from the bowels of the Feedback pages, since many of our fellow players weren't here five years ago, and this request is still as relevant today is it was, then. (From BootsMcGraw's quote.)

It would be very beneficial and convenient to have a meta scripts and a recipe queue.

For the recipe queue, my idea is to have 3 loops, each one for early game, mid game, and late/end game for more traditional experienced Foldit players.

But a problem with a recipe queue is that bkoep may have pointed out in the Foldit Lab Report #7 Quarantine Edition is that it sounds like Foldit would be automated, and that there wouldn't be much human gameplay and the use of human intuition.

But this problem can be solved, with the pause button, as it will enable players to hand-fold the protein with human intuition while in the middle of the queue.
(I am also thinking of a fast-forward button that will also solve this problem, but seems impossible yet.)
(The full discussion for the pause button is at .)

It would also be beneficial to have meta scripts, because it would be more convenient with recipes interacting with each other and passing on parameters to each other. In that manner, people won't have to configure more advanced parameters that have already been done by other recipes.

This would be very realistic and convenient, because since the parameters are passed on and converted, this will solve the problem of Foldit players having to reset the recipe parameters from scratch. I bet some experienced players are very tired of having to set the parameters from scratch every time they start a new recipe. I do understand how it feels.

Joined: 01/13/2020
Groups: Go Science

+1 to this idea. I would love to be able to call other recipes, even though some of them run indefinitely.

A workaround to the issue of indefinite scripts would be to add a timeout argument to the call_other_recipe function, in which after the given number of seconds has passed, the game acts as if the user has clicked on the stop button just like they would in the GUI.

jeff101's picture
User offline. Last seen 8 hours 20 min ago. Offline
Joined: 04/20/2012
Groups: Go Science
Folks are asking me why this has not been implemented in Foldit yet.
I have tried to explain why, but it would help if someone else would
explain why. My sense is that the Foldit team has to implement it.
I don't think it would be easy for mere players to implement it.
If I am incorrect and it is really easy to implement, then someone
please implement it.
Joined: 12/06/2008
Groups: Contenders

This request is related to my request to allow anyone to create their own scripts simply by recording a series of actions they take, and converting it into LUA code.

See related topic: .


Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, Boehringer Ingelheim, RosettaCommons