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

From ATITD5
< User:Anka‎ | Macros
Revision as of 21:46, 26 October 2010 by Anka (talk | contribs) (Created page with "<pre> //Anka's Flax Macro v.4.0 //This macro will plant beds for seeds. After Seeds are //done, it will plant 20 beds of flax and either keep the flax //in inventory, store fla...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
//Anka's Flax Macro v.4.0

//This macro will plant beds for seeds.  After Seeds are
//done, it will 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.
//
//I have not played since Tale 3 and have switched monitors since then.
//This and future macros will be tailored for 1920x1080 resolution but I
//will eventually add built in resolutions for all macros.  This addition
//may take a while since I'm trying to get everything running again.  Chat me
//in game with your prefered resolution and I'll do the most popular resolutions
//first.
//
//Setup  
//1. Resolution 1920x1080. Have not tested with others.
//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.  Win& 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.
//If using new seeds, you can use the Dump option to store rotten flax in the same
//way.  You just can't store flax and rotten flax.  You can Rot flax and store
//rotten flax if you like.
//
//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.  1 issue that might
//come up is that the macro may run slow on older computers.  Chat me in game if you
//have problems and I can try to cut it down a bit.  It's working perfectly for me.
//
//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.
//"Resolution"   = This is for a future addon.
//
//
//Let me know if you have any problems.  It's good to be back and nice to see that some
//of my old macro's are still being used today. :)
//
//Finally cleaned the instructions this Tale :)  Ignore the comments in code like the one below.
//It's from the original build.  It's all set by the menu now.
//
//Enjoy!  Anka


constants
  SeedX = 2  //Set this to how many plantings - 1 per row for seeds
  Seeds = 0
  Rounds = 2
  Button = 0
  ButtonX = 475
  ButtonY = 98 //32
  Count = 475
  CenterX = 510
  CenterY = 383
  DumpX = 0
  DumpY = 0
  SubX = 20
  PickX = 0
  TempX = 0
  TempY = 0
  Left2X = 620  //119
  LeftX = 750
  LeftY = 561  //395
  RightX = 1146
  RightY = 561 //395
  Right2X = 1320
  TextX = 0
  TextY = 0
  RipX = 0
  RipY = 0
  WeedX = 1364  //741
  WeedY = 215  //85
  LSide1X = 415
  LSide2X = 910 //403
  LSide1Y = 780  //548
  LSide2Y = 561  //395
  RSide1X = 1415 //1011
  RSide2X = 996  //650
  RSide1Y = 331  //225
  RSide2Y = 561  //395
  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  //45
  LeftStep = 756, 561  // 256, 395
  RightStep2 = 1563, 250
  Picked = 0
  Direction = 0
  Pick = 3
  Rip = 0
  Flax = 1
  Reset = 825, 113
  Weed = 0
  Job = 0
  Dump = 0
  Rot = 0
  MDelay = 200
  Water = 0
  ResetX = 850
  Res1920x1080X = 630 //686  //178
  Res1920x1080Y = 548  //548
end

Object FlaxH1920x1080old //178, 557
  228=0,10
  235=2,0|232=2,2|234=2,6|227=2,8|227=2,10
  234=4,0|230=4,2|235=4,6|225=4,8|223=4,10
  217=6,10
  222=8,0|216=8,2|219=8,4|168=8,8|222=8,10
  223=10,0|217=10,4|214=10,6|224=10,10
  220=12,0|216=12,4|214=12,6|154=12,8|214=12,10
  228=14,0|223=14,2|225=14,4|224=14,6|206=14,8|212=14,10
  217=16,0|154=16,2|207=16,4|210=16,6|210=16,8|216=16,10
  224=18,0|227=18,4|229=18,6|224=18,8|229=18,10
  220=20,0|166=20,4|227=20,6|220=20,8|220=20,10
End

Object Rip  //405, 563
  235=0,10
  235=2,2|238=2,4|237=2,6|233=2,8|235=2,10
  58=4,0|236=4,2|59=4,4|59=4,6|234=4,8|230=4,10
  232=6,0|237=6,2|236=6,4|237=6,6|57=6,8|233=6,10
  235=8,0|235=8,2|236=8,4|230=8,6|225=8,8|223=8,10
  234=10,0|231=10,2|234=10,4|235=10,6|225=10,8|222=10,10
  230=12,0|114=12,2|231=12,4|230=12,6|55=12,8|225=12,10
  235=14,0|236=14,4|234=14,6|222=14,10
  232=16,0|235=16,2|231=16,8|226=16,10
  240=18,0|239=18,2|239=18,4|239=18,6|233=18,8|226=18,10
  234=20,0|237=20,2|235=20,4|235=20,6|231=20,8|229=20,10
End

Object FlaxH1920x1080  //178,562
  235=2,0|232=2,2|234=2,6
  234=4,0|230=4,2|235=4,6
End

Object WinCheck
  148=2,0|148=2,2|148=2,4|148=2,6
  237=4,0|240=4,2|234=4,4|238=4,6
  240=6,0|242=6,2|230=6,4|237=6,6
End

Object SmallH //686, 548
  235=2,0|232=2,2|234=2,6
  234=4,0|230=4,2|235=4,6
  222=8,0|216=8,2|219=8,4
  223=10,0|217=10,4|214=10,6
  220=12,0|216=12,4|214=12,6
  228=14,0|223=14,2|225=14,4|224=14,6
  217=16,0|154=16,2|207=16,4|210=16,6
  224=18,0|227=18,4|229=18,6
  220=20,0|166=20,4|227=20,6
End

Object WeedF  //1375, 202
  59=0,0|57=0,2|173=0,4|233=0,6
  233=2,0|227=2,2|229=2,4|172=2,6
  170=4,0|54=4,2|109=4,4|222=4,6
  227=6,0|109=6,2|112=6,4|229=6,6
  220=8,0|218=8,2|219=8,4|216=8,6
  54=10,0|53=10,2|165=10,4|219=10,6
End

Object Harvest
  237=0,0|229=0,2|233=0,6
  233=2,0|227=2,2|230=2,6
  227=4,0|219=4,2|222=4,6
  227=6,0|218=6,2|224=6,4|229=6,6
  220=8,0|219=8,4|108=8,6
  218=10,0|220=10,4|219=10,6
End

Object Skills  //615, 640
  116=0,0|114=0,2|232=0,4|231=0,6
  227=2,0|226=2,2|233=2,4|227=2,6
  56=4,0|223=4,2|226=4,4|219=4,6
  230=6,0|169=6,2|231=6,4|222=6,6
  230=8,0|228=8,2|231=8,4|222=8,6
  232=10,4|227=10,6
End

Object Rot
  220=0,0|220=0,2|223=0,4|108=0,6
  228=2,0|227=2,2|223=2,4|222=2,6
  220=4,0|215=4,2|218=4,4|218=4,6
  222=6,0|219=6,2|223=6,4|222=6,6
  222=8,0|224=8,2|225=8,4|225=8,6
  229=10,0|228=10,2|226=10,4|228=10,6
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}

