Jump to content
Sign in to follow this  
gersonjosue

Help me transform AHK in AUTOIT

Recommended Posts

gersonjosue

tried, most did not have much success, could you give me any tips on how to turn this into autoit, or upgrade to autoit?

My Code AHK

HOME:: ;;start script

{

WinWait, title,

IfWinNotActive, title, , title, title,

WinWaitActive, title,

#Persistent

SetTimer, NumberToPick, 180 ;;determine the time "NumberToPick"

SetTimer, getitens, 130 ;;determine the time "get itens"

SetTimer, target, 1000 ;;determine the time "target"

SetTimer, hp, 110 ;;determine the time "hp"

SetTimer, mp, 100 ;;determine the time "mp"

SetTimer, hppet, 100 ;;determine the time "hppet"

hp:

PixelSearch, Px, Py, 206, 56, 208, 64, 0x2092CC6, 38, Fast

if ErrorLevel= 1

send, {- down}{- up}

return

mp:

PixelSearch, Px, Py, 207, 69, 209, 76, 0xC15318, 38, Fast

if ErrorLevel= 1

send, {0 down}{0 up}

return

hppet:

PixelSearch, Px, Py, 174, 109, 202, 114, 0X092FCA, 38, Fast

if ErrorLevel= 1

send, {= down}{= up}{= down}{= up}

return

NumberToPick:

Random, NumberToPress, 1,5

Send, {%NumberToPress% down}{%NumberToPress% up}

return

getitens:

send, {s down}{s up}

Return

target:

send, {space down}{space up}{space down}{space up}

return

}

MButton::pause ;;pause script

DEL::exitapp ;;exit script

return

Share this post


Link to post
Share on other sites
martin

tried, most did not have much success, could you give me any tips on how to turn this into autoit, or upgrade to autoit?

My Code AHK

HOME:: ;;start script

{

WinWait, title,

IfWinNotActive, title, , title, title,

WinWaitActive, title,

#Persistent

SetTimer, NumberToPick, 180 ;;determine the time "NumberToPick"

SetTimer, getitens, 130 ;;determine the time "get itens"

SetTimer, target, 1000 ;;determine the time "target"

SetTimer, hp, 110 ;;determine the time "hp"

SetTimer, mp, 100 ;;determine the time "mp"

SetTimer, hppet, 100 ;;determine the time "hppet"

hp:

PixelSearch, Px, Py, 206, 56, 208, 64, 0x2092CC6, 38, Fast

if ErrorLevel= 1

send, {- down}{- up}

return

mp:

PixelSearch, Px, Py, 207, 69, 209, 76, 0xC15318, 38, Fast

if ErrorLevel= 1

send, {0 down}{0 up}

return

hppet:

PixelSearch, Px, Py, 174, 109, 202, 114, 0X092FCA, 38, Fast

if ErrorLevel= 1

send, {= down}{= up}{= down}{= up}

return

NumberToPick:

Random, NumberToPress, 1,5

Send, {%NumberToPress% down}{%NumberToPress% up}

return

getitens:

send, {s down}{s up}

Return

target:

send, {space down}{space up}{space down}{space up}

return

}

MButton::pause ;;pause script

DEL::exitapp ;;exit script

return

You should start by looking in the help. At a glance a lot of that can be converted very easily by looking up the functions and it's not obvious you have tried. Winwait, WinWaitActive and Send for example are AutoIt functions too which is not surprising because AHK was an offshoot of AutoIt.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
gersonjosue

You should start by looking in the help. At a glance a lot of that can be converted very easily by looking up the functions and it's not obvious you have tried. Winwait, WinWaitActive and Send for example are AutoIt functions too which is not surprising because AHK was an offshoot of AutoIt.

ok, I could at least give a hint about how to start the script, and pause, I have to close the command,

follow my example

home::;; start script

Mbutton:: pause

delete:: exitapp

must run the script in the HOME key, if possible give me an idea about it.

thanks :)

Share this post


Link to post
Share on other sites
gersonjosue

tried the command "SetTimer" not found in autoit, this command exist? or has a similar command?

Share this post


Link to post
Share on other sites
ProgAndy

_Timer_SetTimer :) [You need to create a GUI (can be invisible) to use it.: $TimerGUI = GUICreate("",1,1) ]

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
disc330

