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/Kettles

From ATITD6
Jump to navigationJump to search
// Kettles by Anka  -  Created with AC Tool 5.3.2 in Tale 2
// Updated for Tale 6
//
// This macro runs several kettles as long as you can fit them all on screen.
// Be should the top and bottom row has enough screen space so the window can
// open without hitting the edges of the screen.  This would throw the positions
// off and crash the macro.
//
// The macro has a menu with some options..
// Task - Stoke or Fertilizer
// Kettles across and Down is simply your grid.  It has to be complete rows and columns.
//   You can't have 3 kettles on first row and 4 on next.
// Guilded Kettles - This is for spacing, check if guilded.
// Venery - For spacing again for those on Venery test.
// Need Setup - This macro sets up all of your windows for you.  If you already made a
//              a batch and just need to reload, this option will bypass setup if unchecked.
// Kettles Full? - This is for if you want to fill the kettles before starting.  I do this
//                 since I normally run 20 to 25 kettles at once and don't want to carry
//                 that much water.  Check if you have prefilled the kettles.
// Resolution - Currently just 1920x1080 and 1024x768 my original resolution in Tale 2.
//              Chat me if you want a certain resolution and I can add it.
//
// Chat me if something is not working, I may have missed something during the rewrite.
//
// Fill kettles if needed.
// Cartographer view
// Put your mouse pointer over the top left kettle (Then dont touch the mouse)
// Alt tab to ACTool and press F2 to start the macro.
// Make sure your chat and inventory windows are not
// in front of any kettles.  A Settings box will appear.  Set it to what
// you need and click ok.
//
// Wood required is 522 for 18 kettles.  29 per Kettle.

Constants
  Col = 6
  Row = 2
  StartX = 0
  StartY = 0
  varY = 0
  R1X = 1
  RY = 23
  SetX = 0
  SetY = 0
  X1 = 70
  Y1 = 242
  Y2 = 60
  Y3 = 74
  AddX = 106
  AddY = 260
  AddDY = 260
  Step = 105
  PinX = 151
  PinY = 110
  CornerY = 20
  NewX = 45
  NewY = 0
  MX = 510
  MY = 440
  MDelay = 200
  Num = 1
  Done = 0
  Max = 512, 423
  OK = 580, 410
  Button = 0
  Guild = 0
  Temp = 0
  Setup = 0
  Wood = 0
  TextX = 100 //102
  TextY = 168
  Pass = 0
  LoopCount = 0
  Jump = 10
  Jump1 = 0
  JTrack = 1
  Kettles = 0
End

Object Wood0   // Test at coords 100, 184 - personal
0=2,0|0=0,2|0=4,2|
0=0,3|0=4,3|0=0,4|
0=4,4|0=0,5|0=4,5|
0=2,7|
End Object 

Object Wood1   // Test at coords 100,184 - personal
0=3,0|0=2,1|0=3,1|
0=3,2|0=3,3|0=3,4|
0=3,5|0=3,6|
0=2,7|0=3,7|0=4,7|
End Object

Object Done  //4x8 92, 151
  234=0,0|231=0,2|58=0,4|176=0,8
  234=2,0|230=2,2|236=2,4|231=2,6
End

SetConst StartX = {mousex}
SetConst StartY = {mousey}
Compute NewX = $StartX
Compute NewY = $StartY

Form Potash, Settings
  ed1=Combobox:Task:Grain Fertilizer, Stoke
  ed2=Editbox:Kettles Across:6
  ed3=Editbox:Kettles Down:2
  ed4=Checkbox:Guilded Kettles?:True
  ed8=Checkbox:Venery?:False
  ed5=Checkbox:Need Setup?:True
  ed7=Checkbox:Kettles Full?:False
  ed6=Combobox:Resolution:1024x768, 1920x1080
end

FormLoad Potash, Potash.frm

if ShowForm Potash
  If Potash[ed4] = True
    Call Guild
  End
  if Potash[ed8] = True
    Call Venery
  End
  If Potash[ed5] = True
    Set Setup = 1
  Else
    Set Setup = 0
  End
  Set Col = Potash[ed2]
  Set Row = Potash[ed3]
  Compute Jump1 = $Jump + 1
else
  Stop
end

FormSave Potash, Potash.frm

KeyDown @{Tab} 200
Delay 2000

Call Resolution

If $Setup = 1
  Call Setup
End

If Potash[ed1] = Grain Fertilizer
  Call Grain
else
  Call Run
End

Procedure Setup
  Loop $Row
    Loop $Col
      MousePos $NewX, $NewY
      Compute varY = $NewY
      Delay $MDelay
      Rightclick  //Clicks on Kettle
      Compute NewY = {mousey} - $PinY
      Compute NewX = {mousex} + $PinX
      MousePos $NewX, $NewY
      Delay $MDelay
      Rightclick //Pins
      Compute NewX = $NewX - $PinX + 1
      Compute NewY = $NewY - $CornerY + 1
      MousePos $NewX, $NewY  //Move to corner of window
      Delay $MDelay
      if $Kettles = $Jump
        Set R1X = 1
        Compute RY = $RY + $AddDY
        Set Kettles = 0
      Else
        If $Kettles <> 0
          Compute R1X = $R1X + $AddX
        End
      End
      Dragto $R1X, $RY
      Compute NewX = $StartX + $Num * $Step
      Compute Num = $Num + 1
      Compute NewY = $varY
      Compute Kettles = $Kettles + 1
      //Compute R1X = $R1X + $AddX
    end
    
    Compute Num = 1
    //Compute R1X = 1
    Compute NewX = $StartX
    //Compute RY = $RY + $AddDY
    Compute NewY = $NewY + $Step
  End
  SetConst NewX = 45
