Either allow band.AddBetweenSegments to succeed when the segment numbers are the same and the atom numbers are different, or add function band.AddBetweenAtoms for placing a band between two atoms of a single segment.
This will be useful for bendable ligands.
Two more candidates, in case you're running out of things to do. Actually, these would make a good start.
- This humble function should be built-in, along with print() and help():
function round ( ii )
return ii - ii % 0.001
end
- Either fix recipe.GetRandomSeed or add a new function along the lines of:
local seed = os.time()
seed = 1 / seed
while seed < 10000000 do
seed = seed * 10
end
seed = seed - seed % 1
print ( "Seed is: " .. seed )
math.randomseed ( seed )
math.random ()
math.random ()
I just tested GetRandomSeed again, and it always returns 49 on the first call on Windows. Actually, the first 30 calls return the same value each time on Windows.
Yes. There is literally no reason not to fix GetRandomSeed. It's not like the existing behavior is worth preserving.
Something like *.importSmiles("SmileString") for drug design puzzles
Something to freeze and unfreeze sheets, and something to freeze and unfreeze helices
Does the function below round things the same way that
Foldit's Score Window rounds the Score? Does this function
round Scores correctly for both positive and negative Scores?
function round ( ii )
return ii - ii % 0.001
end
I am not that familiar with the software that I can easy find this. What you might do is getting some poses and just run a simple recipe containing s=current.GetEnergyScore() print s - s % 0.001
Then you can find out yourself.
Jeff101's comment on the missing math.round (an eternal debate in lualand) reminded me belatedly, Gary Forbis made this long page of documentation and suggestions pre-Lua2: http://foldit.wikia.com/wiki/Lua_Script_Library
It would be a good idea to go through that for ideas that haven't already been covered, particularly the fsl and gary namespaces. I myself put atom tables into fsl because of his suggestions.
In some puzzles (like the aflatoxin puzzles 1440 1445 1450 & 1455),
certain residues can be mutated while others cannot. Is there a
LUA command that lets players choose additional residues to shield
from mutation? Does freezing a residue prevent it from being mutated?
It looks like Foldit already has similar LUA commands:
boolean structure.IsLocked(indx)
boolean structure.IsMutable(indx)
boolean structure.CanMutate(indx,str)
but I think these only tell us what restrictions
Foldit Central has placed into a puzzle, not what
restrictions a player has made.
Perhaps you could make commands like below:
void structure.SetMutable(indx,boolean)
boolean structure.GetMutable(indx)
where SetMutable makes residue indx mutable if true and
non-mutable if false, but SetMutable cannot make a
residue mutable if IsMutable for that residue is false.
Meanwhile, GetMutable returns for residue indx the
boolean (true or false value) set by the player for
that residue. The default values for GetMutable could
be what IsMutable would return.
It would be helpful if the settings for GetMutable
would get saved, shared, and loaded with a structure,
like bands, secondary structure, sequence, & frozen
already get saved.
Thanks!
Can you make a LUA function equivalent to Save Screenshot (Ctrl+H)
that will save a png image of your protein to the desktop?
Perhaps only let it save to a few different png filenames
so that it won't fill up a player's hard drive by accident.
This LUA function could be like below:
void SaveScreenshot(integer)
where integer is a number from 0 to 9 that becomes part
of the png filename (this would let up to 10 different
screenshots be saved to the desktop).
One use for this function could be as follows:
Say you want to use a band to make a hydrogen bond form,
but you don't want to keep stopping a recipe to check on
the hydrogen bond's status. Within the recipe, you could
use LUA to save the structure, remove all of its bands,
post a snapshot of the structure without the bands,
restore the saved structure, post another snapshot of
the structure with the bands, and then continue with
the recipe. Periodically, the recipe could make new
snapshots, reusing the same 2 filenames each time for
the snapshots with and without the bands. Then, as the
recipe runs, the player can open these 2 image files
to examine the latest status of the hydrogen bonds.
The player could also manually copy these 2 image files
for archival purposes, choosing new names for each set
of copied images.
Thanks again!