Foldit Wiki
Advertisement

Lua Scripting Tutorial (Beginner 2) covered how to use the Foldit recipe editor and external editors. It used a new sample recipe, Beginner Rebuild SCRIPT 2.01, but didn't discuss what the recipe does.

If you looked at the recipe in Lua Scripting Tutorial (Beginner 1), you'll see that this one is similar. It selects the first 10 segments of the protein, then applies the rebuild tool, followed by a shake and a wiggle.

These steps can also be done manually in Foldit, but you'd need to be using the selection interface to select the first 10 segments.

These steps often improve the score, but there's no guarantee. The rebuild tool randomly tries different shapes for the selected area. Rebuild picks the shape from database of existing protein shapes, but it may not find a better shape.

The new version of the recipe adds two print statements which report the score before and after the rebuild. The statements look like this:

print ( "Score before rebuilding is " .. current.GetEnergyScore () )

In the previous tutorial, print statements all printed a fixed message. In this version, the print statements can produce different results. As before, there's a message in quotes. (In Lua, words enclosed in double or single quotes are called strings.)

Following the message, there's a "..", which is how you join two strings together. (Technically, ".." is the Lua string concatenation operator.)

The final part of the print statement is a new command from the Foldit Lua interface: current.GetEnergyScore (). Unlike the previous Foldit Lua commands, this one returns a value, the current score.

Lua Scripting Tutorial (Beginner 3) covers more changes to this recipe, further refining score reporting.

Advertisement