Meta scripts

Case number:845813-987800
Topic:Game: Tools
Opened by:Tlaloc
Status:Open
Type:Suggestion
Opened on:Thursday, June 3, 2010 - 10:20
Last modified:Saturday, June 27, 2015 - 16:23

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  |  15 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 1 week 5 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')
repeat
quicksave(5)
prevScore = get_score()
do_execute_recipe('tlaloc contract')
do_execute_recipe('Blue Fuse v.1.1')
score = get_score()
until score <= prevScore
quickload(5)
print('Done')

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

@Wilderbeast52:
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 32 weeks 1 day 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.
http://fold.it/portal/recipe/46192

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 14 hours 51 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 6 hours 50 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 air 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?

jeff101's picture
User offline. Last seen 6 hours 50 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 6 hours 50 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 49 years 34 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.

Sitemap

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, RosettaCommons