The Wiki for Tale 5 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/Flax5-noMenu

From ATITD5
< User:Anka‎ | Macros
Revision as of 04:10, 10 November 2010 by Anka (talk | contribs)
Jump to navigationJump to search
//Anka's Flax Macro v.4.0.1 - No Menu

//This macro will plant beds for seeds.  After Seeds are
//done, it will find your water icon and save its position. It will then plant 20
//beds of flax and either keep the flax in inventory, store flax into a chest, or
//throw flax in the water to rot.
//
//Setup
//1. Now has a resolution selector in the menu.  Chat me to get more added.
//2. Have 21 seeds and jugs with at least 1 jug empty.(If water is needed)
//3. Make sure you see the water action button in your starting location.
//3. This telling, I'm using regular sized action buttons.
//3. Pin open your planting window and drag it to the upper left corner.
//4. Make sure your ATITD window is maximized.
//4. Enter Cartagropher View and zoom all the way in.
//
//If you are using Win95, do not use autohide on windows taskbar.  It throws the numbers
// off.  Win7 does not seem to have this problem.
//If you want to store the flax in a chest.  Click on the chest, pick stash then pin that
//window to the top half of the right side. Place your pointer on the edge of that
//window to the left of "Flax".  When stashing, the macro will click on this
//window to update it then, click on flax to dump it into the chest.  Have 1
//flax in inventory to do this.  Once you have the pointer on the edge of the
//window, alt tab to ACTool without moving the mouse and press F2 to start.
//You can move the mouse once the menu comes up.  If you are not using the dump
//feature, you can simply alt tab and press start or F2.
//
//I wrote this macro being on the "West" side of water with lots of room to the West.
//It should work with water to your north also.
//
//This macro doesn't run on timers.  It uses Objects for this Tale.  One issue that might
//come up is that the macro may run slow on older computers.  The harvest seeds section is
//a bit slow to me but you can tweek it with MDelay and SDelay.  MDelay is the normal delay
//after a mouse click.  The lower the number, the lower the delay.  If you are having problems,
//raise it higher.  SDelay is a bit longer delay during Seed Harvesting.  I did not have any
//problems with this during testing so you may be able to lower it a bit.  The last version
//would sometimes hang here.
//
//Menu Settings
//"Job"          = Seeds, Flax or Both.  Both will grow seeds than plant enough rounds
//                 of flax to leave you with the original 21 seeds.
//"Seed Plants"  = Number of beds you want to plant for harvesting seeds.  This must
//                 be an even number.
//"Batch"        = Number of times you want to run the macro on current settings.
//"Pick Rounds"  = The number of times you want to harvest seeds from each bed.
//"Weed #"       = the number of times you need to weed flax before harvest.  This number
//                 should be set to 3 for Nile Green or 2 for most of the newer varieties.
//                 It counts the "Harvest Seeds" phase as a round.
//"Seeds / Pick" = How many seeds you get from each bed when you harvest seeds.
//# of seeds     = The number of seeds in inventory.  I re-wrote the calculations a bit to
//                 always plant flax in increments of 20 but always leave you with at least
//                 21 seeds.  I need to tweak this more since if you dont have at least 41 in
//                 this blank, it wont plant.
//"Dump"         = If you want to dump flax into a warehouse. (See Above)
//"Rot"          = If you want to rot flax in water.  You must see a water icon to do this.
//"Left to Right"= Future Addon to plant on East side of water.
//"Need Water"   = Toggle to collect water before planting.
//"Resolution"   = This is the latest feature of this and other macros.  Pick the resolution
//                 you would like to use.  If you are planting in a diagonal line, this is set
//                 wrong.
//
//
//Let me know if you have any problems.  It's good to be back and nice to see even my old
//macro's are still being used today. :)
//
//Finally cleaned the instructions this Tale :)
//
//Enjoy!  Anka


