hp/mp taker

05/14/2019 17:21 checker0899#1
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

Edit: komm ich so vielleicht weiter oder lauf ich da auch ins leere ?
05/16/2019 18:05 elmarcia#2
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