Opt("MustDeclareVars",1)

Global $Botting

Dim $NumberToPick, $GetItens, $Target, $HP, $MP, $HPPet, $Title, $Coord, $NumberToPress

$Title = InputBox("Title","Enter the title of the window.")


HotKeySet("{HOME}","_Start")
HotKeySet("{DEL}","_Exit")
HotKeySet("{End}","_Pause")

$Botting = False


While 1
    While $Botting 
        If TimerDiff($NumberToPick)     > 180   then    _NumberToPick()
        If TimerDiff($GetItens)         > 130   then    _GetItens()
        If TimerDiff($Target)           > 1000  then    _Target()
        If TimerDiff($HP)               > 110   then    _HP()
        If TimerDiff($MP)               > 100   then    _MP()
        If TimerDiff($HPPet)            > 100   then    _HPPet()
    WEnd
    Sleep(10)
WEnd


Func _Start()
    WinWait($Title)                                           
    If WinActive($Title) <> $Title then WinActivate($Title) 
    $NumberToPick    = TimerInit()
    $GetItens        = TimerInit()
    $Target          = TimerInit()
    $HP              = TimerInit()
    $MP              = TimerInit()
    $HPPet           = TimerInit()
    $Botting = True
EndFunc


Func _NumberToPick()
    $NumberToPick = TimerInit()
    $NumberToPress = Random(1,5,1)
    Send($NumberToPress)
EndFunc


Func _GetItens()
    $GetItens = TimerInit()
    Send("s")
EndFunc

Func _Target()
    $Target = TimerInit()
    Send("{Space 2}")
EndFunc

Func _HP()
    $HP = TimerInit()
    $Coord = PixelSearch(206,56, 208, 64, 0x2092CC6, 38)
    If @error then Send("-")
EndFunc

Func _MP()
    $MP = TimerInit()
    $Coord = PixelSearch(207, 69, 209, 76, 0xC15318, 38)
    If @error then Send("0")
EndFunc

Func _HPPet()
    $HPPet = TimerInit()
    $Coord = PixelSearch(174, 109, 202, 114, 0X092FCA, 38)
    If @error then Send("==")
EndFunc

Func _Exit()
    Exit
EndFunc

Func _Pause()
    If $Botting  then   
        $Botting = False
        MsgBox(0,"Paused!","Press the pause button again to unpause!" & $Botting)
    Else
        $Botting = True
        MsgBox(0,"Unpaused!","Press the pause button again to pause!")
    EndIf
EndFunc

Just a quick thing, hope thats what you needed. o.O

Edited by disc330

Still learning...I love autoit. :)

Share this post


Link to post
Share on other sites
martin

_Timer_SetTimer :) [You need to create a GUI (can be invisible) to use it.: $TimerGUI = GUICreate("",1,1) ]

No need for a gui, just use 0 for the gui handle.

#include <timers.au3>

_TImer_Settimer(0,1000,"doda")
while 1
    
    sleep(20)
    
WEnd

Func doda($a,$b,$c,$d)
    ConsoleWrite("timed again"  & @CRLF)
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
gersonjosue

friends you test the performance of autoit in awhile thanks for the help that

:)

Share this post


Link to post
Share on other sites
LarryDalooza

friends you test the performance of autoit in awhile thanks for the help that

:)

Yoda, is that you?

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
TerarinK

Like I had said this would be a script (not tested though but format is right):

AutoItSetOption("SendKeyDownDelay", 5)

WinWait($Title)
If WinWaitNotActive($Title, "", 3000) Then WinWaitActive($Title)

$ClientSize = WinGetClientSize("[active]")

AdlibEnable("_HP", 100)
AdlibEnable("_MP", 100)
AdlibEnable("_HPPet", 100)
AdlibEnable("_NumberToPick", 180)
AdlibEnable("_TimeToGet", 130)
AdlibEnable("_TargetFind", 1000)

While 1
    Sleep(10)
WEnd

Func _Send($sString)
    Send("{" & $sString & "}")
EndFunc   ;==>_Send

Func _HP()
    $PixelSearch = PixelSearch($pX, $pY, $ClientSize[0], $ClientSize[1], 0x2092CC6)
    If IsArray($PixelSearch) = 1 Then
        _Send("-")
    EndIf
