themarquis Lv 1
Yes, now I realize it's obvious that we should be grabbing the structure data from the puzzle files. I can't remember which question you are referring to – I will go look.
Yes, now I realize it's obvious that we should be grabbing the structure data from the puzzle files. I can't remember which question you are referring to – I will go look.
I realized you asked a couple other questions that I missed …
1.: If we want to discuss changes in the wikia, which link should be use?
On the german Wiki we have a site
I'm not sure what you're referring to, but each page has it's own discussion page that we can use.
we could use the discussion page for lua scripting for general talk about scripting-related wiki changes: http://foldit.wikia.com/wiki/Talk:Lua_Scripting . I'm not sure what you mean by the "right one"?
2.: May I give some extra information about your tutorials in brackets at the links on the wiki?
Yes! Please feel free. It's a good idea.
Was your question about files this one:
"For re-getting solutions, it would be nice to know, HOW the solutions are stored (I want to know the structure of the files), so if checksum (if there is one) and/or header are defect, you could fix them with a HEX-file-editor."
I agree, but I don't think the devs have been very forthcoming about files and other game-related details.
I think I've found the sequences in the solution/puzzle files. They look like this:
SSTR (some garbage chars) LLLLLLLHHHHHHHHHHHHHHLLLEE
The E is for sheet, I think. (L for loop, H for helix). You should play w/ this and confirm (if you haven't already. They should be easy to extract.
You are right, Rachel!
This is how they must are stored!
I could write A QBASIC-Program compiled as .exe-file which gets the data.
Maybe V-Basic, too, but only after some training.
Another way is to cut these data out with NOTEPAD++
Too bad,that search and replace isn't available for macro-functions in Notepad at the moment.
I hope, they will do it in some time.
"I agree, but I don't think the devs have been very forthcoming about files and other game-related details."
For releasing it, you should vote here:
I'm trying to think about what would be the easiest (and most useful) way of pulling out those structures. Maybe I will chat with CFC (he is the one in my group who is interested in saving/restoring structures) and see what he thinks.
The big question would be what format others would like to use to obtain the structures. An .exe would be easiest, but we can also consider putting something online (use javascript form or applet) that will do this. That may take a bit more work, but it's still very easy. I can put it up on my webspace.
I like what you've put up on the library page!
Maybe I'll put up a couple of random number functions (using your new algorithm) and my save/restore functions (as noted earlier, they're not that useful yet, but they will be at some point).
Another thing that strikes me … strings!!!
We so badly need some string functions!!!
It is driving me crazy … I can't figure out how to replicate string functionality. Like getting a substring or a char out of a string. Maybe I am being stupid, but I don't think it can be done without the libraries. This could be a problem w/ restoring structures, because I assume we would paste in strings of structures. Grr!!
ETA: I know we can use .. (concatenation) and # (length). But what else? Are strings stored as char arrays? I'm looking at metatables in the lua manual – maybe that will help us? I don't understand it though.
okay, I was responding and my laptop shut down…. it gets so hot when running foldit that I think it shuts itself down!
Basically, I said … "I'm stupid".
The program just needs to return a formatted string looking like this:
{"H", "H", "L", "E" … }
and then it can be cut and pasted in as a table constructor:
structTable = // paste here!
then I was writing something like … in English we say "duh!" when someone is being really stupid …
"I know we can use .. (concatenation) and # (length). But what else? Are strings stored as char arrays? I'm looking at metatables in the lua manual – maybe that will help us? I don't understand it though"
I also didn't get it completely with the tables and only know the .. and # operation :(
Again, the standrad library would help much for processing strings:
http://lua-users.org/wiki/StringLibraryTutorial
But, as far as I know, the whole content of a string is like a single value (like one cell in in MS-Excel, and not a list).
Maybe the user, who made this recipe can say more?
http://fold.it/portal/recipe/1915
Btw:
Now, you can delete the old multi-tool upload-tries.
uploading it works again.
I know … I wish we had the string library.
If we're using an external program to get the structs, we have something like this:
startIndex = first occurance of “SSTR”
startIndex = first occurrence of “S”, “L”, or “E” after startIndex
endIndex = first occurrence of any char other than “S” “L” or “E” - 1
structString = substring(startIndex, endIndex)
// the string is formatted to look like this: {“S”, “S”, “L”, “E” … }
structString += “{ “ + structString + “ }”
for each char c in structString
structString = “ “ “ “ + c + “ “ “ “ + “ , “
end
we just return a formatted string that gets plugged in to the table constructor and magically becomes a lua table.
Then in lua, we'd have something like :
structTable = // paste that string here
for i = 1, i < # structTable, i++
{
replace_ss(structTable[i])
}
But the bigger question is … how do we work with strings in Lua only (without string functions? It seems like it will often be necessary to not use a string at all but instead initialize a string as a table, so
"hello" becomes
{"h", "e", "l", "l", "o"}
We can do a lot with a table by just looping through it, iterating, grabbing bits of it, etc.. We can reproduce most of the functionality of the String library by using char tables.
here's a useful function: given an index i, return two indices s and e – the start and end points of i's structure. Then people can use that to wiggle/manipulate/rebuild the structure as a whole.
This is rough and I haven't tried running it. I'm sure you have a better/more efficient way of doing it – you're the master of efficiency!
function getStructIndices (i)
s = i -- initialize start and end pts
e = i
-- look forward
for j = i+1, j <= get_segment_count(), j++
if get_ss(j) != get+ss(i)
break -- make sure break works the same in lua as I'm used to!
end
e = j
end
– look back
for k = i-1, k >= 1, j–
if get_ss(k) != get+ss(i)
break
end
s = k
end
return s, e
end
One more (can you tell I'm bored? :) )
It would be nice to have a function that returns some results based on which segments are worst-scoring, because if we know what segments have problems, we can target those segments with our scripts. I mentioned this earlier.
What would be the most useful way of generating this kind of information?
Continuing with the idea of tables, what about a function that takes an attribute (either a segment score part like "clashing", "packing", etc. or "all" for the overall score) and returns a table ordered from worst to best of all segments in the protein. Optionally, there could be an int parameter that indicates the number of segments we want. So getWorst("packing", 5) would return the five most badly packed segments in the protein from most bad to least bad, while getWorst("backbone") would return all the segments in the protein from worst to least backbone score.
Then the user could do all kinds of things with this table. For example, why not wiggle all the worst segments? Or just select them so that he/she can look at them and decide what to do. Or band them and give them a tug. It should be easy for people to use the basic protein loop and substitute the table instead of the protein as a whole.
Basically, this idea and the previous one (get start and end indexes of a structure) involve separating out a subset of segments. Then we can do whatever we would do to the whole protein but to the subset. Some of the functions in the command set will take a set of indices, so the results of our library functions can just be fed into the appropriate commands.