mcfreal Posted October 16, 2009 Posted October 16, 2009 (edited) Hi I made this script for my game but it is having issues. Pretty easy fix, somewhere in the loop What it is supposed to do: (Hot key Home to toggle script, F10 to exit. Tooltips displayed.) 1. When Script on, Detect the window titled RagII. 2. In RagII Window, It is supposed to search for a #555555 colored pixel in a box: 106 left and 89 top, width of 3 and height of 11. 3. When it finds the #555555 pixel, it repeatedly presses the 2 key and waits 300 ms until it find a #04ACEB pixel a different box: 203 from left and 89 from top, width of 3 and height of 11. The error is within the part where it repeatedly presses 2, I cannot seem to find the correct function syntax to make it repeatedly press 2 forever, waiting 300 ms before each time, until it finds the 04ACEB pixel. So I need to loop that. Any Suggestons? Heres the code: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $use = 0 ; ToolTip displaying function keys Tooltip("HOME = Start Auto Potion, F10 = Exit", 0, 0) If Not WinActive("RagII", "") Then WinActivate("RagII", "") While WinWaitActive("RagII", "") HotKeySet("{HOME}", "usePotion") HotKeySet("{F10}", "exitNow") WEnd While True If $use = 1 Then $size = WinGetClientSize("RagII", "") $color=PixelSearch(106,82,109,100,0x555555) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then Do Send(2) Sleep(300) Until $color=PixelSearch(203,82,206,100,0x04ACEB) not @error EndIf EndIf WEnd Func usePotion() If $use = 0 Then $use = 1 Tooltip("Now Using Auto Potion (HOME to disable)", 0, 0) Else $use = 0 Tooltip("HOME = Start Auto Potion, F10 = Exit", 0, 0) EndIf EndFunc Func exitNow() Exit EndFunc Edited October 16, 2009 by mcfreal
PsaltyDS Posted October 16, 2009 Posted October 16, 2009 Well, this is wrong: Do Send(2) Sleep(300) Until $color=PixelSearch(203,82,206,100,0x04ACEB) not @error Try it more like this: Do Send(2) Sleep(300) $color=PixelSearch(203,82,206,100,0x04ACEB) Until not @error Or, since you already tested @error = 0 to start with... While Not @error Send(2) Sleep(300) $color=PixelSearch(203,82,206,100,0x04ACEB) WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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