EndFunc   ;==>_HP

Func _MP()
    $PixelSearch = PixelSearch($pX, $pY, $ClientSize[0], $ClientSize[1], 0xC15318)
    If IsArray($PixelSearch) = 1 Then
        _Send("0")
    EndIf
EndFunc   ;==>_MP

Func _HPPet()
    $PixelSearch = PixelSearch($pX, $pY, $ClientSize[0], $ClientSize[1], 0X092FCA)
    If IsArray($PixelSearch) = 1 Then
        _Send("=")
    EndIf
EndFunc   ;==>_HPPet

Func _NumberToPick()
    $NumberToPress = Random(0, 1.5)
    _Send($NumberToPress)
EndFunc   ;==>_NumberToPick
Func _TimeToGet()
    _Send("s")
EndFunc   ;==>_TimeToGet
Func _TargetFind()
    _Send(" ")
EndFunc   ;==>_TargetFind

It finds the window called title and activates it. Then I get the size of the window so we aren't doing a whole desktop look up. AdlibEnable is used just like you have calling functions every time it reaches that mark, mm in seconds to be right. I forgot the code to put it in a loop endlessly so I just put it in, then you'll need to put something in like a shutdown switch it you want to or else just manually shut down. Then put the code for your go to marks, I think those are right since you had them in your code, just the idea of a wait timer on them seemed somewhat like OPT or AutoItSetOption could incorporate while sending the information those not need to hold down and back up. If you have any question please do announce them


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
TerarinK

I have one question are you doing a search for the PixelSearch to be -1, and anykind of number? Because then just checking @error would be the correct way to have it. I see my code work perfect with your code, disc330 just I used AdlibEnable because you can say to activate everytime that way. I just am guessing whatever you want to put down to activate it would work perfectly fine.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
gersonjosue

I have one question are you doing a search for the PixelSearch to be -1, and anykind of number? Because then just checking @error would be the correct way to have it. I see my code work perfect with your code, disc330 just I used AdlibEnable because you can say to activate everytime that way. I just am guessing whatever you want to put down to activate it would work perfectly fine.

friend thanks for the example script, with he had a better learning, I'm already familiar with autoit, could tell me where it went wrong here, is not running, run, the more he is not pro tray near the clock

my code::

AutoItSetOption("SendKeyDownDelay", 5)

$Title = ("Hero Online")

AdlibEnable("_HP", 100)

AdlibEnable("_MP", 100)

AdlibEnable("_HPPet", 100)

AdlibEnable("_NumberToPick", 180)

AdlibEnable("_TimeToGet", 130)

AdlibEnable("_TargetFind", 1000)

HotKeySet("{Home}","_Start")

HotKeySet("{Delete}","_Exit")

HotKeySet("{End}","_Pause")

Func _Start()

WinWait($Title)

WinWaitNotActive($Title)

WinWaitActive($Title)

AdlibEnable("_HP", 100)

AdlibEnable("_MP", 100)

AdlibEnable("_HPPet", 100)

AdlibEnable("_NumberToPick", 180)

AdlibEnable("_TimeToGet", 130)

AdlibEnable("_TargetFind", 1000)

EndFunc

Func _Send($sString)

Send("{" & $sString & "}")

EndFunc ;==>_Send

Func _HP()

$PixelSearch = PixelSearch(206, 56, 208, 64, 0x2092CC6, 38)

If IsArray($PixelSearch) = 1 Then

_Send("- down")

_Send("- up")

EndIf

EndFunc ;==>_HP

Func _MP()

$PixelSearch = PixelSearch(207, 69, 209, 76, 0xC15318, 38)

If IsArray($PixelSearch) = 1 Then

_Send("0 down")

_Send("0 up")

EndIf

EndFunc ;==>_MP

Func _HPPet()

$PixelSearch = PixelSearch(174, 109, 202, 114, 0X092FCA, 38)

If IsArray($PixelSearch) = 1 Then

_Send("= down")

_Send("= up")

EndIf

EndFunc ;==>_HPPet

Func _NumberToPick()

$NumberToPress = Random(3,9)

_Send($NumberToPress)

EndFunc ;==>_NumberToPick

Func _TimeToGet()

_Send("s down")

_Send("s up")