constants      //For 1920x1080
  ///////////////////////////////////////////////////////////////
  //Menu Items
  Job = Both       //Seeds, Flax or Both
  SeedX = 10       //Number of beds to plant for seeds.  Must be an even number.
  Rounds = 2       //Batch.  Number of times you want the macro to run.
  Pick = 3         //Nuber of times you want to harvest seeds before ripping out flax.
  Weed = 3         //Total number to Weed and Water a variety of flax
  Seeds = 1        //Number of seeds per picking
  SSeeds = 41      //Number of seeds in inventory
  Dump = False     //Dump flax in warehouse? True or False
  Rot = False      //Rot flax in water?  True or False
  PlantDir = False //Future Addon  0 = Left  1 = Right
  Water = 1        //Need Water for flax?  0 = False  1 = True
  Res = 1280x1024  //Resolution 1920x1080, 1360x768 or 1280x1024
  UnZoom = 900     //Time to Zoom Out
  Zoom = 1000      //Time to Zoom In
  ///////////////////////////////////////////////////////////////
  Button = 0
  ButtonX = 475
  ButtonY = 98
  Count = 475
  CenterX = 0
  CenterY = 0
  DumpX = 0
  DumpY = 0
  SubX = 20
  PickX = 0
  TempX = 0
  TempY = 0
  Left2X = 620
  LeftX = 750
  LeftY = 561
  RightX = 1146
  RightY = 561
  Right2X = 1320
  DownX = 960
  DownY = 781
  TextX = 0
  TextY = 0
  RipX = 0
  RipY = 0
  RipD0 = 210
  RipD1 = 190
  SkillsX = 0
  SKillsY = 0
  SkillsB = 0
  WeedX = 1364
  WeedY = 215
  LSide1X = 415
  LSide2X = 910
  LSide1Y = 780
  LSide2Y = 561
  RSide1X = 1415
  RSide2X = 996
  RSide1Y = 331
  RSide2Y = 561
  RSide3X = 1230
  RSide3Y = 354
  ObjX = 1375
  ObjY = 202
  SS1X = 0
  SS2X = 0
  SS1Y = 0
  SS2Y = 0
  Mod1 = 205
  Mod2 = 291
  Mod3 = 226
  NewX = 0
  NewY = 0
  FlaxSet = 0
  XPlant = 60
  YPlant = 40
  LeftStep = 756, 561
  RightStep = 1155, 561
  RightStep2 = 1563, 250
  Picked = 0
  Direction = 0
  Rip = 0
  Flax = 1
  Reset = 825, 113
  FMX = 564
  FMY = 193
  FR3Y = 840
  RotX = 0
  RotY = 0
  RotB = 0
  FRot = 0
  MDelay = 190
  SDelay = 250
  WaterX = 475
  WaterY = 98
  WaterB = 0
  ResetX = 850
  ResetY = 570
  Harvest = HarvestSF
  WeedF = WeedF
  ResX = 0
  ResY = 0
  Res1920x1080X = 630
  Res1920x1080Y = 556
  Res1360x768X = 435
  Res1360x768Y = 390
end

Object HarvestSF
  235=2,0|232=2,2|234=2,6|227=2,8
  234=4,0|230=4,2|235=4,6|225=4,8
  222=8,0|216=8,2|219=8,4|168=8,8
  223=10,0|217=10,4|214=10,6
  220=12,0|216=12,4|214=12,6|154=12,8
  228=14,0|223=14,2|225=14,4|224=14,6|206=14,8
End

Object WeedF
  170=0,0|232=0,2|235=0,4
  235=2,0|174=2,2|58=2,4
  234=4,0|230=4,2|173=4,4
  167=6,2|222=6,4
End


Object Water
  222=0,0|229=0,2|225=0,4|219=0,6|225=0,8|236=0,10
  206=2,0|191=2,2|220=2,4|223=2,6|224=2,8|250=2,10
  215=4,0|221=4,2|217=4,4|206=4,6|235=4,8|253=4,10
  191=6,0|211=6,2|222=6,4|238=6,6|245=6,8|249=6,10
  217=8,0|233=8,2|214=8,4|213=8,6|230=8,8|250=8,10
  224=10,0|217=10,2|222=10,4|229=10,6|232=10,8|248=10,10
End

SetConst DumpX = {MouseX}
SetConst DumpY = {MouseY}

  If $Job = Seeds
    Set Button = 1
  End
  Compute SeedX = $SeedX / 2 - 1

  If $PlantDir = True
    Set PlantDir = 1
  End
  Case
  When $Job = Flax
    Set Pick = 2
  End
else
  stop
end

MousePos 100, 150
Rightclick
Delay 400

Compute CenterX = {ScreenWidth} / 2
Compute CenterY = {ScreenHeight} / 2

// test

//

Call Resolution
Call UnZoom
Delay 2000

Compute FlaxSet = floor((($SeedX * (($Pick * $Seeds) - 1) + $SSeeds) - 21) / 20)

Loop $Rounds
  If $Job = Seeds or $Job = Both
    Call Seeds
  End
  Loop $FlaxSet
    If $Job = Flax or $Job = Both
      Call Flax
    End
    If $Rot = True and $Job <> Seeds
      Call Rot
    End
    Delay 2000
    If $Dump = True and $Job <> Seeds
      Call Dump   //Dumps raw flax into a chest
    End
  End
End

Call Zoom

Procedure Seeds
  If $PlantDir = 0
    MousePos $LeftStep
  Else
    MousePos $RightStep
  End
  Leftclick
  delay 500
  
  Call Plant
  
  Loop $SeedX
    If $PlantDir = 0
      Call MoveLeft
    Else
      Call MoveRight
    End
  End
  
  Call MoveDown
  
  Loop $SeedX
    Call MoveRight
  End
  
  SetConst SS1X = $RSide3X
  SetConst SS1Y = $RSide3Y
  SetConst SS2X = $RSide2X
  SetConst SS2Y = $RSide2Y
  Call SideStep
  
  Delay 2000
  
  Loop $Pick
    Set Rip = {loopno}
    //Check for Seeds Left
    SetConst Direction = 0
    Compute PickX = $SeedX + 1
    SetConst NewX = $Left2X
    Call PickSeeds
    //    //Move to 2nd row
    SetConst SS1X = $LSide1X
    SetConst SS1Y = $LSide1Y
    SetConst SS2X = $LSide2X
    SetConst SS2Y = $LSide2Y
    Call SideStep
    
    //Check for Seeds Right
    SetConst Direction = 1
    Compute NewX = $Right2X
    Call PickSeeds
    //Move to 1st Row
    SetConst SS1X = $RSide1X
    SetConst SS1Y = $RSide1Y
    SetConst SS2X = $RSide2X
    SetConst SS2Y = $RSide2Y
    Call SideStep
  End
  
  MousePos $ResetX, $ResetY
  Delay $MDelay
  Leftclick
  delay 3000
End

Procedure Flax
  If $Water = 1
    If $WaterB = 0
      Call FindButton
    End
    Call Water
  End
  
  MousePos $LeftStep
  Leftclick
  Delay 2000
  Call Group
  
  MousePos $CenterX, $FR3Y
  Delay $MDelay
  LeftClick
  Delay 500
  
  Call Group
  
  MousePos $FMX, $FMY
  Delay 350
  LeftClick
  Delay 3000
  
  loop $Weed
    Set Flax = {loopno}
    Call WeedLeft
    compute WeedY = $WeedY + $Mod1
    Call WeedRight
    compute WeedY = $WeedY + $Mod2
    Call WeedLeft
    compute WeedY = $WeedY + $Mod3
    Call WeedRight
    
    Call ResReset
    Delay 1000
  end
  
  SetConst Flax = 1
  MousePos $RightStep2
  Leftclick
  Delay 3500
End

Procedure Rot
  Compute TempX = $CenterX / 2
  MousePos $TempX, $CenterY
  Delay $MDelay
  Keys {ESC}
  Delay $MDelay
  
  Compute TempX = {MouseX} + 19
  Compute TempY = {MouseY} + 55
  MousePos $TempX, $TempY
  Delay $MDelay
  rightclick
  Delay $MDelay
  
  Compute TempX = {MouseX} + 21
  Compute TempY = {MouseY} + 24
  MousePos $TempX, $TempY
  Delay $MDelay
  rightclick
  Delay $MDelay
  
  Compute TempY = $CenterY + 55
  MousePos $CenterX, $TempY
  Delay $MDelay
  Rightclick
  Delay $MDelay
  Compute TempY = $CenterY + 108
  MousePos $CenterX, $TempY
  Delay $MDelay
  Rightclick
  Delay $MDelay
End

Procedure Dump
  MousePos $DumpX, $DumpY
  Delay $MDelay
  Leftclick
  Delay 200
  Compute NewX = $DumpX + 10
  MousePos $NewX, $DumpY
  Delay $MDelay
  Rightclick
  Delay 200
  Compute TempY = $CenterY + 55
  MousePos $CenterX, $TempY
  Delay $MDelay
  Rightclick
  Delay $MDelay
end

Procedure MoveLeft
  MousePos $LeftX, $LeftY
  Delay 350
  LeftClick
  Delay 350
  Call Plant
End

Procedure MoveRight
  MousePos $RightX, $RightY
  Delay 350
  LeftClick
  Delay 350
  Call Plant
End

Procedure Plant
  MousePos $XPlant, $YPlant
  Delay 350
  LeftClick
  Delay 350
End

Procedure Group
  Call Plant
  loop 4
    Call MoveLeft
  end
  
  Call MoveDown
  
  loop 4
    Call MoveRight
  end
End

Procedure MoveDown
  MousePos $DownX, $DownY
  Delay 350
  LeftClick
  Delay 350
  Call Plant
End

Procedure Weed
  SetConst Picked = 0
  While $Picked = 0
    MousePos $WeedX, $WeedY
    Delay 100
    Compute ResX = {MouseX} + 10
    Compute ResY = {MouseY} - 13
    Rightclick
    Delay $MDelay
    Case
    When $Flax = $Weed
      Timestamp {MouseX}, {MouseY}
      IsObject $Harvest at $ResX, $ResY   //$ObjX, $ObjY
        Compute TempX = $WeedX + 20
        Compute TempY = $WeedY - 7
        MousePos $TempX, $TempY
        Delay 200
        Rightclick
        Delay 100
        SetConst Picked = 1
        Break
      End
    Else
      IsObject $WeedF at $ResX, $ResY   //$ObjX, $ObjY
        Compute TempX = $WeedX + 20
        Compute TempY = $WeedY - 7
        MousePos $TempX, $TempY
        Delay 200
        Rightclick
        Delay 100
        SetConst Picked = 1
        Break
      End
    End
    
    Compute TempX = $WeedX - 2
    MousePos $TempX, $WeedY
    Delay $MDelay
    Rightclick
  End
End

Procedure WeedLeft
  Call Weed
  Loop 4
    compute WeedX = $WeedX - $Mod1
    //Compute ResX = $ResX - $Mod1
    Call Weed
  End
End

Procedure WeedRight
  Call Weed
  loop 4
    compute WeedX = $WeedX + $Mod1
    //Compute ResX = $ObjX + $Mod1
    Call Weed
  end
End

Procedure PickSeeds
  Loop $PickX
    MousePos $NewX, $LeftY
    Delay $SDelay
    SetConst Picked = 0
    While $Picked = 0
      MousePos $NewX, $LeftY
      Delay $SDelay
      Rightclick
      Delay $SDelay
      Compute ResX = {MouseX} + 10
      Compute ResY = {MouseY} - 13
      Case
      When $Direction = 0
        IsObject $Harvest at $ResX, $ResY
          Compute TempX = $ResX + 5  //1920x1080
          Compute TempY = $ResY + 5  //- 10 //1920x1080
          MousePos $TempX, $TempY
          Delay $SDelay
          rightclick
          Inc Picked
          Delay 1800
          If $Rip = $Pick
            Compute TempX = $NewX + $RipD0
            timestamp $NewX
            MousePos $TempX, $LeftY
            Delay $MDelay
            Rightclick
            Delay $MDelay
            Compute RipX = $TempX + 17
            Compute RipY = $LeftY + 22
            Mousepos $RipX, $RipY
            Delay $MDelay
            Rightclick  //Opens Util menu
            Delay $MDelay
            Compute RipX = $RipX + 15
            Compute RipY = $RipY - 25
            MousePos $RipX, $RipY
            Delay $MDelay
            Rightclick //Rips
            Delay $MDelay
          End
          Continue
        Else
          Compute TempX = $NewX - 2
          MousePos $TempX, $LeftY
          Delay $SDelay
          Rightclick
        End
        
      When $Direction = 1
        IsObject $Harvest at $ResX, $ResY
          Compute TempX = $ResX + 5
          Compute TempY = $ResY + 5
          MousePos $TempX, $TempY
          Delay $SDelay
          rightclick
          Inc Picked
          Delay 1800
          If $Rip = $Pick
            Compute TempX = $NewX - $RipD1
            MousePos $TempX, $LeftY
            Delay $SDelay
            Rightclick
            Delay $SDelay
            Compute RipX = $TempX + 17
            Compute RipY = $LeftY + 22
            Mousepos $RipX, $RipY
            Delay $SDelay
            Rightclick //Opens Util menu
            Delay $MDelay
            Compute RipX = $RipX + 15
            Compute RipY = $RipY - 25
            MousePos $RipX, $RipY
            Delay $MDelay
            Rightclick //Rips
            Delay $MDelay
          End
          Continue
        Else
          SetConst TempX = $NewX
          SetConst TempY = $LeftY
          Compute TempX = $NewX - 2
          MousePos $TempX, $LeftY
          Delay $MDelay
          Rightclick
        End
      End
    End
  End
