elitepvpers

elitepvpers (https://www.elitepvpers.com/forum/)
-   AutoIt (https://www.elitepvpers.com/forum/autoit/)
-   -   hp/mp taker (https://www.elitepvpers.com/forum/autoit/4620126-hp-mp-taker.html)

checker0899 05/14/2019 17:21

hp/mp taker
 
Ich bin in Sachen Autoit etwas eingerostet..ok..aber wieso funktioniert das nicht oder komm ich einfach nur nicht drauf ?
Vielleicht habt ihr ne andere Methode das umzusetzten..
der Sinn sollte klar sein; nach den HP/MP bars suchen, ggf. item wechseln und dann nutzen.
Code:

#comments-start

        Author : Pad
        Version : 1.0
        Kommentare :        HP/MP taker

#comments-end

AutoItSetOption("SendKeyDownDelay", 100)
HotKeySet("{NUMPAD5}", "_an_aus")
HotKeySet("{NUMPAD1}", "_register_bars")
HotKeySet("{NUMPAD2}", "_register_item")
HotKeySet("{NUMPAD9}", "_exit")
Global $an_aus = 0
Global $hp_color = 0x622929
Global $hp_item_color = 0xF7F2A5
Global $mp_color = 0x1C1C44
Global $mp_item_color = 0xD4F9FC

While 1
        Sleep(200)
WEnd

Func _an_aus()
        If $an_aus = 0 Then
                AdlibRegister("_main", 250)
                $an_aus = 1
        Else
                AdlibUnRegister("_main")
                $an_aus = 0
        EndIf
EndFunc

Func _register_bars()
        Global $wdw = WinActive("[CLASS:FDPclass]")
        Global $mouse = MouseGetPos()
EndFunc

Func _register_item()
        Global $mouse2 = MouseGetPos()
EndFunc

Func _main()
        #Region        *** check HP_bar ***
        PixelSearch($mouse[0]-50, $mouse[1]-50, $mouse[0]+50, $mouse[1]+50, $hp_color)
        If @error Then
;                                        check item
                PixelSearch($mouse2[0]-50, $mouse2[1]-50, $mouse2[0]+50, $mouse2[1]+50, $hp_item_color)
                If @error Then
;                                                change item
                        ControlSend("DARK SOULS III", "", $wdw, "{DOWN}")
                        Sleep(500)
;                                                check item
                        PixelSearch($mouse2[0]-50, $mouse2[1]-50, $mouse2[0]+50, $mouse2[1]+50, $hp_item_color)
                        If not @error Then
;                                                        take potion
                                ControlSend("DARK SOULS III", "", $wdw, "r")
                        EndIf
                Else
;                                                take potion
                        ControlSend("DARK SOULS III", "", $wdw, "r")
                EndIf
        EndIf
        #EndRegion        *** check HP_bar ***
        Sleep(200)
        #Region                *** check MP_bar ***
        PixelSearch($mouse[0]-0, $mouse[1]-0, $mouse[0]+50, $mouse[1]+3, $mp_color)
        If @error Then
;                                        check item
                PixelSearch($mouse2[0]-50, $mouse2[1]-50, $mouse2[0]+50, $mouse2[1]+50, $mp_item_color)
                If @error Then
;                                                change item
                        ControlSend("DARK SOULS III", "", $wdw, "{DOWN}")
                        Sleep(500)
;                                                check item
                        PixelSearch($mouse2[0]-50, $mouse2[1]-50, $mouse2[0]+50, $mouse2[1]+50, $mp_item_color)
                        If not @error Then
;                                                        take potion
                                ControlSend("DARK SOULS III", "", $wdw, "r")
                        EndIf
                Else
;                                                take potion
                        ControlSend("DARK SOULS III", "", $wdw, "r")
                EndIf
        EndIf
        #EndRegion        *** check MP_bar ***
EndFunc

Func _exit()
        Exit
EndFunc

nur [c]Send[/c] geht auch nicht
Spoiler:
Code:

#comments-start

        Author : Pad
        Version : 1.0
        Kommentare :        HP/MP taker

#comments-end

AutoItSetOption("SendKeyDownDelay", 100)
HotKeySet("{NUMPAD5}", "_an_aus")
HotKeySet("{NUMPAD1}", "_register_bars")
HotKeySet("{NUMPAD2}", "_register_item")
HotKeySet("{NUMPAD9}", "_exit")
Global $an_aus = 0
Global $hp_color = 0x622929
Global $hp_item_color = 0xF7F2A5
Global $mp_color = 0x1C1C44
Global $mp_item_color = 0xD4F9FC

While 1
        Sleep(200)
WEnd

Func _an_aus()
        If $an_aus = 0 Then
                AdlibRegister("_main", 250)
                $an_aus = 1
        Else
                AdlibUnRegister("_main")
                $an_aus = 0
        EndIf
EndFunc

Func _register_bars()
        Global $wdw = WinActive("[CLASS:FDPclass]")
        Global $bars = MouseGetPos()
EndFunc

Func _register_item()
        Global $item = MouseGetPos()
EndFunc

Func _main()
        #Region        *** check HP_bar ***
        PixelSearch($bars[0]-50, $bars[1]-50, $bars[0]+50, $bars[1]+50, $hp_color)
        If @error Then
;                                        check item
                PixelSearch($item[0]-50, $item[1]-50, $item[0]+50, $item[1]+50, $hp_item_color)
                If @error Then
;                                                change item
                        Send("{DOWN}")
                        Sleep(500)
;                                                check item
                        PixelSearch($item[0]-50, $item[1]-50, $item[0]+50, $item[1]+50, $hp_item_color)
                        If not @error Then
;                                                        take potion
                                Send("r")
                        EndIf
                Else
;                                                take potion
                        Send("r")
                EndIf
        EndIf
        #EndRegion        *** check HP_bar ***
        Sleep(200)
        #Region                *** check MP_bar ***
        PixelSearch($bars[0]-0, $bars[1]-0, $bars[0]+50, $bars[1]+3, $mp_color)
        If @error Then
;                                        check item
                PixelSearch($item[0]-50, $item[1]-50, $item[0]+50, $item[1]+50, $mp_item_color)
                If @error Then
;                                                change item
                        Send("{DOWN}")
                        Sleep(500)
;                                                check item
                        PixelSearch($item[0]-50, $item[1]-50, $item[0]+50, $item[1]+50, $mp_item_color)
                        If not @error Then
;                                                        take potion
                                Send("r")
                        EndIf
                Else
;                                                take potion
                        Send("r")
                EndIf
        EndIf
        #EndRegion        *** check MP_bar ***
EndFunc

Func _exit()
        Exit
EndFunc


Edit: komm ich so vielleicht weiter oder lauf ich da auch ins leere ?
Spoiler:
Code:

#comments-start

        Author : Pad
        Version : 1.0
        Kommentare :        HP/MP taker

#comments-end
AutoItSetOption("SendKeyDownDelay", 100)
HotKeySet("{NUMPAD5}", "_an_aus")
HotKeySet("{NUMPAD1}", "_register_hp_bar")
HotKeySet("{NUMPAD2}", "_register_mp_bar")
HotKeySet("{NUMPAD3}", "_register_item")
HotKeySet("{NUMPAD0}", "_register_game")
HotKeySet("{NUMPAD9}", "_exit")
Global $an_aus = 0
Global $hp_color = 0x622929
Global $hp_item_color = 0xF7F2A5
Global $mp_color = 0x1C1C44
Global $mp_item_color = 0xD4F9FC

While 1
        Sleep(200)
WEnd

Func _an_aus()
        If $an_aus = 0 Then
                AdlibRegister("_main", 250)
                $an_aus = 1
        Else
                AdlibUnRegister("_main")
                $an_aus = 0
        EndIf
EndFunc

Func _register_game()
        $game = WinActivate("[CLASS:FDPclass]")
EndFunc

Func _register_hp_bar()
        Global $hp_bar_xy = MouseGetPos()
EndFunc

Func _register_mp_bar()
        Global $mp_bar_xy = MouseGetPos()
EndFunc

Func _register_item()
        Global $item_xy = MouseGetPos()
EndFunc

Func _main()
        #Region        *** check HP_bar ***
        Local $hp_bar = PixelChecksum($hp_bar_xy[0]-2, $hp_bar_xy[1]-2, $hp_bar_xy[0]+2, $hp_bar_xy[1]+2)
        While $hp_bar = PixelChecksum($hp_bar_xy[0]-2, $hp_bar_xy[1]-2, $hp_bar_xy[0]+2, $hp_bar_xy[1]+2)
                Sleep(100)
        WEnd
;                                check item


elmarcia 05/16/2019 18:05

First you should check if you can send key strokes or mouse click events, if not then input may be blocked by antihack or sth.
Also check if you can perform a pixel search, with autoitwindow info if you search for a color check that isn't black, some antihack prevent pixel search too


All times are GMT +2. The time now is 13:27.

Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.