EndFunc ;==>_TimeToGet

Func _TargetFind()

_Send("v down")

_Send("v up")

EndFunc ;==>_TargetFind

Func _Exit()

Exit

EndFunc

Func _Pause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Share this post


Link to post
Share on other sites
gersonjosue

I have one question are you doing a search for the PixelSearch to be -1, and anykind of number? Because then just checking @error would be the correct way to have it. I see my code work perfect with your code, disc330 just I used AdlibEnable because you can say to activate everytime that way. I just am guessing whatever you want to put down to activate it would work perfectly fine.

to be honest it took me a while to get this code, but I know that works:) example:

PixelSearch, Px, Py, 206, 56, 208, 64, 0x2092CC6, 38, Fast

if errorlevel = 1

send, (- down) (- up)

return

(check the color 0x2092CC6 if not the color 0x2092CC6 send key "-")

also has the opposite

PixelSearch, Px, Py, 538, 877, 545, 884, 0x3772B0, 38, Fast

if errorlevel = 0

send, (2 down) (2 up)

return

that demand a different color of (0x3772B0)

:)

Share this post


Link to post
Share on other sites
TerarinK

If your going to put down _Send() twice with and down and up you shouldn't have SendKeyDownDelay set to 5 as that is what it does. As far as I am concerned your program will not pause because you need to AdlibDisable() them because you first declared them. As for declaring AdlibEnable twice is bad because you already declared it and now confusing, maybe double lapping not sure because I have never done that. As for the "38" your going 19 steps from the color in both direction to find that color or something like it.

WinWait($Title) is a bool and should be used as a condition as are the rest of them

AutoItSetOption("SendKeyDownDelay", 5)

HotKeySet("{Home}", "_Toggle")
HotKeySet("{End}", "_Pause")

While 1
    Sleep(10)
WEnd

Func _Toggle()
    $sTitle = ("Hero Online")

    If $bPaused Then
        $bPaused = False
        ToolTip("")
        If Not WinWaitNotActive($sTitle) Then
            WinWaitActive($sTitle)
            AdlibEnable("_HP", 100)
            AdlibEnable("_MP", 100)
            AdlibEnable("_HPPet", 100)
            AdlibEnable("_NumberToPick", 180)
            AdlibEnable("_TimeToGet", 130)
            AdlibEnable("_TargetFind", 1000)
        EndIf
    Else
        $bPaused = True
        ToolTip("Script is Paused", 0, 0)
        AdlibDisable()
    EndIf
EndFunc   ;==>_Toggle

