Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits. Anti-spam check. Do not fill this in!==Using an external editor== The Foldit recipe editor lacks a lot of features found in even simple text editors like "Notepad" on Windows. You can't select text by dragging over it with the mouse, so you can't cut or copy a selection. (You ''can'' "select all" with control+a and then copy (control+c) or cut (control+x). You can also paste at the cursor position with control+v.) The Foldit editor doesn't have an "undo" function. If you make a mistake on a recipe that's already been saved, you can click and "Load" and reload the same recipe from the list. All your changes are lost if you do this. The Foldit editor also lacks a "find" command, and so of course there's no "replace" command, either. ===Exporting a recipe to a file=== [[File:Recipe_Editor_Save_As_Dialog.png|thumb|250px|The Save As dialog. Copy the recipe title using ctrl+a, ctrl-c. Then click Export.]] Fortunately, it's easy to ''export'' recipes to a file, then work on them using an external editor. Even Notepad is a big improvement over the Foldit editor. Many editors provide additional features, such as ''syntax highlighting'', which highlights the "keywords" in the programming language you're using. The freeware Notepad++ editor, available for Windows, supports Lua and several other programming languages in this way. To export a recipe, open the recipe in the Foldit recipe editor, then click on "Save As" at the bottom of the editor window. The Foldit "Save As" dialog shows the recipe title and description. It's usually a good idea to copy the recipe title at this point. Click in the recipe title box, then select all with control+a and copy with control+c. You'll now be able to paste the recipe title in the next step. [[File:Recipe_Save_As_Dialog_Windows.png|thumb|400px|The Export button opens a standard Save As dialog. Paste in the recipe name, and add ".lua" on the end. Create a new folder or directory as needed.]] You'll see the "Save As" dialog has an "Export" button. Click on "Export". You should see a standard "Save As" dialog appear. On Windows, the "Save As" looks a lot like Windows Explorer. Navigate to a spot where you want to save the recipe. You may want to create a new folder (directory) to store your recipes. Once you've found a good spot, paste the recipe name you copied in the previous step into the file name box. Add the extension ".lua" at the end. (This "Save As", does not automatically add the correct file extension.) Click "Save". You can now use the editor of your choice. [[File:Recipe_in_NotepadPlusPlus.png|600px|The recipe in Notepad++ (click for larger view). The print command and other Lua features are automatically highlighted.]] <br clear="all"/> ====Windows tips==== If you're using Notepad, you'll need to select "All Documents (*.*)" from the "Open" dialog to see files with the ".lua" extension. In Windows explorer, you can right-click on your recipe, then select "Open With...", and then "Notepad". If you're using Notepad++ or another programming editor, it should be able to open files with the ".lua" extension directly. On Windows, you can set a default program to open files based on their extension. You can tell Windows to use the editor of your choice to open ".lua" files. (With luck, Windows will simply ask you which program you want to use....) By default, Windows hides the extensions of "known" file types in Windows Explorer and similar spots. So, after you pick an editor, you'll see just "My Script" listed instead of "My Script.lua". It's generally less confusing to turn this option off, so you'll always see the full file name, "My Script.lua". Once you've opened the recipe in your editor, change the initial comment and save the recipe. ===Importing a recipe from file=== The final step is to import the updated recipe back into Foldit. For this step, you should have [http://fold.it/portal/recipe/102316 Beginner Rebuild SCRIPT 2.01] open in the Foldit recipe editor. Optionally, you can create a new recipe at this step. Just click on "New (ScriptV2)" at the bottom of the editor window. You may get a warning that says all your changes will be lost. You can click "Yes" to continue, because you're already saved the recipe to a file. [[File:Recipe_Editor_Load_Dialog.png|thumb|250px|The Import button in the Load dialog lets you import a recipe from a file.]] Click on "Load" at the bottom of the recipe editor window. You'll see an "Import" button. "Import" should take you back to the spot where you saved the recipe. You'll see all files, so you should see your recipe even if you didn't add ".lua" to the name. Select your recipe, then click "Open". The updated recipe is loaded into the Foldit recipe editor. If you didn't already click "New (ScriptV2)", you'll see a warning about losing all your changes. Click "Yes" to continue. The updated recipe has not been saved to the Foldit cookbook yet. You can run the recipe from the recipe editor to test it. When you're ready to save the recipe, click "Save" or "Save As". If you've already started a new recipe, these two options are the same. You'll need to give the recipe a name and a description. If you still have the existing recipe open, "Save" replaces the existing recipe in the cookbook, while "Save As" lets you create a new recipe, leaving the existing recipe unchanged. Summary: Please note that all contributions to the Foldit Wiki are considered to be released under the CC-BY-SA Cancel Editing help (opens in new window) Retrieved from "https://foldit.fandom.com/wiki/Lua_Scripting_Tutorial_(Beginner_2)"