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 40d:Macro design

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 "40d"). Please make sure you intend to do this.

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:
{{quality|superior}}{{av}}
 
 
Playing Dwarf Fortress means lots of typing. Macros can reduce this typing, but they must be planned and designed carefully. This page discusses how to design a macro and avoid common problems. The specific operation or structure for which you are creating a macro is beyond the scope of this page.
 
Playing Dwarf Fortress means lots of typing. Macros can reduce this typing, but they must be planned and designed carefully. This page discusses how to design a macro and avoid common problems. The specific operation or structure for which you are creating a macro is beyond the scope of this page.
  
Line 46: Line 45:
  
 
=== Fast movement ===
 
=== Fast movement ===
When you hold the {{key|Shift}} key in the game UI and press an arrow key, the cursor jumps ten squares instead of one. Similarly, each cursor command has a "_FAST" version that jumps ten squares in the same time a normal movement command takes to travel on square.
+
When you hold the {{key|Shift}} key in the game UI and press an arrow key, the cursor moves ten squares instead of one. Similarly, each cursor command has a "_FAST" version that jumps ten squares in the same time a normal movement command takes to travel on square.
  
 
The following code,
 
The following code,
Line 57: Line 56:
 
  [MACRO:CURSOR_UP:3]
 
  [MACRO:CURSOR_UP:3]
  
is exactly the same action in only 4 commands.
+
is the exact same action in only 4 commands.
  
 
=== Backpedaling ===
 
=== Backpedaling ===
Line 74: Line 73:
 
  [MACRO:CURSOR_Down:2]
 
  [MACRO:CURSOR_Down:2]
  
Is exactly the same cursor position change but in only 6 moves. This can have [[#Edge collision|side effects]] however and must be done carefully.
+
Is the exact same cursor position change but in only 6 moves. This can have [[#Edge collision|side effects]] however and must be done carefully.
  
 
=== Diagonal movement ===
 
=== Diagonal movement ===
Line 98: Line 97:
 
This saved us 12 unneeded commands.
 
This saved us 12 unneeded commands.
  
The "_FAST" works in the game and in your scripts on diagonals too. Further bringing down the previous example command count to just,
+
The "_FAST" works in the game and in your scripts on diagonals too. Further bringing down the the previous example command count to just,
  
 
  [MACRO:CURSOR_UPRIGHT_FAST:1]
 
  [MACRO:CURSOR_UPRIGHT_FAST:1]
Line 129: Line 128:
 
  [MACRO:SELECT:1]
 
  [MACRO:SELECT:1]
  
The cursor's initial position always counts as 1 "extra" square, since you're defining movement, not a size.
+
The cursor's current position always counts as 1 "extra" square, since you're defining movement, not a size.
  
 
  #    1 square ''designated'', '''0''' squares ''moved''
 
  #    1 square ''designated'', '''0''' squares ''moved''
Line 163: Line 162:
 
  [MACRO:CURSOR_RIGHT_FAST:1]
 
  [MACRO:CURSOR_RIGHT_FAST:1]
  
This is the same run time and number of commands, yet the cursor says inside the script area. The backpedaling "LEFT:3" command now backs up in the space the first "_FAST" command had already traveled. (Note that if it had been placed ''first'', the cursor would have backpedaled out the other side.)
+
This is the same run time and number of commands, yet the cursor says inside the script area. The backpedaling "LEFT:3" command now applies to the first "_FAST" command, rather than the second. (Note that if it had been placed ''first'', the cursor would have backpedaled out the other side.)
  
{{Category|Interface}}
+
[[Category:Guides]]
 +
[[Category:Interface]]

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)

This page is a member of 1 hidden category: