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:Nisu Bastet/macro/quarry

From A Tale in the Desert
Jump to navigationJump to search

AHK Macro

Quarry macro from T3
need to adjust end timer
...



^+m:: ;Strg Shift m   marmor marble
;Position of this quarry worker: 3 through 4
myPosition := 3 ; change this for your position in alpha order
;The y coordinate of each dash (coords relative to window)
y1 := 104 ;gildenquarry +16
y2 := 120 
y3 := 136 
y4 := 152 

Loop, 
{
  IfWinActive, eGenesis Client
  {
 PixelGetColor, endu01, 18, 937 ; endu red
      Sleep, 400
    if ( endu01 != 0x0000FF and GetKeyState("LButton") = 0 )
    {
      BlockInput, MouseMove      
      ;An empty part of the quarry window where it will click to refresh the window
      MouseClick, right, 70, 57, 1, 0
      BlockInput, MouseMoveOff
      Sleep, 400


      yCount := 0
      Loop, 4
      {
        yCount += 1
  
        ;163 is the x coordinate of the beginning of the -- dash after 'Eastern'
        count := 164
        Loop, 14
        {
          PixelGetColor, color%count%, count, y%yCount%
          count += 1
        }

        ;same as above
        count := 164
        match := 0
        Loop, 14
        {
          if ( match = 4 and color%count% != 0 )
          {
            lastPixel := count - 1
          }
          if ( color%count% = 0 )
          {
            match += 1
          }
          else
          {
            match := 0
          }
          count += 1
        }
    
        position%yCount% := 0
    
        ; Here the numbers 166, 171, 173, and 175 are the x coords of the *last* pixel of each dash...
        ; 166 is the dash after Eastern, 171 after Western, 173 after Northern, 175 after Southern 
; mel: x+4-3 y+34
        
        if ( lastPixel = 167 ) ;east
        {
          position%yCount% := 0
        }
        if ( lastPixel = 174 ) ;north
        {
          position%yCount% := 4
        }
        if ( lastPixel = 176 ) ;south
        {
          position%yCount% := 8
        }
        if ( lastPixel = 172 ) ;west
        {
          position%yCount% := 12
        }
        PixelGetColor, color1, lastPixel+3, y%yCount%-4
        PixelGetColor, color2, lastPixel+3, y%yCount%+4
        PixelGetColor, color3, lastPixel+3, y%yCount%+1
        PixelGetColor, color4, lastPixel+2, y%yCount%+3

        if ( color1 = 0 and color2 = 0 )
        {
          position%yCount% += 1
        }
        if ( color1 != 0 and color2 = 0 )
        {
          position%yCount% += 2
        }
        if ( color3 = 0 )
        {
          position%yCount% += 3
        }
        if ( color4 != 0 )
        {
          position%yCount% += 4
        }

      }

    
      count := 16
      place := 5
      Loop, 16
      {
        if ( position1 = count )
        {
          place -= 1
          if ( place = myPosition )
          {
            clickPosition := 1
            break
          }
        }
        if ( position2 = count )
        {
          place -= 1
          if ( place = myPosition )
          {
            clickPosition := 2
            break
          }
        }
        if ( position3 = count )
        {
          place -= 1
          if ( place = myPosition )
          {
            clickPosition := 3
            break
          }
        }
        if ( position4 = count )
        {
          place -= 1
          if ( place = myPosition )
          {
            clickPosition := 4
            break
          }
        }
        count -= 1
      }
      
      if ( lastPosition1 != position1 or lastPosition2 != position2 or lastPosition3 != position3 or lastPosition4 != position4 )
      {
       MouseClick, right, 34, y%clickPosition%, 1, 0 ;clicks quarry
      }
      lastPosition1 := position1
      lastPosition2 := position2
      lastPosition3 := position3
      lastPosition4 := position4
    }
  }
  Sleep, 1000
}
return