Well i hate when im typing and the autopot sends keys it sends the key like 10Times how can i edit it so it only sends 1 ?
here is the source
im not so good in Autoit...
so could anyone help me ? to try to only send 1 key and not 10
here is the source
Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("TrayMenuMode", 1)
Dim $type[4] = ['HP', 'MP', 'Vigor', 'Pet' ]
Dim $dif = 70, $y = 40, $run = 0, $pot_pill = 0, $e = 0, $s = 0, $z = 0
Const $epointer = 0xA9EE64, $eCharname = 0xA9DBB8, $spointer = 0xA9EE44, $sCharname = 0xA9DB98, $zpointer = 0xAA0E44, $zCharname = 0xA9FB98, $pill = 0x228, $curhp = 0x3BC, $maxhp = 0x3B4, $curmp = 0x3B0, $maxmp = 0x3B8
Const $h1 = 0x1718, $h2 = 0x8, $h3 = 0x4, $h4 = 0x10, $hcur = 0x8, $hmax = 0xC, $lvl = 0x12
Const $wolf_hp[140] = [360, 441, 524, 611, 701, 795, 892, 992, 1097, 1205, 1317, 1432, 1552, 1677, 1805, 1938, 2076, 2218, 2365, 2517, 2675, 2837, 3005, 3179, 3358, 3544, 3735, 3933, 4137, 4347, 4565, 4789, 5020, 5259, 5506, 5760, 6022, 6292, 6571, 6858, 7154, 7459, 7774, 8098, 8432, 8776, 9131, 9496, 9872, 10260, 10659, 11070, 11493, 11928, 12376, 12838, 13313, 13802, 14305, 14823, 15355, 15903, 16467, 17047, 17644, 18258, 18889, 19538, 20205, 20892, 21598, 22323, 23069, 23836, 24625, 25435, 26268, 27124, 28004, 28908, 29838, 30792, 31774, 32782, 33817, 34881, 35974, 37097, 38250, 39434, 40651, 41901, 43184, 44501, 45855, 47244, 48671, 50136, 51640, 53184, 54770, 56397, 58068, 59782, 61543, 63350, 65204, 67107, 69060, 71065, 73122, 75233, 77399, 79622, 81903, 84243, 86644, 89107, 91634, 94227, 96886, 99615, 102413, 105284, 108229, 111249, 114347, 117524, 120783, 124125, 127552, 131067, 134672, 138368, 142158, 146044, 150029, 154115, 158304, 162599]
$GUI = GUICreate('AutoPot', 335, 370)
GUICtrlCreateLabel('Charname:', 10, 13)
$char_input = GUICtrlCreateInput('', 70, 10, 150)
$start_button = GUICtrlCreateButton('Start Autopot', 235, 9, 85, 23)
For $i = 0 To 3
GUICtrlCreateGroup($type[$i], 5, $y + $i * $dif, 325, 70)
Assign($type[$i] & '_check', GUICtrlCreateCheckbox('Use ' & $type[$i] & ' Pots', 10, $y + 15 + $i * $dif))
GUICtrlCreateLabel('Belt:', 103, $y + 19 + $i * $dif)
Assign($type[$i] & '_belt', GUICtrlCreateCombo('', 128, $y + 15 + $i * $dif, 40, -1, 3))
GUICtrlSetData(-1, 'none|F1|F2|F3|F4', 'F1')
GUICtrlCreateLabel('Slot:', 180, $y + 19 + $i * $dif)
Assign($type[$i] & '_slot', GUICtrlCreateCombo('', 205, $y + 15 + $i * $dif, 35, -1, 3))
GUICtrlSetData(-1, '0|1|2|3|4|5|6|7|8|9', 1)
GUICtrlCreateLabel('Delay:', 255, $y + 19 + $i * $dif)
Assign($type[$i] & '_delay', GUICtrlCreateInput('1000', 290, $y + 15 + $i * $dif, 35, -1, 3))
Assign($type[$i] & '_slider', GUICtrlCreateSlider(5, $y + 40 + $i * $dif, 295))
Assign($type[$i] & '_input', GUICtrlCreateInput(0, 300, $y + 40 + $i * $dif, 25, -1, 1))
Next
GUICtrlCreateGroup('Universal Pills', 5, 320, 325, 45)
$pill_check = GUICtrlCreateCheckbox('Use Abnormal State Recovery', 10, 335)
GUICtrlCreateLabel('Belt:', 180, 340)
$pill_belt = GUICtrlCreateCombo('', 205, 335, 40, -1, 3)
GUICtrlSetData(-1, 'none|F1|F2|F3|F4', 'F1')
GUICtrlCreateLabel('Slot:', 255, 340)
$pill_slot = GUICtrlCreateCombo('', 280, 335, 35, -1, 3)
GUICtrlSetData(-1, '0|1|2|3|4|5|6|7|8|9', 1)
GUISetState()
While 1
$msg = GUIGetMsg()
If $msg = $char_input Then
ini('read')
EndIf
If $msg = -3 Then Exit
If $msg = -4 Then Tray()
For $i = 0 To 3
If $msg = Eval($type[$i] & '_slider') Then GUICtrlSetData(Eval($type[$i] & '_input'), GUICtrlRead(Eval($type[$i] & '_slider')))
If $msg = Eval($type[$i] & '_input') Then GUICtrlSetData(Eval($type[$i] & '_slider'), GUICtrlRead(Eval($type[$i] & '_input')))
Next
If $msg = $start_button Then
If GUICtrlRead($start_button) = 'Start Autopot' Then
GUICtrlSetData($start_button, 'Stop Autopot')
$run = True
ini()
ElseIf GUICtrlRead($start_button) = 'Stop Autopot' Then
GUICtrlSetData($start_button, 'Start Autopot')
$run = False
EndIf
EndIf
If $run Then
If $e = 1 Then
$pointer = $epointer
ElseIf $s = 1 Then
$pointer = $spointer
Else
$pointer = $zpointer
EndIf
$mid = memopen(WinGetProcess(GetHandle(GUICtrlRead($char_input))))
$HP_percent = memreaddynamic($mid, $pointer, $curhp) / memreaddynamic($mid, $pointer, $maxhp) * 100
$MP_percent = memreaddynamic($mid, $pointer, $curmp) / memreaddynamic($mid, $pointer, $maxmp) * 100
$Vigor_percent = memreaddynamic($mid, $pointer, $curhp) / memreaddynamic($mid, $pointer, $maxhp) * 100
$1 = memread($mid, $pointer) + $h1
$2 = memread($mid, $1) + $h2
$3 = memread($mid, $2) + $h3
$4 = memread($mid, $3) + $h4
$horsecur = memreaddynamic($mid, $4, $hcur)
$horselvl = memreaddynamic($mid, $4, $lvl, 'byte')
If $horselvl = 0 Then
$horsemax = memreaddynamic($mid, $4, $hmax)
ElseIf $horselvl > 0 And $horselvl <= 140 Then
$horsemax = $wolf_hp[$horselvl - 1]
Else
$horsemax = 0
EndIf
If $horsemax <> 0 Then
$Pet_percent = $horsecur / $horsemax * 100
Else
$Pet_percent = 0
EndIf
$status = memreaddynamic($mid, $pointer, $pill, "byte")
For $i = 0 To 5
If BitAND($status, 2 ^ $i) Then $pot_pill = 1
Next
If GUICtrlRead(Eval($type[0] & '_check')) = 1 And Eval($type[0] & '_percent') <= GUICtrlRead(Eval($type[0] & '_input')) And Eval($type[0] & '_percent') <> 0 And BitAND($status, 2 ^ 5) <> 1 Then
Pot(GUICtrlRead($char_input), GUICtrlRead(Eval($type[0] & '_belt')), GUICtrlRead(Eval($type[0] & '_slot')), GUICtrlRead(Eval($type[0] & '_delay')))
EndIf
For $i = 0 To 3
If GUICtrlRead(Eval($type[$i] & '_check')) = 1 And Eval($type[$i] & '_percent') <= GUICtrlRead(Eval($type[$i] & '_input')) And Eval($type[$i] & '_percent') <> 0 Then
If $i = 0 Or $i = 2 Then
If Not BitAND($status, 2 ^ 5) Then Pot(GUICtrlRead($char_input), GUICtrlRead(Eval($type[$i] & '_belt')), GUICtrlRead(Eval($type[$i] & '_slot')), GUICtrlRead(Eval($type[$i] & '_delay')))
Else
Pot(GUICtrlRead($char_input), GUICtrlRead(Eval($type[$i] & '_belt')), GUICtrlRead(Eval($type[$i] & '_slot')), GUICtrlRead(Eval($type[$i] & '_delay')))
EndIf
EndIf
Next
If GUICtrlRead($pill_check) = 1 And $pot_pill Then
Pot(GUICtrlRead($char_input), GUICtrlRead($pill_belt), GUICtrlRead($pill_slot), 1000)
EndIf
memclose($mid)
$pot_pill = 0
EndIf
Switch TrayGetMsg()
Case - 13
Tray()
EndSwitch
WEnd
Func Tray()
If BitAND(WinGetState($GUI), 2) Then
WinSetState($GUI, "", @SW_HIDE)
Else
WinSetState($GUI, "", @SW_SHOW)
EndIf
EndFunc ;==>Tray
Func SendSro($handle, $key)
Switch $key
Case "F1"
$k = 0x70
Case "F2"
$k = 0x71
Case "F3"
$k = 0x72
Case "F4"
$k = 0x73
Case Else
$k = 0x30 + $key
EndSwitch
For $i = 1 To 5
DllCall("User32.dll", "int", "PostMessageA", "hwnd", $handle, "int", 0x100, "int", $k, "int", 0)
DllCall("User32.dll", "int", "PostMessageA", "hwnd", $handle, "int", 0x101, "int", $k, "int", 0)
Next
EndFunc ;==>SendSro
Func GetHandle($char)
Local $list = WinList("[CLASS:CLIENT]")
For $i = 1 To $list[0][0]
Local $mid = memopen(WinGetProcess($list[$i][1]))
Local $name = memread($mid, $eCharname, 'char[12]')
If $name = $char Then
memclose($mid)
Global $e = 1
Global $s = 0
Global $z = 0
Return $list[$i][1]
EndIf
Local $name = memread($mid, $sCharname, 'char[12]')
If $name = $char Then
memclose($mid)
Global $s = 1
Global $e = 0
Global $z = 0
Return $list[$i][1]
EndIf
Local $name = memread($mid, $zCharname, 'char[12]')
If $name = $char Then
memclose($mid)
Global $s = 0
Global $e = 0
Global $z = 1
Return $list[$i][1]
EndIf
memclose($mid)
Next
EndFunc ;==>GetHandle
Func ini($action = 'write')
If $action = 'write' Then
For $i = 0 To 3
IniWrite('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_check', GUICtrlRead(Eval($type[$i] & '_check')))
IniWrite('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_belt', GUICtrlRead(Eval($type[$i] & '_belt')))
IniWrite('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_slot', GUICtrlRead(Eval($type[$i] & '_slot')))
IniWrite('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_input', GUICtrlRead(Eval($type[$i] & '_input')))
IniWrite('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_slider', GUICtrlRead(Eval($type[$i] & '_slider')))
Next
IniWrite('pot_config.ini', GUICtrlRead($char_input), 'pill_check', GUICtrlRead($pill_check))
IniWrite('pot_config.ini', GUICtrlRead($char_input), 'pill_belt', GUICtrlRead($pill_belt))
IniWrite('pot_config.ini', GUICtrlRead($char_input), 'pill_slot', GUICtrlRead($pill_slot))
Else
For $i = 0 To 3
GUICtrlSetState(Eval($type[$i] & '_check'), IniRead('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_check', GUICtrlRead(Eval($type[$i] & '_check'))))
GUICtrlSetData(Eval($type[$i] & '_belt'), IniRead('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_belt', GUICtrlRead(Eval($type[$i] & '_belt'))))
GUICtrlSetData(Eval($type[$i] & '_slot'), IniRead('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_slot', GUICtrlRead(Eval($type[$i] & '_slot'))))
GUICtrlSetData(Eval($type[$i] & '_input'), IniRead('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_input', GUICtrlRead(Eval($type[$i] & '_input'))))
GUICtrlSetData(Eval($type[$i] & '_slider'), IniRead('pot_config.ini', GUICtrlRead($char_input), $type[$i] & '_slider', GUICtrlRead(Eval($type[$i] & '_slider'))))
Next
GUICtrlSetState($pill_check, IniRead('pot_config.ini', GUICtrlRead($char_input), 'pill_check', GUICtrlRead($pill_check)))
GUICtrlSetData($pill_belt, IniRead('pot_config.ini', GUICtrlRead($char_input), 'pill_belt', GUICtrlRead($pill_belt)))
GUICtrlSetData($pill_slot, IniRead('pot_config.ini', GUICtrlRead($char_input), 'pill_slot', GUICtrlRead($pill_slot)))
EndIf
EndFunc ;==>ini
Func Pot($name, $bar, $slot, $delay = 1000)
If Not IsDeclared($name & "pot" & $slot) Then
If $bar <> 'none' Then SendSro(GetHandle($name), $bar)
SendSro(GetHandle($name), $slot)
Assign($name & "pot" & $slot, TimerInit(), 2)
ElseIf TimerDiff(Eval($name & "pot" & $slot)) > $delay Then
If $bar <> 'none' Then SendSro(GetHandle($name), $bar)
SendSro(GetHandle($name), $slot)
Assign($name & "pot" & $slot, TimerInit(), 2)
EndIf
EndFunc ;==>Pot
Func memopen($pid)
Local $mid = DllCall('kernel32.dll', 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 1, 'int', $pid)
Return $mid[0]
EndFunc ;==>memopen
Func memread($mid, $adress, $type = 'dword')
Local $struct = DllStructCreate($type)
DllCall('kernel32.dll', 'int', 'ReadProcessMemory', 'int', $mid, 'int', $adress, 'ptr', DllStructGetPtr($struct), 'int', DllStructGetSize($struct), 'int', '')
Return DllStructGetData($struct, 1)
EndFunc ;==>memread
Func memreaddynamic($mid, $pointer, $offset, $type = "dword")
$newadress = memread($mid, $pointer) + $offset
Return memread($mid, $newadress, $type)
EndFunc ;==>memreaddynamic
Func memclose($mid)
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $mid)
EndFunc ;==>memclose
so could anyone help me ? to try to only send 1 key and not 10