new function to return puzzle name or id.

Case number:845813-988845
Topic:Game: Tools
Opened by:GaryForbis
Status:Ongoing
Assigned:admin
Priority:3
Type:Suggestion
Opened on:Monday, November 8, 2010 - 21:20
Last modified:Friday, June 3, 2011 - 06:11

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
}

(Mon, 11/08/2010 - 21:20  |  4 comments)


Joined: 09/18/2009
Groups: SETI.Germany

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.

Joined: 08/06/2010
Groups: None

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.

Joined: 06/17/2010
Status: Open » Ongoing

Huge LUA update on the way :)

Tlaloc's picture
User offline. Last seen 2 hours 56 min ago. Offline
Joined: 08/04/2008
Groups: Mojo Risin'

That's one of the functions I plan on adding. Stay tuned.

Sitemap

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