Does "Stop macro on deactivation" have to be unchecked?
Depends on what you want to achieve with the macro. If you set this checkmark the macro will be advanced to it's <END> section as soon as you stop doing the expression you bound the macro to. If you leave the checkbox empty the macro execution will remain active.
So in this example if you leave the box unchecked the macro will always take 8sec until it finishes no matter how long you do the expression. If you check this box for this macro the key will only release if you hold the expression for 8sec.
Also, how do you know when to put code in the start or end sections of the macro?
The sections of a macro are just for refinement. A macro that runs from start to finish has to execute it's <START>, <MAIN> and <END> section. There are a few reasons where these sections can become handy:
- use the <START> section to initialize the key/mouse button state you want during your macro.
- take advantage of the "repeat=x" argument to repeat a certain section several times
- use the <END> section to reset any mouse/kb states after the macro execution
As an example I once created a macro to use the mouse to rotate my character in World of Warcraft. This is done by holding the right mouse button and moving the mouse in the direction you want to turn to. So I put the RMB-down in the <START> section. Created a <MAIN repeat="x"> section that repeats infinite times and moves the mouse cursor to the left/right for a few pixels every 20ms. And finally we need an <END> section that releases the mouse cursor when the macro is stopped. Of course we would need to check the box "Stop macro on deactivation", otherwhise the macro would run infinitely.
Hope this explains the purpose of macro sections.