Meta scripts

Started by Tlaloc

Tlaloc Lv 1

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.

Crashguard303 Lv 1

…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 Lv 1

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.

Crashguard303 Lv 1

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.

Wilderbeast52 Lv 1

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.

BootsMcGraw Lv 1

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.

Reductone Lv 1

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

StackOverflow Lv 1

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.