Posted 25 March 2012 - 02:06 PM
Hi, all.
The macro program was something I cooked up to fill a basic need:
Repeating actions. (Clearing a room, placing tracks, planting seeds, you get the idea)
So, I originally came up with a very simple macro program. All it did was take a series of commands, then execute those commands indefinitely. However, as I began to use it more and more, I added more and more features, eventually creating the 440 line monstrosity I have today. Features are:
W, S: Move Forward / Backward
A, D: Turn Left / Right
Shift: Move Up
Control: Move Down
Space: Dig
Tab: Place
Insert / Delete: Place Up / Down
Home / End: Dig Up / Down
Backspace: Drop Items in Slot
1 - 9: Select Slot 1 - 9
Menu Controls:
When first loading the program, macro recording will start. Press Enter to end the macro.
A dialog will appear to either Run, Save, Run and Save, or Discard the macro. (Use up / down to select, and Enter to confirm.)
After, a dialog for Error handling will appear. (Same controls as before.)
Then, if you have NOT selected loop error handling, a prompt for grace period length (in seconds) will appear. (Use the number keys and the period key to input a time.)
After, a repeat dialog will appear. (Use the number keys to input a number count. Use 0 for infinite.)
After that, the macro will be on it's way. To stop an infinite macro, terminate the process with Ctrl + T.
Please bear in mind, this started off as a basic macro program, and hence has been expanded as such. The variable names make little sense, there is little commenting, and it's probably one un-optimized S.O.B. However, it works, and as tools go it's one of the best ones I have. Any errors, comments, improvements or such can be posted in the comments below.
http://pastebin.com/dKbzDC2H
The macro program was something I cooked up to fill a basic need:
Repeating actions. (Clearing a room, placing tracks, planting seeds, you get the idea)
So, I originally came up with a very simple macro program. All it did was take a series of commands, then execute those commands indefinitely. However, as I began to use it more and more, I added more and more features, eventually creating the 440 line monstrosity I have today. Features are:
- It can utilize just about every turtle function
- Unlimited number of instructions
- Limited / Unlimited iterations
- You can save / load your macros
- 4 different error handling modes:
- Loop: Constantly repeat the action until it is successful
- Terminate: Stop what it's doing and throw an error
- Ignore: Ignore the instruction and carry on
- Hybrid: Loop all vital actions (movement), ignore non-vital actions (placing, digging, e.c.t.)
- Grace Period: Allow for an instruction to try again only once after an amount of time. (Allow for falling sand, e.c.t.)
- Best of all, et cetera!
W, S: Move Forward / Backward
A, D: Turn Left / Right
Shift: Move Up
Control: Move Down
Space: Dig
Tab: Place
Insert / Delete: Place Up / Down
Home / End: Dig Up / Down
Backspace: Drop Items in Slot
1 - 9: Select Slot 1 - 9
Menu Controls:
When first loading the program, macro recording will start. Press Enter to end the macro.
A dialog will appear to either Run, Save, Run and Save, or Discard the macro. (Use up / down to select, and Enter to confirm.)
After, a dialog for Error handling will appear. (Same controls as before.)
Then, if you have NOT selected loop error handling, a prompt for grace period length (in seconds) will appear. (Use the number keys and the period key to input a time.)
After, a repeat dialog will appear. (Use the number keys to input a number count. Use 0 for infinite.)
After that, the macro will be on it's way. To stop an infinite macro, terminate the process with Ctrl + T.
Please bear in mind, this started off as a basic macro program, and hence has been expanded as such. The variable names make little sense, there is little commenting, and it's probably one un-optimized S.O.B. However, it works, and as tools go it's one of the best ones I have. Any errors, comments, improvements or such can be posted in the comments below.
http://pastebin.com/dKbzDC2H