The Wiki for Tale 6 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

User:Anka/Macros/Carpentry Shop

From ATITD6
< User:Anka‎ | Macros
Revision as of 14:29, 9 January 2012 by Anka (talk | contribs) (Created page with "<pre> //Carpentry Bench // // This macro runs a grid of carpentry benches. // INSTRUCTIONS // Double F8 view // I stand in the middle of my benches // Zoom in as much as possibl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
//Carpentry Bench
//
//  This macro runs a grid of carpentry benches.
// INSTRUCTIONS
// Double F8 view
// I stand in the middle of my benches
// Zoom in as much as possible to fit all your benches on screen.
// Make sure chat is minimized since this macro uses hotkeys.
// Put your mouse pointer in the middle of the table of the top left bench.
// Alt Tab to AcTool without moving the mouse and hit F2.  A menu will appear.
// Set the menu...
//
// Number of boards: Easy enough.. # you want to make
// Benches Across: # of benches West to East
// Benches Down: # of benches North to South
// Spacing: This is probably the most important one.  Since some people may
//          want a huge grid of benches, you would need to zoom out a bit to
//          fit them all.  If you put this setting at "0", it will use a preset
//          for the resolution.  If the pointer is not hitting all the benches,
//          you use this value to adjust it.
// Resolution: This macro will work on any resolution.  The ones listed in the menu
//             are just presets that set the "Spacing" setting above.  Setting the
//             spacing setting above overides this setting.
// Test: Check this box to run a test.  The macro will run as normally but won't
//       hit the hotkey to plane boards.  Use this to check your spacing.
//
// Alt Tab stops the macro.
// Enjoy, Anka

Constants
  Rounds = 0
  StartX = 0
  StartY = 0
  AddX = 0
  AddY = 0
  NewX = 0
  NewY = 0
  MDelay = 210
  CarpX = 0
  CarpY = 0
  Res = 0
End

Setconst StartX = {MouseX}
SetConst StartY = {MouseY}
Timestamp $StartX, $StartY
FormLoad Woodshop, WShop.frm

Form Woodshop, Planer
  ed1=editbox:Number of boards:0
  ed2=editbox:Benches Across:1
  ed3=editbox:Benches Down:1
  ed4=editbox:Spacing:0
  ed5=combobox:Resolution:1920x1080, 1440x900, 1360x768
  ed6=checkbox:Test?:False
End

if ShowForm Woodshop
  Set Rounds = Woodshop[ed1]
  Set CarpX = Woodshop[ed2]
  Set CarpY = Woodshop[ed3]
  Set Res = Woodshop[ed5]
else
  stop
end

FormSave Woodshop, WShop.frm

KeyDown @{Tab} 200
Delay 2000

SetConst NewX = $StartX
SetConst NewY = $StartY

Call Resolution
Delay 2000

While $Rounds > 0
  Loop $CarpY
    Loop $CarpX
      If $CheckforLostFocus = 0
        if $Rounds > 0
          Call Action
          Compute NewX = $NewX + $AddX
        else
          break
        End
      End
    End
    Compute NewX = $StartX
    Compute NewY = $NewY + $AddX
  End
  Compute NewX = $StartX
  Compute NewY = $StartY
End

Procedure Action
  MousePos $NewX, $NewY
  Delay $MDelay
  if Woodshop[ed6] = False
    Keys P
  End
  Delay $MDelay
  Dec $Rounds
End

Procedure Resolution
  Case
  When $Res = 1920x1080
    if Woodshop[ed4] = 0
      Set AddX = 377
    else
      Set AddX = Woodshop[ed4]
    end
  When $Res = 1440x900
    if Woodshop[ed4] = 0
      Set AddX = 398
    else
      Set AddX = Woodshop[ed4]
    end
  When $Res = 1360x768
    if Woodshop[ed4] = 0
      Set AddX = 294
    else
      Set AddX = Woodshop[ed4]
    end
  End
End

Function CheckforLostFocus
  if {activewindow} contains eGenesis
    Compute Result = 0
    Exit
  Else
    Stop
  End
End