Nach langer zeit beschäftige ich mich mal wieder mit Autoit.
Und zwar habe ich folgende Frage/Problem.
Ich arbeite derzeit mit imagesearch an einem Bot für stronghold Kindoms
(Farmbot)
Das funktioniert auch soweit aber eben nur mit Obst.
Jetzt habe ich mir eine kleine gui geschrieben und wollte dies nun so regeln.
Das ich aussuchen kann was ich Farmen möchte.
Sprich ist Checkbox 1 Obst ausgewählt und ich drücke start farmt er Apfel.
Ist Checkbox 2 ausgewählt Holz etc...
Nun weiß ich aber nich wie ich das ganze so richtig realisieren soll.
Sprich ich benötige ein Denkanstoß.
Code:
#include <ImageSearch.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 625, 443, 204, 174) $Group1 = GUICtrlCreateGroup("FarmBot", 16, 8, 289, 425) $Pic1 = GUICtrlCreatePic("C:\ImageSearch.au3 + SourceCode\apple.jpg", 32, 32, 41, 41, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Checkbox1 = GUICtrlCreateCheckbox("Apfel Bot", 88, 40, 65, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("TradeBot", 312, 8, 297, 361) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Pause Bot", 480, 384, 129, 41, $WS_GROUP) $Button2 = GUICtrlCreateButton("Start Bot", 312, 384, 129, 41, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd $x = 0 $y = 0 $xd = @DesktopHeight $yd = @DesktopWidth ;MsgBox(0,"", $xd & "@" & $yd) HotKeySet("{ESC}", "Close") HotKeySet("{F1}", "Start") HotKeySet("{F2}", "Pause") _Startup() Func _Startup() ToolTip("Startup",0,0) While 1 Sleep(100) WEnd EndFunc Func Close() Exit EndFunc Func Pause() ToolTip("Pause",0,0) While 1 Sleep(100) WEnd EndFunc Func Start() ToolTip("",0,0) While 1 $pos = MouseGetPos() $IS = _ImageSearch("Start.png",1,$x,$y,50) If $IS = 1 Then MouseClick("left",$x,$y,5,20) MouseMove($pos [0], $pos [1], 20) Adlibregister ("Start", 300000) IMR() EndIf WEnd EndFunc Func IMR() While 1 $pos = MouseGetPos() $IMR = _ImageSearch("IMR.png",1,$x,$y,50) If $IMR = 1 Then MouseClick("left",$x,$y,5,20) MouseMove($pos [0], $pos [1], 20) Else Sleep(100) BOX() EndIf WEnd EndFunc Func BOX() While 1 $pos = MouseGetPos() $BOX = _ImageSearch("BB.png",1,$x,$y,50) If $BOX = 1 Then MouseClick("left",$x,$y,5,20) MouseMove($pos [0], $pos [1], 20) Else Sleep(100) EndIf WEnd EndFunc