Meta scripts

Case number:845813-987800
Topic:Game: Tools
Opened by:Tlaloc
Status:Open
Assigned:beta_helix
Priority:3
Type:Suggestion
Opened on:Thursday, June 3, 2010 - 10:20
Last modified:Thursday, July 8, 2010 - 14:57

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  |  5 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 5 hours 41 min 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?

Sitemap

Supported by: UW Center for Game Science, UW Department of Computer Science and Engineering, UW Baker Lab, DARPA, NSF, HHMI, Microsoft, and Adobe