End

Procedure SideStep
  MousePos $SS1X, $SS1Y
  Delay $MDelay
  Leftclick
  Delay 2250
  MousePos $SS2X, $SS2Y
  Delay $MDelay
  Leftclick
  Delay 850
End

Procedure Coords
  Bell Asterisk
  Delay 10000
  //Loadrgb {mousey}, {mousey}
  //keys {rgbred},{rgbgreen},{rgbblue}
  Keys {mousex}, {mousey}
End

Procedure FindButton
  MousePos $WaterX, $WaterY
  Delay $MDelay
  While $count > 295
    MousePos $WaterX, $WaterY
    IsObject Water at {mousex}, {mousey}
      SetConst WaterX = {mousex}
      SetConst WaterY = {mousey}
      SetConst WaterB = 1
      Set Count = 294
    Else
      Compute WaterX = $WaterX - 1
      dec count
    End
  End
End

Procedure Water
  MousePos $WaterX, $WaterY
  Delay 200
  Rightclick
  Delay $MDelay
  Compute TempY = $CenterY + 55
  MousePos $CenterX, $TempY
  Delay $MDelay
  Rightclick
  Delay 3000
End

Procedure Zoom
  MousePos 100, 20
  Delay $Zoom
  MousePos 600, 600
  Delay $MDelay
End

Procedure UnZoom
  Mousepos 989, 1079
  Delay $UnZoom
  Mousepos 600, 600
  Delay $MDelay
End

Procedure ResReset
  Case
  When $Res = 1280x1024
    SetConst WeedX = 916
    SetConst WeedY = 284
  When $Res = 1360x768
    SetConst WeedX = 952
    SetConst WeedY = 153
  When $Res = 1920x1080
    SetConst WeedX = 1364
    SetConst WeedY = 215
  End
End

Procedure Resolution
  Case
  When $Res = 1280x1024
    Set Leftstep = 559, 531
    Set LeftX = 494
    Set LeftY = 531
    Compute DownX = $CenterX - 5
    Set DownY = 670
    Compute RightX = $CenterX + 134
    Set RightY = 531
    Set RSide3X = 800
    Set RSide3Y = 389
    Set RSide2X = 663
    Set RSide2Y = 531
    Set Left2X = 396
    Set LSide1X = 322
    Set LSide1Y = 653
    Set LSide2X = 609
    Set LSide2Y = 531
    Set Right2X = 877
    Set RSide1X = 937
    Set RSide1Y = 395
    Set RipD0 = 148
    Set RipD1 = 152
    Set ResetX = 506
    Set ResetY = 526
    Set FMX = 351
    Set FMY = 279
    Set FR3Y = 733
    Set WeedX = 916
    Set WeedY = 284
    Set Mod1 = 140
    Set Mod2 = 220
    Set Mod3 = 132
    Set RightStep2 = 974, 294
    Set WeedF = WeedF
    Set Harvest = Harvest
  When $Res = 1360x768         //1360x768
    Set Leftstep = 593, 403
    Set LeftX = 525
    Set LeftY = 403
    Compute DownX = $CenterX - 5
    Set DownY = 545
    Compute RightX = $CenterX + 142
    Set RightY = 403
    Set RSide3X = 850
    Set RSide3Y = 253
    Set RSide2X = 714
    Set RSide2Y = 403
    Set Left2X = 425
    Set LSide1X = 344
    Set LSide1Y = 541
    Set LSide2X = 632
    Set LSide2Y = 403
    Set Right2X = 940
    Set RSide1X = 994
    Set RSide1Y = 255
    Set RipD0 = 152
    Set RipD1 = 163
    Set ResetX = 527
    Set ResetY = 420
    Set FMX = 376
    Set FMY = 145
    Set FR3Y = 614
    Set WeedX = 952
    Set WeedY = 153
    Set Mod1 = 147
    Set Mod2 = 213
    Set Mod3 = 150
    Set RightStep2 = 1037, 162
    Set WeedF = WeedF
    Set Harvest = Harvest
  End
End
Bell Exclamation
//Written with ACTool 5.4.0 by Anka