The Wiki for Tale 4 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:TamBlack/Macros

From A Tale in the Desert
Jump to navigationJump to search

Icon gather

//General purpose slate and clay collector.  Works best without water jugs
//or a fishing pole.  To begin, hover your mouse over the icon
//you wish to collect in ATITD (i.e. be over a patch of clay or a piece of
//slate and have this program active.  Press F2, and the macro will start.
Constants
Red = 0
Green = 0
Blue = 0
XPos = 0
YPos = 0
CurrKey = 0
End
SetConst XPos = {MouseX}
SetConst YPos = {MouseY}
LoadRGB $XPos, $YPos
SetConst Red = {RGBRed}
SetConst Blue = {RGBBlue}
SetConst Green = {RGBGreen}
SetConst CurrKey = {GlobalKeys}



loop 10000


GetRed  $XPos, $YPos = $Red
	GetGreen  $XPos, $YPos = $Green
		GetBlue  $XPos, $YPos = $Blue
	
			MousePos $XPos, $YPos
			Delay 5
  		LeftClick 
		End
	End
End
	
Delay 100
End

Charcoal Heart

//Charcoal Hearth
//   
//  TamBlack:
//   - Make sure TAKE is NOT an option!! Only use SETUP option ONCE!!
//   - To test the y position, start with 1 heart/oven and press begin. Then run the macro
//     with 1 oven and only checked boxes for Guilded + Need setup + Mouse check. The cursor
//     will then go over all the important locations so you can see if the y is lined up correctly.
//
//   I've made some improvements to the Hearth macro.  Depending on your resolution,
//   the macro will run up to 12 guilded hearths.  I've tested it in 1280x960
//   resolution without any need to change values.  It may work in other resolutions
//   also but I have not been able to test it.  If you are using personal hearths,
//   it will run up to 10 in 1280x960.  Maximum number in 1024x768 is 8.
//
// Setup:  I've added a setup routine to the macro.  Pin the windows on top of each
//         other in the top left corner.  I suggest at least 200 wood per hearth
//         and about 15 water per hearth to be safe.  All hearths are slightly
//         different but I suggest that you put your fastest burning hearths first
//         in line.  You can tweak the settings in the built in menu.
//
//         Hearths: Total number of hearths you are running.
//         Hearths Across: How many Hearths on the top row of windows.  Make sure
//                         you set this each time even if you are running 1 hearth.
//                         Variables in the macro are set off of this number.
//         Guilded?: Check this box if you are using guilded hearths.
//         Need Setup?: Check this box if you need the macro to position your
//                      windows that are stacked in top left corner.  This is
//                      usefull if you run another round on the hearths and your
//                      windows are set up already.  Check if needed or not.
//         Stealth Mouse: Check this if you don't want to see the mouse move around
//                        on the hearth windows.  When checked, it will save your
//                        mouse position, move to the spot it needs, perform its
//                        action then return the pointer to where it started.  Alows
//                        you to change chat windows are dig in chest while the
//                        macro is running :)
//         Heat: Threshold for Heat bar, increase or decrease as needed. If heat
//               reaches this lvl, water will be added.
//         Wood: Wood threshold, adds wood up to this point.
//         Water: Alowable water level, not much play here. If the water lvl is above
//                this lvl, water will not be added. Prevents drowning the hearth.
//         RGBGreen: Used to detect completion bar. If the macro adds a bunch of water
//                   before the macro is done then moves to the next hearth, increase
//                   this number. Or lower it if it doesnt see green.
//         RGBBlue: Works just like RGBGreen but for blue bars.  If the macro keeps
//                  adding wood till the hearth is full, it's not seeing blue.  If
//                  this happens, lower this number.  Other problem may be that the
//                  mouse pointer is not lining up over the bar correctly.  Run the
//                  Mouse Test.
//         Check Bars Interval: This is the pause time between bar checks.  The
//                              default value of 4000 works well for 1-8 hearths
//                              but you may need to decrease this number if you
//                              are running more than 8.
//         Mouse Test: This is to test if the mouse pointer is lining up correctly
//                     with your windows.  Run 1 hearth manually and start the macro
//                     with this option checked.  You don't need to worry about any
//                     other option.  It will move over the Heat, Wood, Water, Danger,
//                     and Status bar then over the Wood and Water buttons 10 times
//                     before it stops.  If these positions are off a bit, you can
//                     change the Y coordinates below in the constants section.
//
//         The macro doesn't watch Oxygen.  I was going to add a vent option but this
//         macro runs very well and never fails for me.  If your oxygen is getting too
//         high, try adding more wood.  But, by adding more wood, you add more heat
//         which may require you adding more water.  A small amount of water in the
//         presence of heat evaporates producing more Oxygen. :)  Find the balance
//         you want.
//
//  ENJOY! :)  Come visit me in LE :) 780, 6956  I have a large bar with tasting
//             tables and hookahs.
//  Anka
//
Constants
  //User Definable variables
  Hearths = 4
  HeatX = 165
  WoodX = 107
  WaterX = 76
  DangerX = 164
  RGBBlue = 220
  RGBGreen = 240
  Guild = 1

  // Y Coordinates - Don't change unless you are having a problem.
  // TamBlack: Oven value = -15 // heart value = -5 //original value
  RegY = 54//69//74      // Y coord for Regulator button
  BeginY = 225//240//245   // Y coord for Begin Button
  HeatY = 136//151//156    // Y coord for Heat Bar
  WoodY = 160//175//180    // Y coord for Wood Bar
  WaterY = 172//187//192   // Y coord for Water Bar
  DangerY = 184//199//204  // Y coord for Danger Bar
  StatusY = 196//211//216  // Y coord for Status Bar
  WoodBY = 230//245//250   // Y coord for Wood and Water buttons
  //End User variables
  
  Hrow = 0
  Hrow1 = 0
  AddX = 226
  Add2X = 15
  Add1Y = 65
  Add2Y = 17
  Add3Y = 250
  RegX = 47
  BeginX = 111
  NewX = 0
  New2X = 0
  New2Y = 0
  NewY = 0
  Heat = 0
  Wood = 0
  Water = 0
  Danger = 0
  Status = 0
  OxyY = 168
  StatusX = 167
  WoodBX = 35
  WaterBX = 85
  Num = 0
  Jump = 5
  JumpM = 0
  Jumped = 0
  Used = 0
  MDelay = 250
  SDelay = 200
  S1Delay = 100
  Count = 0
  CountM = 0
  MouseX = 0
  MouseY = 0
  CheckDelay = 0
  Setup = 0
  SetX = 10
  SetY = 40
  SetAddX = 227
  SetAddY = 250
  SetLoop = 0
  Mouse = 1
  OrigX = 0
  OrigY = 0
End

Form ccHearth, Settings
  ed1=Combobox:Hearths:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
  ed13=Editbox:Hearths Across:4
  ed2=CheckBox:Guilded?:True
  ed14=Checkbox:Need Setup?:True
  ed15=Checkbox:Stealth Mouse:False
  ed3=Editbox:Heat                  (75-188):165
  //ed10=Editbox:HeatMin            (75-188):116
  //ed11=Editbox:HeatMax           (75-188):184
  //ed4=Editbox:Low Oxy            (75-188):82
  //ed5=Editbox:High Oxy           (75-188):134
  ed6=Editbox:Wood                (75-188):107
  ed7=Editbox:Water                (75-188):76
  ed8=Editbox:RGBGreen:240
  ed9=Editbox:RGBBlue:220
  ed12=Editbox:Check Bars Interval  (miliseconds):4000
  ed16=Checkbox:Mouse Check:False
end

FormLoad ccHearth, ccHearth.frm

if ShowForm ccHearth
  SetConst Hearths = ccHearth[ed1]
  If ccHearth[ed2] = True
    SetConst Guild = 1
  Else
    SetConst Guild = 0
  End
  SetConst HeatX = ccHearth[ed3]
  //SetConst Oxy1X = ccHearth[ed4]
  //SetConst Oxy2X = ccHearth[ed5]
  SetConst WoodX = ccHearth[ed6]
  SetConst WaterX = ccHearth[ed7]
  SetConst RGBGreen = ccHearth[ed8]
  SetConst RGBBlue = ccHearth[ed9]
  //SetConst HeatMin = ccHearth[ed10]
  //SetConst HeatMax = ccHearth[ed11]
  SetConst CheckDelay = ccHearth[ed12]
  Set HRow = ccHearth[ed13]
  Compute SetLoop = $Hearths - 1
  Compute HRow1 = $Hrow + 1
  If ccHearth[ed15] = True
    Set Mouse = 0
  End
else
  Stop
end

FormSave ccHearth, ccHearth.frm

MousePos 100, 20  //Activates eGenesis window.. Don't run ACTool maximized.
Delay $MDelay
LeftClick
Delay 2000

If $Guild = 1
  Call Guild
End
if ccHearth[ed16] = True
  Call HearthTest
End
If ccHearth[ed14] = True
  Call Setup
End

Call SetReg
SetConst NewX = $BeginX
SetConst NewY = $BeginY
SetConst Count = 1
Loop $Hearths
  If $Count = $HRow1 //$Jump
    SetConst NewX = $BeginX
    Compute NewY = $BeginY + $Add3Y
  End
  MousePos $NewX, $NewY
  Delay $MDelay
  Rightclick
  Delay $MDelay
  Compute NewX = $NewX + $AddX
  Compute Count = $Count + 1
End
SetConst NewX = $BeginX  //Dont remember why this is here :)
Call Main

Procedure Setup
  Set NewX = $SetX
  Set NewY = $SetY
  Loop $SetLoop
    Mousepos $SetX, $SetY
    if {loopno} = $HRow
      Set NewX = $SetX
      Compute NewY = $SetY + $SetAddY
    else
      Compute NewX = $NewX + $SetAddX
    End
    Dragto $NewX, $NewY
  End
End

Procedure Main
  SetConst CountM = 1
  SetConst Status = 0
  Compute JumpM = $HRow1 - 1 //$Jump - 1
  Loop $Hearths
    If $CountM = $HRow1 //$Jump
      // may have to use New Newx and newy variables in Main
      SetConst NewX = $StatusX
      Compute NewY = $StatusY + $Add3Y
      SetConst New2X = $WaterBX
      Compute New2Y = $WoodBY + $Add3Y
    End
    
    While $Status = 0
      Call CheckBars
      If $Status = 1
        Call Snuff
        //code to advance to next hearth
        Compute Used = $Used + 1
        If $Used = $JumpM
          Compute HeatX = $HeatX - (($Used - 1) * $AddX)
          Compute HeatY = $HeatY + $Add3Y
          Compute WoodX = $WoodX - (($Used - 1) * $AddX)
          Compute WoodY = $WoodY + $Add3Y
          Compute WaterX = $WaterX - (($Used - 1) * $AddX)
          Compute WaterY = $WaterY + $Add3Y
          Compute DangerX = $DangerX - (($Used - 1) * $AddX)
          Compute DangerY = $DangerY + $Add3Y
          Compute StatusX = $StatusX - (($Used - 1) * $AddX)
          Compute StatusY = $StatusY + $Add3Y
          //Compute WaterBX = $WaterBX - (($Used -1) * $AddX)
          //Compute WoodBX = $WoodBX - (($Used - 1 ) * $AddX)
          //Compute WoodBY = $WoodBY + $Add3Y
          SetConst Jumped = 1
          Continue
        Else
          Compute HeatX = $HeatX + $AddX
          Compute WoodX = $WoodX + $AddX
          Compute WaterX = $WaterX + $AddX
          Compute DangerX = $DangerX + $AddX
          Compute StatusX = $StatusX + $AddX
          //Compute WaterBX = $WaterBX + $AddX
          //Compute WoodBX = $WoodBX + $AddX
        End
        Continue
      End
      If $Heat = 0 and $Danger = 0 and $Wood = 0
        Call Wood
      Else
        If $Heat = 1 or $Danger = 1
          If $Water = 0
            Call Water
          End
        End
      End
      
      Delay $CheckDelay
    End
    Compute CountM = $CountM + 1
    SetConst Status = 0
  End
End

Procedure CheckBars
  If $Mouse = 1
    MousePos $HeatX, $HeatY
    Delay $SDelay
  end
  LoadRGB $HeatX, $HeatY
  if {RGBBlue} > $RGBBlue
    SetConst Heat = 1
  Else
    SetConst Heat = 0
  End
  If $Mouse = 1
    MousePos $WoodX, $WoodY
    Delay $S1Delay
  end
  LoadRGB $WoodX, $WoodY
  if {RGBBlue} > $RGBBlue
    SetConst Wood = 1
  Else
    SetConst Wood = 0
  End
  If $Mouse = 1
    MousePos $WaterX, $WaterY
    Delay $S1Delay
  End
  LoadRGB $WaterX, $WaterY
  if {RGBBlue} > $RGBBlue
    SetConst Water = 1
  Else
    SetConst Water = 0
  End
  If $Mouse = 1
    MousePos $DangerX, $DangerY
    Delay $S1Delay
  End
  LoadRGB $DangerX, $DangerY
  if {RGBBlue} > $RGBBlue
    SetConst Danger = 1
  Else
    SetConst Danger = 0
  End
  If $Mouse = 1
    MousePos $StatusX, $StatusY
  End
  LoadRGB $StatusX, $StatusY
  if {RGBGreen} > $RGBGreen
    SetConst Status = 1
  Else
    SetConst Status = 0
  End
End

Procedure Water
  SetConst NewX = $WaterBX
  SetConst NewY = $WoodBY
  Loop $Hearths
    IF {loopno} = $HRow1 //$Jump
      SetConst NewX = $WaterBX
      Compute NewY = $WoodBY + $Add3Y
    End
    If {loopno} > $Used
      If $Mouse = 0
        Set OrigX = {mousex}
        Set OrigY = {mousey}
      End
      MousePos $NewX, $NewY
      Delay $SDelay
      Rightclick
      Delay $SDelay
      If $Mouse = 0
        Mousepos $OrigX, $OrigY
      End
    End
    Compute NewX = $NewX + $AddX
  End
  SetConst NewX = $WaterBX
End

Procedure Snuff
  SetConst New2X = $WaterBX
  SetConst New2Y = $WoodBY
  Compute Num = $Used + 1
  Loop $Hearths
    IF {loopno} = $Hrow1 //$Jump
      SetConst New2X = $WaterBX
      Compute New2Y = $WoodBY + $Add3Y
    End
    If {loopno} = $Num
      If $Mouse = 0
        Set OrigX = {mousex}
        Set OrigY = {mousey}
      End
      MousePos $New2X, $New2Y
      Loop 8
        Rightclick
      End
      If $Mouse = 0
        Mousepos $OrigX, $OrigY
      End
    End
    Compute New2X = $New2X + $AddX
  End
End

Procedure Wood
  SetConst NewX = $WoodBX
  SetConst NewY = $WoodBY
  Loop $Hearths
    IF {loopno} = $HRow1 //$Jump
      SetConst NewX = $WoodBX
      Compute NewY = $WoodBY + $Add3Y
    End
    If {loopno} > $Used
      If $Mouse = 0
        Set OrigX = {mousex}
        Set OrigY = {mousey}
      End
      MousePos $NewX, $NewY
      Delay $SDelay
      Rightclick
      Delay $SDelay
      If $Mouse = 0
        MousePos $OrigX, $OrigY
      End
    End
    Compute NewX = $NewX + $AddX
  End
  SetConst NewX = $WoodBX
End

Procedure SetReg
  SetConst NewX = $RegX
  SetConst Count = 1
  Loop $Hearths
    If $Count = $HRow1
      SetConst NewX = $RegX
      Compute RegY = $RegY + $Add3Y
    End
    MousePos $NewX, $RegY
    Delay $MDelay
// TamBlack: turn off the regulator setup
//   Rightclick
    Compute NewX = $NewX + $Add2X
    If $Count > $HRow
      Compute NewY = $RegY + $Add2Y
    else
      Compute NewY = $RegY + $Add1Y
    end
    MousePos $NewX, $NewY
    Delay $MDelay
// TamBlack: turn off the regulator setup
//    Rightclick
    Delay $MDelay
    Compute NewX = $NewX + $AddX
    Compute Count = $Count + 1
  End
  SetConst NewX = $RegX
  SetConst Count = 1
End

Procedure Guild
  Compute BeginX = $BeginX - 7
  Compute BeginY = $BeginY + 16
  Compute RegY = $RegY + 16
  Compute RegX = $RegX - 14
  Compute AddX = $AddX - 15
  Compute Add3Y = $Add3Y + 16
  Compute Add1Y = $Add1Y - 16
  Compute WoodBY = $WoodBY + 16
  Compute HeatX = $HeatX - 4
  Compute HeatY = $HeatY + 16
  Compute WoodX = $WoodX - 1
  Compute WoodY = $WoodY + 16
  Compute WaterY = $WaterY + 16
  Compute DangerX = $DangerX - 4
  Compute DangerY = $DangerY + 16
  Compute StatusX = $StatusX - 5
  Compute StatusY = $StatusY + 16
  Set SetAddX = 212
  Set SetAddY = 266
End

Procedure HearthTest
  Loop 1
    MousePos $HeatX, $HeatY
    Delay 2000
    
    MousePos $WoodX, $WoodY
    Delay 2000
    
    MousePos $WaterX, $WaterY
    Delay 2000
    
    MousePos $DangerX, $DangerY
    Delay 2000
    
    MousePos $StatusX, $StatusY
    Delay 2000
    
    MousePos $WoodBX, $WoodBY
    Delay 2000
    
    MousePos $WaterBX, $WoodBY
    Delay 2000

MousePos 104, 251
    MousePos $BeginX, $BeginY
    Delay 2000
  end
  Stop
End
//Written with ACTool 5.3.0 by Anka
Bell Asterisk


Plant flax and harvest seeds

//This Macro will plant several rows of flax in order to harvest seeds from them
//
//You will need to use double F8 view. Zoom all the way in, then 7 mousewheel clicks out
//(your avatar will be a little smaller than the size of the thumb in the Gather Grass icon
//For this to work you need to **minimize chat***
//Open the Plant menu and pin it to the top or bottom of the screen
//When the macro starts, you will need to quickly mouse-over the Plant Flax Seed instruction
//As the macro runs, your avatar should stay in the middle of the flax beds, but he will stray
//It is up to you to move him back to the middle (or close) when this happens
//It is my belief this is caused by server lag and therefore cannot be avoided
//I use screen resolution 1280x1024 on a wide-screen monitor

//MousePos 638,508 //My Head
delay 3000
Constructs
  MouseX=List // this is an array of mouse X coords 
  MouseY=List // this is an array of mouse Y coords 
END

Constants
  RowLen=7 //actually does n+1 -- Recommend 7 or fewer if Seedcycles is 3
  ColLen=2 //actually does n*2 -- Recommend 2 or fewer if Seedcycles is 3
  ActualCols=0	//program sets this
  ActualRows=0  //not used
  XHomeDist=0 //Not necessary because it plants even numbers of rows
  YHomeDist=0 //sets later
  SeedCycles=3 //harvest how many times (n+1) -- for best results use 3 or less
  InitialDelay=50000 //Time until the flax goes to seed and can be harvested
  NextDelay=0 //Program sets this - the time between subsequent harvest cycles
  LoopVal = 1 //do not modify
  
END

Compute ActualCols = $ColLen * 2
Compute YHomeDist = (($ActualCols-1) * 375)
Compute InitialDelay = $InitialDelay - (475 * ($RowLen + 1) * ($ColLen * 2)) + 475
Compute NextDelay = 66000 - ($ColLen * 2) * ($RowLen + 1) * 1950
Compute NextDelay = MAX ($NextDelay, 0)
//Acquire Location of Plant:Flax Seed
Listadd MouseX, {MouseX}
Listadd MouseY, {MouseY}

Call Plant $RowLen, $ColLen
Delay $InitialDelay

loop $SeedCycles
  Call HarvestAllSeeds $RowLen, $ColLen, 0 //This cycle harvests only
  Delay $NextDelay
end

//This cycle harvests then rips out the flax bed.
//If you like picking a lot of seeds up off the ground, remove the next line.
Call HarvestAllSeeds $RowLen, $ColLen, 1


Procedure Plant using Across, Down
//This procedure creates a grid of Flax of size (Across +1) x (Down * 2)
//It utilizes global variable MouseX and MouseY holding the location of the plant Flax pin
//It also uses global variable $YHomeDist and $InitialDelay to return to the starting point
	Compute LoopVal = 1
  loop $Down //this one controls how many columns (N+1)(B)
		mousepos {MouseX[1],MouseY[1] 
		LeftClick
		loop $RowLen //this one controls how many in a line (n) (A)
   		KeyDown {RIGHT} 375
   		Delay 100
    	mousepos {MouseX[1],MouseY[1] 
    	LeftClick
  	end

  	KeyDown {DOWN} 375
  	Delay 100
  	mousepos {MouseX[1],MouseY[1] 
  	LeftClick

  //this one controls how many in a line (n+1)
	  loop $Across //this one controls how many in a line (n+1) (A)
  		Keydown {LEFT} 375
  		Delay 100
   		mousepos {MouseX[1],MouseY[1] 
  		LeftClick	
 		end

		if $LoopVal < $Down
	  	KeyDown {DOWN} 375
	 	end
  	Delay 100
  	Compute LoopVal = $LoopVal + 1
	End 
	
	KeyDown {UP} $YHomeDist

END //Planting

Procedure HarvestAllSeeds using Across, Down, Yank
//This procedure harvesta seeds from a grid of Flax of size (Across +1) x (Down * 2)
//If Yank = 1 it will also rip out the plant
		Compute LoopVal = 1
		loop $Down //this one controls how many columns (N+1)(B)
		Call HarvestOneSeed
		if $Yank = 1
	  	Call Ripout
		end

  	loop $Across //this one controls how many in a line (n) (A)
   		KeyDown {RIGHT} 375
    	Delay 100
 			Call HarvestOneSeed
			if $Yank = 1
	  		Call Ripout
			end
		end

  	KeyDown {DOWN} 375
  	Delay 100
		Call HarvestOneSeed
		if $Yank = 1
	  	Call Ripout
		end

	
   //this one controls how many in a line (n+1)
  	loop $Across //this one controls how many in a line (n+1) (A)
  		Keydown {LEFT} 375
  		Delay 100
			Call HarvestOneSeed
			if $Yank = 1
	  		Call Ripout
			end
	 	end

		if $LoopVal < $Down
	  	KeyDown {DOWN} 375
	  end
	  Compute $LoopVal = $LoopVal + 1
  	Delay 100
	end
	KeyDown {UP} $YHomeDist
end


Procedure HarvestOneSeed 
//Clicks on flax bed your are standing in, and selects harvest
//I repeat the mousepos because I find it reduces server/client transmission miscues
//which would cause the pop up menu to stray from where it should be
  mousepos 654, 504 
	Delay 30
  mousepos 654, 504 
	LeftClick
	Delay 60
	mousepos 690, 499
	Delay 60
	mousepos 690, 499
	LeftClick
	Delay 1800
end



Procedure RipOut
//Clicks on flax bed your are standing in, and selects Utility->Rip Out
//Because picking up flax seeds off the ground is annoying.
//I repeat the mousepos because I find it reduces server/client transmission miscues
//which would cause the pop up menu to stray from where it should be  MousePos 654, 504
	Delay 30
  MousePos 654, 504
	LeftClick
	Delay 70
  MousePos 724, 527
  Delay 30
  MousePos 724, 527
	LeftClick
  Delay 70
	MousePos 746, 509
	Delay 30
	MousePos 746, 509
	LeftClick
	Delay 70
end

Plant, weed and harvest 20 beds


//This Macro will plant 20 beds of flax, weed/water and harvest them
//
//You will need to use double F8 view. Zoom all the way in, then 7 mousewheel clicks out
//(your avatar will be a little smaller than the size of the thumb in the Gather Grass icon
//For this to work you need to **minimize chat***
//Open the Plant menu and pin it to the top left corner
//I use screen resolution 1280x1024 on a wide-screen monitor

delay 1000

Constants
  PlantX=40
  PlantY=40

  SelfX=636 //Position of your feet
  SelfY=515 //Position of your feet

  BedLen=90 //Width of a flax bed

  RowLen=4 //actually does n+1 flax beds horizontally
  ColLen=2 //actually does n*2 flax beds vertically

  SeedCycles=3 //weed, water and harvest how many times

  InitialDelay=25500 //Time until the flax goes to first weed status
  NextDelay=7000 //Time between subsequent weed, water, harvest cycles

  DelayShort=50	//Delay between pointing and clicking
  DelayWalk=400 //Delay for walking to the next position
  DelayWeed=400 //Delay for weeding the next flax bed
  DelayTest=1000 //Not used, test setting

  i=0
	BedX=0
	BedY=0
  ActualCols=0
  ActualRows=0  //not used
  XHomeDist=0 //Not necessary because it plants even numbers of rows
  YHomeDist=0
  MenuX=0
  MenuY=0

  LoopVal = 1 //do not modify
END

Compute ActualCols = $ColLen * 2
Compute XHomeDist = $SelfX - $BedLen + 10
Compute YHomeDist = $SelfY - (($ActualCols-1) * $BedLen)

Call Plant $RowLen, $ColLen
Delay $InitialDelay

loop $SeedCycles
  Call HarvestAllSeeds $RowLen, $ColLen
  Delay $NextDelay
end

Procedure Plant using Across, Down
//This procedure creates a grid of Flax of size (Across +1) x (Down * 2)
//It utilizes global variable MouseX and MouseY holding the location of the plant Flax pin
//It also uses global variable $YHomeDist and $InitialDelay to return to the starting point
	Compute LoopVal = 1
  loop $Down //this one controls how many columns (N+1)(B)
		mousepos $PlantX, $PlantY 
		delay $DelayShort
		LeftClick
		loop $RowLen //this one controls how many in a line (n) (A)
//   		KeyDown {RIGHT} 375
			compute BedX = $SelfX + $BedLen
			mousepos $BedX, $SelfY
			delay $DelayShort
			LeftClick
   		Delay $DelayWalk
    	mousepos $PlantX, $PlantY 
			delay $DelayShort
    	LeftClick
  	end

//  	KeyDown {DOWN} 375
		compute BedY = $SelfY + $BedLen
		mousepos $SelfX, $BedY
		delay $DelayShort
		LeftClick
  	Delay $DelayWalk
  	mousepos $PlantX, $PlantY 
		delay $DelayShort
  	LeftClick

  //this one controls how many in a line (n+1)
	  loop $Across //this one controls how many in a line (n+1) (A)
//  		Keydown {LEFT} 375
			compute BedX = $SelfX - $BedLen
			mousepos $BedX, $SelfY
			delay $DelayShort
			LeftClick
  		Delay $DelayWalk
   		mousepos $PlantX, $PlantY 
			delay $DelayShort
  		LeftClick	
 		end

		if $LoopVal < $Down
//	  	KeyDown {DOWN} 375
			compute BedY = $SelfY + $BedLen
			mousepos $SelfX, $BedY
			delay $DelayShort
			LeftClick
			Delay $DelayWalk
	 	end
  	Compute LoopVal = $LoopVal + 1
	End 
	
//	KeyDown {UP} $YHomeDist
	mousepos $XHomeDist, $YHomeDist
	delay $DelayShort
	LeftClick
	Delay $DelayWalk
END //Planting

Procedure HarvestAllSeeds using Across, Down
//This procedure harvesta seeds from a grid of Flax of size (Across +1) x (Down * 2)
		Compute LoopVal = 1
		loop $Down //this one controls how many columns (N+1)(B)
		compute i = 1
		compute BedX = $SelfX + ($BedLen * $i)
		mousepos $BedX, $SelfY
//		Call HarvestOneSeed $BedX, $SelfY
		Delay $DelayShort
		LeftClick
		compute MenuX = $BedX + 20
		compute MenuY = $SelfY - 9
		mousepos $MenuX, $MenuY
		Delay $DelayShort
		LeftClick
		Delay $DelayWeed

  	loop $Across //this one controls how many in a line (n) (A)
//   		KeyDown {RIGHT} 375
			compute i = $i + 1
			compute BedX = $SelfX + ($BedLen * $i)
			mousepos $BedX, $SelfY
// 			Call HarvestOneSeed $BedX, $SelfY
			Delay $DelayShort
			LeftClick
			compute MenuX = $BedX + 20
			compute MenuY = $SelfY - 9
			mousepos $MenuX, $MenuY
			Delay $DelayShort
			LeftClick
			Delay $DelayWeed
		end

//  	KeyDown {DOWN} 375
		compute BedY = $SelfY + $BedLen
 		mousepos $SelfX, $BedY
		delay $DelayShort
		LeftClick
		Delay $DelayWalk

		compute i = $RowLen + 1
		compute BedX = $SelfX + ($BedLen * $i)
		mousepos $BedX, $SelfY	
//		Call HarvestOneSeed $BedX, $SelfY
		Delay $DelayShort
		LeftClick
		compute MenuX = $BedX + 20
		compute MenuY = $SelfY - 9
		mousepos $MenuX, $MenuY
		Delay $DelayShort
		LeftClick
		Delay $DelayWeed
	
   //this one controls how many in a line (n+1)
  	loop $Across //this one controls how many in a line (n+1) (A)
//  		Keydown {LEFT} 375
			compute i = $i - 1
			compute BedX = $SelfX + ($BedLen * $i)
			mousepos $BedX, $SelfY
//			Call HarvestOneSeed $BedX, $SelfY
			Delay $DelayShort
			LeftClick
			compute MenuX = $BedX + 20
			compute MenuY = $SelfY - 9
			mousepos $MenuX, $MenuY
			Delay $DelayShort
			LeftClick
			Delay $DelayWeed
	 	end

		if $LoopVal < $Down
//	  	KeyDown {DOWN} 375
			compute BedY = $SelfY + $BedLen
			mousepos $SelfX, $BedY
			delay $DelayShort
			LeftClick
			Delay $DelayWalk
	  end
	  Compute $LoopVal = $LoopVal + 1
	end
	
//	KeyDown {UP} $YHomeDist
	mousepos $SelfX, $YHomeDist
	delay $DelayShort
	LeftClick
	Delay $DelayWalk
end


Wood pane TO BE TESTED

// Pin Windows in 2 rows of 3,
// in top left corner of window
// works best at 1024 x 768 res
// Set line 16, for Number of loops
// usually total wood / 6
Procedure Delay300
  LeftClick
  delay 300
End

Procedure Delay600
  LeftClick
  delay 600
End

Loop 25
MousePos 120, 80
CALL Delay300
MousePos 120, 80
CALL Delay600

MousePos 400, 80
call Delay300
MousePos 400, 80
call Delay600

MousePos 690, 80
call Delay300
MousePos 690, 80
call Delay600

MousePos 120, 190
call Delay300
MousePos 120, 190
call Delay600

MousePos 400, 190
call Delay300
MousePos 400, 190
call Delay600

MousePos 690, 190
call Delay300
MousePos 690, 190
call Delay600

End

Coconut cracker TO BE TESTED

// Pin Crack Coconut Window to bottom left of screen, works best at 1024x768
// Set line 14 for number of loops desired :P
Delay 2500
MousePos 144, 701
LeftClick
MousePos 144, 701
LeftClick
MousePos 144, 701
LeftClick
MousePos 144, 701
LeftClick
MousePos 144, 701
LeftClick
Loop 100
MousePos 144, 701
LeftClick
Delay 10000
End