GaryForbis Lv 1
Sometimes I'd like to modify the scripts so that they behave differently on different puzzles but don't want to remember which puzzle I'm working on and which script to use.
In a previous feedback on another subject I mentioned a new string function get_puzzle_name() that would return a unique name for the puzzle I could use as an index into a table of tables.
The alternative I'm considering would have to rely upon identifying the puzzle as mutable or not mutable and some key information about the specifics of the protein.
The basic use of get_puzzle_name would be something like:
if games[get_puzzle_name()] == nil then
game = games.newgame()
else
game = games.getgame(get_puzzle_name())
for x=1,#game.Replacements do
local replacement=game.Replacements[x]
recipes.[replacment[1]]=replacement[2]
end
unfortunately I can't copy and paste from recipe output in windows 7 and the recipe output isn't echoed to stdout in the foldit application data directory so I can't copy from there but I can still hand copy from recipe output and build the structure. Once I have the structure I don't have to keep multiple copies of the script and know which I need to use I merely need to detect the puzzle and set the specific modifications.
games={
['game 1357']={
Replacements={
{GlobalWiggle, games.GlobalWiggleTopHeavy},
{ShakeSidechains, games.ShakeSidechainsDefaulted}
},
ShakeSidechainsDefault=10,
MutableSegments={{20, 26}, {40,43}},
LockedSidechains={{1, 19}, {34, 39}, {44, 243}},
RunRecipes={Gary.QuickSettle, Rav3n_pl.QuickMutate, Tlaloc.MutateAll, Gary.MutateAll}
},
GlobalWiggleTopHeavy=function () end,
ShakeSidechainsDefaulted=function (iterations)
if iterations == nil then iterations = game.ShakeSidechainsDefault end
recipes.ShakeSidechains(iterations)
end
}