new function to return puzzle name or id.

Started by GaryForbis

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 }

Crashguard303 Lv 1

Getting puzzle name and/or ID would be a good change at first, because if you know the puzzle ID, you can also set some information (mutable/locked segments etc), but then you still would have to program these attributes for every new puzzle which is "released".

So, I still suggest implementing some functions which allow to get some puzzle/segment informations directly, and not indirectly by puzzle name or ID.

GaryForbis Lv 1

I agree that foldit should have functions for these things. I'd still like to be able to add additional game specific information to my code in a way that doesn't muck with the standard configuration and doesn't require a separate recipe for each puzzle.