AutoHotKey tutorial

11/04/2010 23:52 kanarie13#106
nice +K
11/26/2010 13:41 denominator#107
So I have been looking at this code for mining that was posted and have changed some of the things that were highlighted and wondering if this is about correct now?

It seems that it just left clicks the floor without dropping ores? How to set it up?

Code:
;creación del GUI---Creates Gui

Gui, Show , w220 h160, Aurum
Gui, Add, Text, x10 y10 w150 Left,Welcome to AURUM
Gui, Add, Button, x80 y40 w60 h20 vSTARTBUTTON gMINE ,start
Gui, Add, Checkbox, x10 y80 vDROPGOLDORE,drop gold ores
Gui, Add, Checkbox, x10 y100 vDROPSILVERORE,drop silver ores
Gui, Add, Checkbox, x100 y80 vDROPCOPPERORE,drop copper ores
Gui, Add, Checkbox, x100 y100 vDROPIRONORE,drop iron ores
Gui, Add, Text, x10 y120 w200 Left,press ctrl+alt+c to set initial coords
Gui, Add, Text, x10 y140 w200 Left,press ctrl+alt+s to exit the program

return
;-----------------------------------------------------------------------
^!S::
{
MsgBox,Thanks for using aurum c u next time
sleep, 100
ExitApp
}
;-----------------------------------------------------------------------
;Código para buscar ores---Ore searcher code

^!C::
{
;Posicion inicial de la ventana---Initial Window position
MouseGetPos,IPosX, IPosY
MsgBox,Initial coords: %IPosY% %IPosX%
return
}

MINE:
{

MsgBox,The bot will begin in 3 seconds
Sleep,3000

InitialcoordX:=IposX
Initialcoordy:=IposY


;Copper Ore
MINING:
FposX:=IPosX+43
FPosY:=IPosY+43
{
loop,40
{
Pixelsearch, CopperX, CopperY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,0xDEEFF,10
if ErrorLevel
{
;Iron Ore
Pixelsearch, IronX, IronY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,0x525152,10
If ErrorLevel
{
;Silver Ore
Pixelsearch, SilverX, SilverY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,0x5C5B5D,10
If ErrorLevel
{
;gold Ore
Pixelsearch, GoldX, GoldY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,0x07365C,10
If ErrorLevel
{
;scroll
Pixelsearch, ScrollX, ScrollY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,0x31458C,10
If ErrorLevel<>1
{
;Move to next box in item box
Gosub, Next
}
else
{

Click left, %scrollX% %scrollY%
Sleep, 1000
Click left, 515,482
Gosub, Next

}
}
else
{
Gosub, Dropgoldore
Gosub, Next
}
}
else
{
Gosub, Dropsilverore
Gosub, Next
}
}
else
{
Gosub, Dropironore
Gosub, Next
}
}
else
{
Gosub, Dropcopperore
Gosub, Next
}
}
return
}
;Sleep,10000
Gosub, MINING


}
;-----------------------------------------------------------------------
;FUNCTIONS
OresTirados:=1
Next:
{
IPosX:=IposX+43
If IposX>=(172+InitialcoordX)
{
IPosX:=InitialcoordX
IPosY:=IPosY+43
}
If IposY>=(1849+InitialcoordY)
{
IPosX:=InitialcoordX
IPosY:=InitialcoordY
}
FPosX:=FposX+43
If FposX>=(172+43+InitialcoordX)
{
FPosX:=InitialcoordX+43
FPosY:=FPosY+43
}
If FposY>=(1849+43+InitialcoordY)
{
FPosX:=InitialcoordX+43
FPosY:=InitialcoordY+43
}

return
}

Drop:
{
mouseclickx:=(IPosX+21)
mouseclicky:=(IPosY+21)
click left,%mouseclickx%,%mouseclicky%
Sleep,1000
Click left, 515,482
OresTirados:=OresTirados+1
If OresTirados>=9
{
click left, 515,482
Sleep,1000
Click right, 515,482
OresTirados:=0
}
return
}
Dropgoldore:
{
If DROPGOLDORE Checked
{
Gosub, Drop
}
else
{
Gosub, Next
}
return

}
Dropsilverore:
{
If DROPSILVERORE Checked
{
Gosub, Drop
}
else
{
Gosub, Next
}
return

}
Dropironore:
{
If DROPIRONORE Checked
{
Gosub, Drop
}
else
{
Gosub, Next
}
return
}
Dropcopperore:
{
If DROPCOPPERORE Checked
{
Gosub, Drop
}
else
{
Gosub, Next
}
return
}


return

GuiClose:
ExitApp
01/07/2011 18:03 Setland#108
I need a bind that holds down CTRL and presses X. Thanks in advance.
09/05/2011 14:43 madalingtandaan#109
send, {CTRLDOWN}{x}{CTRLUP}
11/20/2011 15:53 CoRRuPTioN^#110
@Coolcountry

well you made a little bit mistakes, i'll put them in red colour :)

Quote:
Gui,Show,h150 w250, Learning

Gui, Add, Button, x20 y110 w50 h20 gDOUBLE,Answer
Gui, Add, Text, x10 y50 w90 Center,Random + 2 x
Gui, Add, Edit, w60 h20 x130 y50 vNUMBER Center,

return



DOUBLE:
{
Random,A_number,10,2000
Gui,Submit,NoHide
; if you noticed i removed the (2*number) thingy in here so it works
DOUBLE = %A_number%
Msgbox,,Result, The Result is %DOUBLE%
return
}

GuiClose:
ExitApp
09/21/2012 16:01 rogamer13#111
Where can i download AHK now since its main site is down? Can someone share theirs? i wanna learn how to use this program thanks.