v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Editing v0.34:Cleaning up macros
Jump to navigation
Jump to search
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
You are editing a page for an older version of Dwarf Fortress ("Main" is the current version, not "v0.34"). Please make sure you intend to do this. If you are here by mistake, see the current page instead.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | == Cleaning up Macros == | |
− | This page is dedicated to help | + | This page is dedicated, on to describe, and help in cleaning macros. This is needed, because a recorded macro contains quite a lot of other interface interaction, what can really slow the executing. |
− | + | Because DF has a cache for the macros, you must change at least the name of the macro inside it (use a counter, and increment it), otherwise, the oldest loaded version will be used :( | |
− | Because DF | ||
− | If you make macros | + | If you make your macros to do a repetative job in a single menu, you can easily use grep and a menu macro file. Grep[http://gnuwin32.sourceforge.net/packages/grep.htm] is a GNU utility, that process an input (text) file, and throws everything, that doesn't match the filtering options. It's a very powerful utility, so if you would like to know better, look into manual[http://unixhelp.ed.ac.uk/CGI/man-cgi?grep]. Because grep is case sensitive (CAPITAL non capital), you have to watch out for this, or use a -i (in-case sensitive) mode. |
− | === | + | === How to use them === |
− | Because | + | Because grep is not saving the first line (name of macro), you have to make it manually. |
− | + | You have two choices. You can create a file, with the appropriate menu name, for example build.menu, and then: | |
− | |||
− | |||
− | |||
− | |||
echo my1 > my1.mak | echo my1 > my1.mak | ||
− | grep -f | + | grep -f build.menu my.mak >> my1.mak |
− | + | Don't forget, to clean up any empty lines from the '''.menu''' file, otherwise, nothing will then filtered out. | |
− | + | Second method, use a bunch of patterns | |
− | Don't forget to clean up any empty lines from the | ||
− | |||
− | |||
echo my2 > my2.mak | echo my2 > my2.mak | ||
grep -e line_1_from_file -e line_2_from_file -e line_3_from_file my.mak >> my2.mak | grep -e line_1_from_file -e line_2_from_file -e line_3_from_file my.mak >> my2.mak | ||
− | + | For both cases the first line is writing my2 (the name of the macro) into the file. This operation will overwrite the existing content of the file. The second line is actually doing the filtering, and appending the file. (Don't run, otherwise you wish to double the macro, you will still have to delete the '''End of macro''' line from the middle of the file)). | |
− | == | + | === Some useful filter === |
− | === Build | + | ====Build menu==== |
− | If you wish to build anything, and you are not | + | If you wish to build anything, and you are not intended to leave the build menu, and the macro is not selecting the building type, you can use the following file / listing to filter your macro. (so, for 'you manually select the first position, and the building type, and then run the macro' type of macros). |
SELECT | SELECT | ||
End of group | End of group | ||
Line 34: | Line 26: | ||
End of macro | End of macro | ||
− | === Resizing | + | ====Resizing menu==== |
− | If you wish to resize some building, you | + | If you wish to resize some building, you should use this filter, to speed things up. It will leave all the resizing commands, so it will be still valid for other building resizing. (If you recorded for bedrooms, you still can use for stone gardens...) |
SELECT | SELECT | ||
SECONDSCROLL_ | SECONDSCROLL_ |