Func _HP()
    $PixelSearch = PixelSearch(206, 56, 208, 64, 0x2092CC6, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("-")
    EndIf
EndFunc   ;==>_HP

Func _MP()
    $PixelSearch = PixelSearch(207, 69, 209, 76, 0xC15318, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("0")
    EndIf
EndFunc   ;==>_MP

Func _HPPet()
    $PixelSearch = PixelSearch(174, 109, 202, 114, 0X092FCA, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("=")
    EndIf
EndFunc   ;==>_HPPet

Func _NumberToPick()
    $NumberToPress = Random(3, 9)
    Send($NumberToPress)
EndFunc   ;==>_NumberToPick

Func _TimeToGet()
    Send("s")
EndFunc   ;==>_TimeToGet

Func _TargetFind()
    Send("v")
EndFunc   ;==>_TargetFind

Func _Exit()
    Exit (0)
EndFunc   ;==>_Exit

Here is what I get with the modifications, I took out your Start and Pause and replaced it with a toggle with either of them. If it doesn't find the title then never activates the AdlibEnable, making it somewhat good. Also got the AdlibDisable in the opposite of running so the functions don't seem to run.

Edited by TerarinK

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
gersonjosue

If your going to put down _Send() twice with and down and up you shouldn't have SendKeyDownDelay set to 5 as that is what it does. As far as I am concerned your program will not pause because you need to AdlibDisable() them because you first declared them. As for declaring AdlibEnable twice is bad because you already declared it and now confusing, maybe double lapping not sure because I have never done that. As for the "38" your going 19 steps from the color in both direction to find that color or something like it.

WinWait($Title) is a bool and should be used as a condition as are the rest of them

AutoItSetOption("SendKeyDownDelay", 5)

HotKeySet("{Home}", "_Toggle")
HotKeySet("{End}", "_Pause")

While 1
    Sleep(10)
WEnd

Func _Toggle()
    $sTitle = ("Hero Online")

    If $bPaused Then
        $bPaused = False
        ToolTip("")
        If Not WinWaitNotActive($sTitle) Then
            WinWaitActive($sTitle)
            AdlibEnable("_HP", 100)
            AdlibEnable("_MP", 100)
            AdlibEnable("_HPPet", 100)
            AdlibEnable("_NumberToPick", 180)
            AdlibEnable("_TimeToGet", 130)
            AdlibEnable("_TargetFind", 1000)
        EndIf
    Else
        $bPaused = True
        ToolTip("Script is Paused", 0, 0)
        AdlibDisable()
    EndIf
EndFunc   ;==>_Toggle

Func _HP()
    $PixelSearch = PixelSearch(206, 56, 208, 64, 0x2092CC6, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("-")
    EndIf
EndFunc   ;==>_HP

Func _MP()
    $PixelSearch = PixelSearch(207, 69, 209, 76, 0xC15318, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("0")
    EndIf
EndFunc   ;==>_MP

Func _HPPet()
    $PixelSearch = PixelSearch(174, 109, 202, 114, 0X092FCA, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("=")
    EndIf
EndFunc   ;==>_HPPet

Func _NumberToPick()
    $NumberToPress = Random(3, 9)
    Send($NumberToPress)
EndFunc   ;==>_NumberToPick

Func _TimeToGet()
    Send("s")
EndFunc   ;==>_TimeToGet

Func _TargetFind()
    Send("v")
EndFunc   ;==>_TargetFind

Func _Exit()
    Exit (0)
EndFunc   ;==>_Exit

Here is what I get with the modifications, I took out your Start and Pause and replaced it with a toggle with either of them. If it doesn't find the title then never activates the AdlibEnable, making it somewhat good. Also got the AdlibDisable in the opposite of running so the functions don't seem to run.

brain almost on fire, and still nothing, could you explain why in my tests this worked perfectly scrip

HotKeySet("{F5}", "Start")

HotKeySet("!{F5}","Quit")

TogglePause()

Func Start()

HotKeySet("{F5}")

HotKeySet("{F5}", "TogglePause")

ToolTip('Script on', 0, 20)

While 1

Send("s")

Send("s")

Sleep(500)

WEnd

EndFunc

Func TogglePause()

ToolTip('Script off',0,20)

HotKeySet("{F5}")

HotKeySet("{F5}", "Start")

While 1

sleep(100)

WEnd

EndFunc

func Quit()

Exit

EndFunc

________________________________________________________________________________

and that incorporating the scrip does not work, something wrong?

HotKeySet("{F5}", "Start")

HotKeySet("!{F5}","Quit")

TogglePause()

Func Start()

HotKeySet("{F5}")

HotKeySet("{F5}", "TogglePause")

ToolTip('Script on', 0, 20)

$sTitle = ("Hero OnLine")

WinActivate($sTitle)

WinWaitActive($sTitle)

WinWaitNotActive($sTitle)

AdlibEnable("_HP", 100)

AdlibEnable("_MP", 100)

AdlibEnable("_HPPet", 100)

AdlibEnable("_NumberToPick", 180)

AdlibEnable("_TimeToGet", 130)

AdlibEnable("_TargetFind", 1000)

EndFunc

Func _HP()

$PixelSearch = PixelSearch(206, 56, 208, 64, 0x2092CC6, 38)

If IsArray($PixelSearch) = 1 Then

Send("-")

EndIf

EndFunc ;==>_HP

Func _MP()

$PixelSearch = PixelSearch(207, 69, 209, 76, 0xC15318, 38)

If IsArray($PixelSearch) = 1 Then

Send("0")

EndIf

EndFunc ;==>_MP

Func _HPPet()

$PixelSearch = PixelSearch(174, 109, 202, 114, 0X092FCA, 38)

If IsArray($PixelSearch) = 1 Then

Send("=")

EndIf

EndFunc ;==>_HPPet

Func _NumberToPick()

$NumberToPress = Random(3, 9)

Send($NumberToPress)

EndFunc ;==>_NumberToPick

Func _TimeToGet()

Send("s down")

Send("s up")

EndFunc ;==>_TimeToGet

Func _TargetFind()

Send("v")

EndFunc ;==>_TargetFind

Func TogglePause()

ToolTip('Script off',0,20)

HotKeySet("{F5}")

HotKeySet("{F5}", "Start")

While 1

sleep(100)

WEnd

EndFunc

func Quit()

Exit

EndFunc

have patience with me, I'm starting in autoit, more I see that I'm going to do great scripts with this tool, I like much to work with autoit :)

Share this post


Link to post
Share on other sites
TerarinK

Firstly you should never put a HotKeySet() with only one thing it there, I know it supports that but it does nothing and with that you only need to put it in the code once unless you are trying to do that with a toggle but putting each in a different function. I'll download a test of this script and put it up here after my show, around 12:00 unless someone else helps you.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
gersonjosue

Firstly you should never put a HotKeySet() with only one thing it there, I know it supports that but it does nothing and with that you only need to put it in the code once unless you are trying to do that with a toggle but putting each in a different function. I'll download a test of this script and put it up here after my show, around 12:00 unless someone else helps you.

thanks again friend, I sleep a little now (being 2:00 o'clock in the morning here) in a moment to continue my task autoit work on my game. Again, thank you for your attention and patience with me

:)

Share this post


Link to post
Share on other sites
TerarinK

Ahhh my whole idea of AdlibEnable falls short of what I believe. AdlibEnable only cast itself once and thats all a script can handle unless you write up a script pertaining to each function your executing and run them all once but that would be harder.

This script works then but I would say to watch yourself if you are running this script because the same code around the same time looks kinda wierd even if you milk it your overly pressing the keys in a sequence.

Global $iHP = TimerInit(), $iMP = TimerInit(), $iHPPet = TimerInit(), $iNumberToPick = TimerInit(), $iTimeToGet = TimerInit(), $iTargetFind = TimerInit()
Global $bPaused

AutoItSetOption("SendKeyDownDelay", 5)

HotKeySet("{Home}", "_Toggle")
HotKeySet("{End}", "_Exit")

While 1
    Sleep(10)
WEnd

Func _Toggle()
    $sTitle = ("Untitled - Notepad")

    If $bPaused Then
        $bPaused = False
        ToolTip("")

        If WinExists($sTitle) Then
            If Not WinActive($sTitle) Then WinActivate($sTitle)
            While Not $bPaused
                If TimerDiff($iHP) > 110 Then _HP()
                If TimerDiff($iMP) > 100 Then _MP()
                If TimerDiff($iHPPet) > 100 Then _HPPet()
                If TimerDiff($iNumberToPick) > 180 Then _NumberToPick()
                If TimerDiff($iTimeToGet) > 130 Then _TimeToGet()
                If TimerDiff($iTargetFind) > 1000 Then _TargetFind()
            WEnd
        EndIf
    Else
        $bPaused = True
        ToolTip("Script is Paused", 0, 0)
        AdlibDisable()
    EndIf
EndFunc   ;==>_Toggle

Func _HP()
    $PixelSearch = PixelSearch(206, 56, 208, 64, 0x2092CC6, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("-")
    EndIf
    $iHP = TimerInit()
EndFunc   ;==>_HP

Func _MP()
    $PixelSearch = PixelSearch(207, 69, 209, 76, 0xC15318, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("0")
    EndIf
    $iMP = TimerInit()
EndFunc   ;==>_MP

Func _HPPet()
    $PixelSearch = PixelSearch(174, 109, 202, 114, 0X092FCA, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("=")
    EndIf
    $iHPPet = TimerInit()
EndFunc   ;==>_HPPet

Func _NumberToPick()
    $NumberToPress = Random(3, 9)
    Send($NumberToPress)
    $iNumberToPick = TimerInit()
EndFunc   ;==>_NumberToPick

Func _TimeToGet()
    Send("s")
    $iTimeToGet = TimerInit()
EndFunc   ;==>_TimeToGet

Func _TargetFind()
    Send("v")
    $iTargetFind = TimerInit()
EndFunc   ;==>_TargetFind

Func _Exit()
    Exit (0)
EndFunc   ;==>_Exit

Now I ran it and everything worked but your first problem would be no game out there accepts commands that fast for one character, also if you want to do these command repeatedly then why not setup a send() command through and leave it a that because all your doing it repeating "vs4.69018309470266ss8.56879904307425ss3.07139357132837s" see the pattern there? That is exactally one second and I see the pattern after three seconds.

Edited by TerarinK

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
gersonjosue

Ahhh my whole idea of AdlibEnable falls short of what I believe. AdlibEnable only cast itself once and thats all a script can handle unless you write up a script pertaining to each function your executing and run them all once but that would be harder.

This script works then but I would say to watch yourself if you are running this script because the same code around the same time looks kinda wierd even if you milk it your overly pressing the keys in a sequence.

Global $iHP = TimerInit(), $iMP = TimerInit(), $iHPPet = TimerInit(), $iNumberToPick = TimerInit(), $iTimeToGet = TimerInit(), $iTargetFind = TimerInit()
Global $bPaused

AutoItSetOption("SendKeyDownDelay", 5)

HotKeySet("{Home}", "_Toggle")
HotKeySet("{End}", "_Exit")

While 1
    Sleep(10)
WEnd

Func _Toggle()
    $sTitle = ("Untitled - Notepad")

    If $bPaused Then
        $bPaused = False
        ToolTip("")

        If WinExists($sTitle) Then
            If Not WinActive($sTitle) Then WinActivate($sTitle)
            While Not $bPaused
                If TimerDiff($iHP) > 110 Then _HP()
                If TimerDiff($iMP) > 100 Then _MP()
                If TimerDiff($iHPPet) > 100 Then _HPPet()
                If TimerDiff($iNumberToPick) > 180 Then _NumberToPick()
                If TimerDiff($iTimeToGet) > 130 Then _TimeToGet()
                If TimerDiff($iTargetFind) > 1000 Then _TargetFind()
            WEnd
        EndIf
    Else
        $bPaused = True
        ToolTip("Script is Paused", 0, 0)
        AdlibDisable()
    EndIf
EndFunc   ;==>_Toggle

Func _HP()
    $PixelSearch = PixelSearch(206, 56, 208, 64, 0x2092CC6, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("-")
    EndIf
    $iHP = TimerInit()
EndFunc   ;==>_HP

Func _MP()
    $PixelSearch = PixelSearch(207, 69, 209, 76, 0xC15318, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("0")
    EndIf
    $iMP = TimerInit()
EndFunc   ;==>_MP

Func _HPPet()
    $PixelSearch = PixelSearch(174, 109, 202, 114, 0X092FCA, 38)
    If IsArray($PixelSearch) = 1 Then
        Send("=")
    EndIf
    $iHPPet = TimerInit()
EndFunc   ;==>_HPPet

Func _NumberToPick()
    $NumberToPress = Random(3, 9)
    Send($NumberToPress)
    $iNumberToPick = TimerInit()
EndFunc   ;==>_NumberToPick

Func _TimeToGet()
    Send("s")
    $iTimeToGet = TimerInit()
EndFunc   ;==>_TimeToGet

Func _TargetFind()
    Send("v")
    $iTargetFind = TimerInit()
EndFunc   ;==>_TargetFind

Func _Exit()
    Exit (0)
EndFunc   ;==>_Exit

Now I ran it and everything worked but your first problem would be no game out there accepts commands that fast for one character, also if you want to do these command repeatedly then why not setup a send() command through and leave it a that because all your doing it repeating "vs4.69018309470266ss8.56879904307425ss3.07139357132837s" see the pattern there? That is exactally one second and I see the pattern after three seconds.

Thanks friend, this working. I'm just setting the command pixelsearh because I think it is the difference between tolerance of color between the AUTOIT AHK, AHK in tolerance to this "38" example: PixelSearch, Px, Py, 207, 69, 209, 76, 0xC15318, "38" , Fast

plus the other commands are working.

Share this post


Link to post
Share on other sites
TerarinK

I overlooked in AHK just what PixelSearch is and the command that it processes, however I don't get my they have a string Fast|RGB in there if they don't use it. The 38 is is a number you tell the command pixelsearch to use as a shader, it will be divided in half and -/+ to the color. It cannot go below 0 and above 255.

PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] )

I thought it was a step at first being the Fast parameter, Fast being a macro for 2 or more but it isn't.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×