Ginseng Posted April 14, 2008 Share Posted April 14, 2008 (edited) Would it be possible to track the bar below from 100% to 0% or from 0% to 100% and then execute a command upon bar = 0% or 100%?If so how would i go about it? Edited April 14, 2008 by Ginseng Link to comment Share on other sites More sharing options...
martin Posted April 14, 2008 Share Posted April 14, 2008 Would it be possible to track the bar below from 100% to 0% or from 0% to 100% and then execute a command upon bar = 0% or 100%?If so how would i go about it?Is the progress bar in some application that you didn't create? 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. Link to comment Share on other sites More sharing options...
Ginseng Posted April 14, 2008 Author Share Posted April 14, 2008 Is the progress bar in some application that you didn't create?Yes Link to comment Share on other sites More sharing options...
ChrisL Posted April 14, 2008 Share Posted April 14, 2008 YesI think your going to need to provide more information about that progress bar or the the answer is likely to be Yes or No or Probably [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Ginseng Posted April 14, 2008 Author Share Posted April 14, 2008 (edited) Actually nvm, i'm going to try another method. It seems the Script cant pick up this bar's color value when im in game-windowed mode, its pulling the co-ords from the desktop rather than the gaming client even though the gaming client is active when its running. I know quite a few people here arent willing to help make game bots which is why im trying my best to do it myself so no one else can use the script. Problem is i dont have the time to play the game as much as id like to so i'm trying to make a bot so i can get into the higher levels and participate in the Guilds vs Guilds area of the game, without a bot to help me level i doubt i'd get to the levels required for this part of game. I barely have time to sleep let alone play MMO's but i love playing them for PVP value. Still if anyone is willing to help pm me, if not i understand, i'll just soldier on till i get a working bot script. Edited April 14, 2008 by Ginseng Link to comment Share on other sites More sharing options...
ChrisL Posted April 14, 2008 Share Posted April 14, 2008 (edited) OK so it's a game, chances are you can't read any data from the progress control but you can check the co-ordinates of the progress bar to see what colour they are using PixelGetColor() I don't know what values you are interested in but you could check 10 positions along the progress bar to know you have 10,20,30,40,50,60,70,80,90,100% or more even. Maybe find out what 10% range you are in then do some smaller pixelGetColour() operations to work out a more accurate measure. Maybe there is a better way this is just an idea. Edit: Just re-read your post and you say you cant read the colour value while the game is running but maybe you can use the GDIPlus screen capture to grab the image and then interogate that capture Edited April 14, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Ginseng Posted April 14, 2008 Author Share Posted April 14, 2008 OK so it's a game, chances are you can't read any data from the progress control but you can check the co-ordinates of the progress bar to see what colour they are using PixelGetColor()I don't know what values you are interested in but you could check 10 positions along the progress bar to know you have 10,20,30,40,50,60,70,80,90,100% or more even. Maybe find out what 10% range you are in then do some smaller pixelGetColour() operations to work out a more accurate measure. Maybe there is a better way this is just an idea.Edit: Just re-read your post and you say you cant read the colour value while the game is running but maybe you can use the GDIPlus screen capture to grab the image and then interogate that captureIts not that it cant read it, its just when i use the AutoIt Window Info tool its giving me the co-ords of the 1% - 0% of the HP Bar but when i check the color its different.I suppose i'll try the GDIPlus screen capture and try that, yet another thing to learn Thanks for the advice. Link to comment Share on other sites More sharing options...
ChrisL Posted April 14, 2008 Share Posted April 14, 2008 (edited) Funnily enough I was messing around with this code earlier most of it is from Randall. It only works on a BMP but if you were to screen capture the progress bar and save it as a BMP then you could load the values in to an array to find out what your progress bar was doing expandcollapse popup$szPicFile = "bar1su7.bmp";-----> PUT THE NAME AND LOCATION OF THE BITMAP HERE #include <GDIPlus.au3> #include <array.au3> $dll = _GDIPlus_Startup () $hImage = _GDIPlus_ImageLoadFromFile ($szPicFile) $imgwidth = _GDIPlus_ImageGetWidth ($hImage) $imgheight = _GDIPlus_ImageGetHeight ($hImage) _GDIPlus_ShutDown () $Step = 1; this is the accuracy of the BMP read 1 reads every pixel 5 reads every 5th pixel $nofpixels = ($imgwidth) * ($imgheight) ;-------------- ;-initialise Array Global $imgarray[$imgheight/$step][$imgwidth/$step] ;-open image ;Const $GWL_HINSTANCE = -6 ;Const $IMAGE_BITMAP = 0 ;Const $LR_LOADFROMFILE = 0x0010 Dim $hInst, $hBmp, $hMemDC, $hwnd Opt("WinWaitDelay",1) AutoItWinSetTitle("qqqqqq") $hwnd = WinGetHandle("qqqqqq") $hInst = DllCall("user32.dll","int","GetWindowLong","hWnd",$hwnd, "int",$GWL_HINSTANCE) $hInst = $hInst[0] $hBmp = DllCall("user32.dll","hwnd","LoadImage","hwnd",$hInst,"str",$szPicFile,"int",$IMAGE_BITMAP, _ "int",0,"int",0,"int",$LR_LOADFROMFILE) $hBmp = $hBmp[0] $hMemDC = DllCall("gdi32.dll", "int", "CreateCompatibleDC", "int", 0) $hMemDC = $hMemDC[0] DllCall("gdi32.dll", "hwnd", "SelectObject", "int", $hMemDC, "hwnd", $hBmp) ;------------------------------------- $setStr= "" ;-get pixels and populate array ProgressOn("Progress Meter", "Copying Pixels into array"); start progress bar For $x = 0 To Round($imgheight) -1 Step $Step For $y = 0 To Round($imgwidth)-1 Step $Step ;get pixel colour $ret = DLLCall("gdi32.dll","int","GetPixel","int",$hMemDC,"int",$y,"int",$x);x and y of pixel $ret = Hex( $ret[0], 6) $ret = StringRight($ret,2) & StringMid($ret,3,2) & StringLeft($ret,2) ;stick it in the array $imgarray[$x/$step][$y/$step] = $ret $str = Round((($y+1)+($x*$imgwidth))/1000) & " of " & Round($nofpixels/1000) & " thousands" If $Str <> $SetStr then $SetStr = $Str ProgressSet( ((($y+1)+($x*$imgwidth))/$nofpixels) * 100,$SetStr) EndIf Next Next ProgressSet(100 , "Done") ProgressOff() _ArrayDisplay($imgarray) ;-close image DllCall("gdi32.dll", "int", "DeleteDC", "hwnd", $hMemDC) DllCall("gdi32.dll", "int", "DeleteObject", "hwnd", $hBmp) Edit: cleaned it up a bitbar1su7.bmp Edited April 14, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Ginseng Posted April 14, 2008 Author Share Posted April 14, 2008 (edited) Thanks i'll give this a try. Edit: Numers.. soo many numbers my brain hurts. I think im in over my head with this one. Edited April 14, 2008 by Ginseng Link to comment Share on other sites More sharing options...
ChrisL Posted April 14, 2008 Share Posted April 14, 2008 It's the RGB colour values of each pixel so you could pick the middle row which is the middle of the progressbar, the other thing is this was converted from your PNG to a BMP which maybe giving false readings, you really need to do it with a straight capture [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Ginseng Posted April 14, 2008 Author Share Posted April 14, 2008 Crossing Fingers at the moment i just tried something, i played the game in full screen mode, took a screenshot of the game with monster bar at full and then another with monster bar empty and then tried the script below and it seems to be working. The script attacks when i apply the screenshot of full hp as my desktop. When i change screenshots and use the one with the empty HP Bar the script cycles through. So its obviously picking up the color change in full screen mode, i'm going to try again now in windowed mode as my coding is different now to when i previously tried lets hope. expandcollapse popupGlobal $Paused HotKeySet("{PGUP}", "_Terminate") HotKeySet("{PAUSE}", "TogglePause") ToolTip('Script - is Running', 0, 0) Sleep(1000) While 1 ToolTip('Script - is Targetting Monster', 0, 0) Sleep(300) Send("{TAB}") Sleep(300) ToolTip('Script - is Attacking Monster', 0, 0) Send("3") Sleep(300) Do PixelGetColor(542, 25) Until PixelGetColor(542, 25) = 0x293029 ToolTip('Script - is Picking Up Loot', 0, 0) Sleep(200) Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") WEnd Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate Link to comment Share on other sites More sharing options...
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