Forge Posted June 11, 2004 Posted June 11, 2004 expandcollapse popupFunc Left() $left = MouseGetPos() EndFunc Func Top() $Top = MouseGetPos() EndFunc Func Down() $Down = MouseGetPos() EndFunc Func Right() $Right = MouseGetPos() EndFunc AutoItSetOption("SendKeyDelay", 10) HotKeySet ("+{F1}", "StartScan") HotKeySet ("+{F2}", "StopScan") HotKeySet ("+{F3}", "ExitScanner") HotKeySet ("+{F4}", "Left") HotKeySet ("+{F5}", "Top") HotKeySet ("+{F6}", "Down") HotKeySet ("+{F7}", "Right") While 1 Sleep (100) Wend Func StartScan() ScanGreenhp() sleep(20) ScanMiddleGreenhp() sleep(20) ScanRedhp() sleep(20) AntiAFK() sleep(20) Endfunc Func StopScan() While 1 Sleep(6000) WEnd Endfunc Func AntiAFK() send ("^{UP}") Sleep(100) send ("^{Down}") Endfunc Func ScanGreenHp() Do $coord = PixelSearch( $left[1], $top[0], $down[0], $right[1], 0x00C400) Until NOT @error send ("{PRINTSCREEN}") send ("^{L}") MsgBox (0, "Logged!", "You logged at " & @Hour & ":" & @min & ":" & @sec & ". Screenshot available on clipboard (Open Paint and Ctrl-V)") EndFunc Func ScanMiddleGreenHp() Do $coord = PixelSearch( $left[1], $top[0], $down[0], $right[1], 0x68C468) Until NOT @error send ("{PRINTSCREEN}") send ("^{L}") MsgBox (0, "Logged!", "You logged at " & @Hour & ":" & @min & ":" & @sec & ". Screenshot available on clipboard (Open Paint and Ctrl-V)") EndFunc Func ScanRedHp() Do $coord = PixelSearch( $left[1], $top[0], $down[0], $right[1], 0x0000FF) Until NOT @error send ("{PRINTSCREEN}") send ("^{L}") MsgBox (0, "Logged!", "You logged at " & @Hour & ":" & @min & ":" & @sec & ". Screenshot available on clipboard (Open Paint and Ctrl-V)") EndFunc Func ExitScanner() Msgbox (0, "Exit", "Exiting Forge AutoLog") Exit EndFunc `Don't tell me the code is bad, I know. Just tell me where to put the functions Left() Right() Top() Down().. Thank you
SlimShady Posted June 11, 2004 Posted June 11, 2004 Don't worry.Put them anywhere. Like the other functions you made.
Forge Posted June 11, 2004 Author Posted June 11, 2004 it gives the error that they aren't decleared.
Josbe Posted June 11, 2004 Posted June 11, 2004 What do you want to do?Because when you press SHIFT+F4(Left), of course, only $left is assigned.$top, $down, $right aren't declared. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
jpm Posted June 12, 2004 Posted June 12, 2004 it gives the error that they aren't decleared.Which is normal as a variable has to be assigned/declared before usage. Your code is definitetly working from AutoIt3 poit of view. when you hit the Shift+F4 key the Left() function is called and the array variable is initialize. $left[0]=Xmouse position , $left[]=Ymouse position . Your problem come from the fact that setting for the first time $left in the Function left() just set a local variable which is not visible in the main and in othe function. You have to change $left= to global $left= or to declare Global $left[2] ... at the beginning.
Guest Guest Posted June 12, 2004 Posted June 12, 2004 At the beggining use Dim or Global, use Dim if you plain to use variables inside only the main script. Global if you need their value inside the Func also.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now