End


Procedure Run
  Set NewX = $X1
  Set NewY = $Y1
  Compute Kettles = $Row * $Col
  Loop $Kettles
    if {loopno} = $Jump1
      SetConst NewX = $X1
      Compute NewY = $NewY + $AddY
      inc JTrack
      Compute Jump1 = ($Jump + 1) * $JTrack
    End
    MousePos $NewX, $NewY
    Delay $MDelay
    Rightclick
    if Potash[ed7] = False
      Delay $MDelay
      Rightclick
    End
    Delay $MDelay
    MousePos $Max
    Delay $MDelay
    Rightclick
    Compute NewX = $NewX + $AddX
  End
  Compute Jump1 = $Jump + 1
  SetConst JTrack = 1
  
  Set NewX = $X1
  Set NewY = $Y2
  Loop $Kettles
    If {loopno} = $Jump1
      SetConst NewX = $X1
      Compute NewY = $NewY + $AddY
      inc JTrack
      Compute Jump1 = ($Jump + 1) * $JTrack
    End
    MousePos $NewX, $NewY
    Delay $MDelay
    Rightclick
    Compute NewX = $NewX + $AddX
  End
  Compute Jump1 = $Jump + 1
  SetConst JTrack = 1
  SetConst NewX = $X1
  
  Delay 2000
  
  //Add Wood
  Loop 5
    SetConst Done = 0
    SetConst NewX = $X1
    SetConst NewY = $Y3
    If {loopno} = 1
      SetConst Wood = Wood1
    Else
      SetConst Wood = Wood0
    End
    While $Done = 0
      IsObject $Wood at $TextX, $TextY
        Delay 7000
        Loop $Kettles
          If {loopno} = $Jump1
            SetConst NewX = $X1
            Compute NewY = $NewY + $AddY
            inc JTrack
            Compute Jump1 = ($Jump + 1) * $JTrack
          End
          MousePos $NewX, $NewY
          Delay $MDelay
          RightClick
          Compute NewX = $NewX + $AddX
        End
        Compute Jump1 = $Jump + 1
        SetConst JTrack = 1        
        inc Done
        Delay $MDelay
      End
    End
  End
End
//Maybe add detection for "done" and unload here

Procedure Grain
  Loop $Row
    Loop $Col
      MousePos $NewX, $NewY
      Compute varY = $NewY
      Delay $MDelay
      Rightclick
      //if here to pin or start
      If $Pass = 0
        Compute NewY = {mousey} - $PinY
        Compute NewX = {mousex} + $PinX
        MousePos $NewX, $NewY
        Delay $MDelay
        Rightclick
        Compute NewX = $NewX - 47
        Compute NewY = $NewY + 155
        MousePos $NewX, $NewY
        Delay $MDelay
        Rightclick
        Compute NewX = $NewX + 47
        Compute NewY = $NewY - 155
        Compute NewX = $NewX - $PinX + 1
        Compute NewY = $NewY - $CornerY + 1
        MousePos $NewX, $NewY
        Delay $MDelay
        Dragto $R1X, $RY
        Mousepos 40, 258
        Delay $MDelay
        Rightclick
        Inc Pass
      Else
        Compute NewX = {mousex} + 111
        Compute NewY = {mousey} + 44
        MousePos $NewX, $NewY
        Delay $MDelay
        Rightclick
        Compute NewX = {mousex} - 67
        Compute NewY = {mousey} + 50
        MousePos $NewX, $NewY
        Delay $MDelay
        Rightclick
        MousePos 423, 117
        Delay $MDelay
        Rightclick
        Delay 200
      End
      Compute NewX = $StartX + $Num * 105
      Compute Num = $Num + 1
      Compute NewY = $varY
      Compute R1X = $R1X + $AddX
    end
    
    Compute Num = 1
    Compute R1X = 1
    Compute NewX = $StartX
    Compute RY = $RY + $AddY
    Compute NewY = $StartY + 105
  End
  
  SetConst NewX = $StartX
  Compute NewY = $StartY
  While $Done = 0
    IsObject Done  at 92, 151  //100, 151
      Delay 4000
      Loop $Row
        Loop $Col
          MousePos $NewX, $NewY
          Compute varY = $NewY
          Delay $MDelay
          Rightclick
          Compute NewX = $NewX + 41
          Compute NewY = $NewY + 94
          MousePos $NewX, $NewY
          Delay $MDelay
          Rightclick
          MousePos 423, 117
          Delay $MDelay
          Rightclick
          Delay 200
          Compute NewX = $StartX + $Num * 105
          Compute Num = $Num + 1
          Compute NewY = $varY
          Compute R1X = $R1X + $AddX
        End
        Compute Num = 1
        Compute R1X = 1
        Compute NewX = $StartX
        Compute RY = $RY + $AddY
        Compute NewY = $StartY + $Step
      End
      Inc Done
    End
  End
  MousePos 150, 45
  Delay $MDelay
  Rightclick
End

Procedure Guild
  Compute TextY = $TextY + 16
  Compute PinY = $PinY + 8
  Compute Y1 = $Y1 + 16
  //Compute AddY = $AddY - 8
  Compute Y3 = $Y3 + 16
End

Procedure Venery
  Compute Y1 = $Y1 + 8
  Compute TextY = $TextY + 12
  Compute Y2 = $Y2 - 4
  Compute Y3 = $Y3 - 2
  //Compute AddY = $AddY - 4
End

Procedure Resolution
  Case
  When Potash[ed6] = 1920x1080
    SetConst Max = 960, 595
    SetConst OK = 1026, 578
    SetConst Step = 200
  End
End
Bell