Form Flax, Settings
  ed1=Combobox:Job:Seeds, Flax, Both              //Job Type
  ed2=Editbox:Seed Plants   (Even Number):2       //Number of beds you want to plant for seeds
  ed3=Editbox:Batch:1                             //Number of times to run Job
  ed4=Combobox:Pick Rounds:1, 2, 3, 4, 5          //Number of times to harvest seeds before ripping out beds
  ed5=Combobox:Weed #:3, 2                        //Total number to Weed and Water a variety of flax
  ed9=Editbox:Seeds / Pick:1                      //Number of seeds per picking
  ed6=CheckBox:Dump:False                         //Toggle to Dump flax in chest
  ed7=CheckBox:Rot:False                          //Toggle to Rot flax
  ed10=CheckBox:Need Water:True                   //Toggle if flax needs to be watered
  ed8=Editbox:Resolution:1920x1080                //Future Addon
end

FormLoad Flax, Flax.frm

if ShowForm Flax
  Set Seeds = Flax[ed9]
  if Flax[ed10] = True
    Set Water = 1
  Else
    Set Water = 0
  End
  If Flax[ed1] = Seeds
    Set Button = 1
  End
  Compute SeedX = Flax[ed2]/2 - 1
  Set Rounds = Flax[ed3]
  Set Pick = Flax[ed4]
  Set Weed = Flax[ed5]
  
  Case
  When Flax[ed1] = Flax
    Set Pick = 2
  End
else
  stop
end

FormSave Flax, Flax.frm

MousePos 100, 20
LeftClick
Delay 400

// test

//
Call UnZoom

Compute FlaxSet = $Pick * $Seeds - 1
Loop $Rounds
  If Flax[ed1] = Seeds or Flax[ed1] = Both
    Call Seeds
  End
  Loop $FlaxSet
    If Flax[ed1] = Flax or Flax[ed1] = Both
      Call Flax
    End
    If Flax[ed7] = True
      Call Rot
    End
    Delay 4000
    If Flax[ed6] = True
      Call Dump   //Dumps raw flax into a chest
    End
  End
End

Call Zoom

Procedure Seeds
  MousePos $LeftStep
  Leftclick
  delay 500
  Call Plant
  
  Loop $SeedX
    Call MoveLeft
  End
  
  Call MoveDown
  
  Loop $SeedX
    Call MoveRight
  End
  
  //MousePos 1230, 354 //1600, 180  //900, 220      <<<<<-----------------Fix
  //stop
  SetConst SS1X = $RSide3X
  SetConst SS1Y = $RSide3Y
  SetConst SS2X = $RSide2X
  SetConst SS2Y = $RSide2Y
  Call SideStep
  
  
  Delay $MDelay
  Leftclick
  Delay 4000
  
  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, 570
  Delay $MDelay
  Leftclick
  delay 3000
End

Procedure Flax
  If $Water = 1
    Call FindButton
    Call Water
  End
  MousePos $LeftStep
  Leftclick
  Delay 2000
  Call Group
  
  MousePos 977, 840
  Delay $MDelay
  LeftClick
  Delay 500
  
  Call Group
  
  MousePos 564, 193
  Delay 350
  LeftClick
  Delay 3000
  
  loop $Weed //Change this number to equal how many times you have to weed
    //and or water + 1. for Old egypt and green nile this number is 3
    Set Flax = {loopno}
    Call WeedLeft
    
    compute WeedY = $WeedY + $Mod1
    Compute ObjY = $ObjY + $Mod1
    
    Call WeedRight
    
    compute WeedY = $WeedY + $Mod2
    Compute ObjY = $ObjY + $Mod2
    
    Call WeedLeft
    
    compute WeedY = $WeedY + $Mod3
    Compute ObjY = $ObjY + $Mod3
    
    Call WeedRight
    
    SetConst WeedX = 1364
    SetConst WeedY = 215
    SetConst ObjX = 1375
    SetConst ObjY = 202
    Delay 1000
  end
  
  SetConst ObjX = 1375
  SetConst Flax = 1
  MousePos $RightStep2
  Leftclick
  Delay 3500
End

Procedure Rot
  MousePos 600, 600
  Delay $MDelay
  Keys {ESC}
  Timestamp {mousex}, {mousey}
  Delay $MDelay
  
  IsObject Skills at 615, 527
    MousePos 615, 527
  end
  IsObject Skills at 615, 543
    MousePos 615, 543
  end
  IsObject Skills at 615, 560
    MousePos 615, 560
  end
  IsObject Skills at 615, 576
    MousePos 615, 576
  end
  IsObject Skills at 615, 592
    MousePos 615, 592
  end
  IsObject Skills at 615, 608
    MousePos 615, 608
  end
  IsObject Skills at 615, 624
    MousePos 615, 624
  end
  IsObject Skills at 615, 640
    MousePos 615, 640
  end
  IsObject Skills at 615, 656
    MousePos 615, 656
  end
  IsObject Skills at 615, 673
    MousePos 615, 673
  End
  
  Delay $MDelay
  Rightclick
  Delay $MDelay
  
  IsObject Rot at 638, 608
    MousePos 638, 608
  end
  IsObject Rot at 638, 624
    MousePos 638, 624
  end
  IsObject Rot at 638, 640
    MousePos 638, 640
  end
  IsObject Rot at 638, 656
    MousePos 638, 656
  end
  IsObject Rot at 638, 673
    MousePos 638, 673
  End
  
  Delay $MDelay
  Rightclick
  Delay $MDelay
  MousePos 961, 594
  Delay $MDelay
  Rightclick
  Delay $MDelay
  MousePos 959, 651
  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
  MousePos 960, 594
  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 960, 781 //572, 600 //512, 540
  Delay 350
  LeftClick
  Delay 350
  Call Plant
End

Procedure Weed
  SetConst Picked = 0
  While $Picked = 0
    MousePos $WeedX, $WeedY
    Delay 100
    Rightclick
    Delay $MDelay
    Case
    When $Flax = $Weed
      IsObject Harvest at $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 $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 ObjX = $ObjX - $Mod1
    Call Weed
  End
End

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

Procedure PickSeeds
  Loop $PickX
    MousePos $NewX, $LeftY
    Delay $MDelay
    SetConst Picked = 0
    While $Picked = 0
      MousePos $NewX, $LeftY
      Delay $MDelay
      Rightclick
      Delay $MDelay
      Case
      When $Direction = 0
        IsObject SmallH at $Res1920x1080X, $Res1920x1080Y
          Compute TempX = $NewX + 15  //1920x1080
          Compute TempY = $LeftY - 10 //1920x1080
          MousePos $TempX, $TempY
          
          Delay 100
          rightclick
          Inc Picked
          Delay 1800
          If $Rip = $Pick
            Compute TempX = $NewX + 210
            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 $MDelay
          Rightclick
        End
        
      When $Direction = 1
        Compute TextX = $NewX + 10
        //        Compute TextY = $LeftY - 22
        IsObject FlaxH1920x1080 at $TextX, $Res1920x1080Y
          Compute TempX = $NewX + 15
          Compute TempY = $LeftY -10
          MousePos $TempX, $TempY
          Delay 100
          rightclick
          Inc Picked
          Delay 1800
          If $Rip = $Pick
            Compute TempX = $NewX - 190
            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
          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 $ButtonX, $ButtonY
  Delay $MDelay
  While $count > 295
    MousePos $ButtonX, $ButtonY
    IsObject Water at {mousex}, {mousey}
      Set ButtonX = {mousex}
      Set ButtonY = {mousey}
      Bell
      Set Count = 294
    Else
      Compute ButtonX = $ButtonX - 1
      dec count
    End
  End
End

Procedure Water
  MousePos $ButtonX, $ButtonY
  Delay 200
  Rightclick
  Delay $MDelay
  MousePos 961, 594
  Delay $MDelay
  Rightclick
  Delay 3000
End

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

Procedure UnZoom
  Mousepos 989, 1079
  Delay 900
  Mousepos 600, 600
  Delay $MDelay
End
Bell Exclamation
//Written with ACTool 5.4.0 by Anka