Hi
Currently in the selection interface you can select one, two, or more sections of segments and run limited scripts against them. Would it be possible to have some lua functions that return the selection number and start and end segments numbers? This way scripts could be run with out hard coding the the segment you want to work with.
get_selections_count() returns number of selections.
get_selection_start(selection number) returns start of selection supplied
get_selection_end(selection number) returns end of selection supplied
get_selections() returns all selections in an array (selection number, selection start, selection end)
Thanks
I second that.
At the moment, you have to do these entries "by hand" using a table, also for freezing, which always needs double the code.
I were already pleased with just a boolean information, which returns is_selected(index)=true if it is selected and false if it is not selected (for frozen segments (backbone,sidechain), too).
Fully agree with Crashguard303, I'd like to see a is_selected(index), is_backbone_frozen(index) and is_sidechain_frozen(index).
I created a wiki page for suggestions for new functions: http://foldit.wikia.com/wiki/Lua_Functions_That_Should_Be_Implemented
Please add all suggested new functions there, as well as creating a suggestion in feedback. Hopefully, we can come to some consensus on what functions should be implemented and how.
Good Idea!
I also think a single page for desired lua functions makes sense, so we don't need to fish them out of all the single feedback posts.
By the way:
Is there already wiki-entry which shows "emulated" basic functions (like integer and absolute value) we can use, as long as the standard-library is not included?
bump, so all the new scripters can see it
I was looking at the example gui compress recipe. It allows the user to select segments then bands other segments to it. It seems like functions exposed to the gui recipes should be exposed to the script recipes. I think I'd have to look harder to figure out how the actions are specified and if I could get to the functions via the scripts. Since I didn't study it too hard I can't do more than suspect action0, action1, etc. are the name of the functions and the gui scripts are just tables processed by some LUA function. I'm probably completely wrong.
recipe={
{action0, arg1, arg2}
{commnet, 'this is a comment so just ignore it'}
{action2, arg1}
}
for i=1,#recipe do
recipe[i]1
end
function comment(x)
end
function action0 (args)
…
end
this can be done now re-open if it can't