angelo88 Posted May 5, 2010 Share Posted May 5, 2010 Hello again. I allowed myself 2 dumb questions here every 10 days.I hope you all allow me these too. Sadly, it is my second one.Please bear with me.I am trying to grasp basics of this language, andmaking a basic "bot" for a game thats over 20 years old.I dont really understand the "bottom top left right" conceptin pixelling. I have added my full code till now after this questionif anyone cares.Please meet Mr screen:Mr screen is ~500x500 pixels. Approx. What "left, top, right, bottom" would the copyright symbolbe in the bottomleft ? Just a guess will do..Based on that info, I can understand the concept and adapt it to my needsand never forget. I basically want to do an action when the area covering these pixelshas changed. Here is a (not much saying) attempt.Run("C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes","C:\angelo\emu\NES\FCEU") WinWaitActive ( "FCEUX 2.1.3: PINBALL" ) sleep (2000) Send("{r}") sleep (1000) Send("{r}") sleep (5000) Send("{f down}") ;Holds the f key down sleep (3000) Send("{f up}") ;Releases the A key $checksum = PixelChecksum(257, 411, 156, 411) AutoItSetOption ( "PixelCoordMode", 0 ) while 1 ; Wait for the region to change While $checksum = PixelChecksum(257, 411, 156, 411) Sleep(100) WEnd Send("{d up}") sleep (500) Send("{d down}") WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 5, 2010 Moderators Share Posted May 5, 2010 angelo88,Think of the screen as a grid like this:0 1 2 3 4 5 0 . . . . . . 1 . . . A . . 2 . . . . . . 3 . . . . . . 4 . Z . X X X 5 . . . X X X 6 . . . X X XPoint A is at coordinates 3, 1 - that is 3 across and 1 down.Point Z is at 1, 4 - that is 1 across and 4 down.The area covered by the Xs has the following coordinates:Left: 3Top: 4Right: 5Bottom: 6Does that make more sense? As to where your copyright symbol is situated - you need to decide what reference to take. AutoIt offers you a choice of 3 - which you can set with the Opt("PixelCoordMode", #) command. The 3 options are:0 = relative coords to the defined window (this means that you start from the top left of the window itself)1 = absolute screen coordinates (default) (this means that you start from the top left of the screen)2 = relative coords to the client area of the defined window (this means that you start from the top left of the internal part of the window)I suggest we stick with the default for the moment - i.e. relative to the whole screen! Still with me?One way to determine where your copyright symbol is located is to use the Au3 Window Info tool - you can find it at "C:\Program Files\AutoIt3\Au3Info.exe" if you have a standard installation. Once you have started it, use the arrows to move to the right until you can see the "Mouse" tab. Then move the "crosshairs" over the copyright symbol and read the position. Then move the "crosshairs" to the very top left of the window itself, next to the icon. The difference between these two positions is where the symbol is relative to the window.But, I hear you cry, you said we would be working relative to the screen? Yes, but will your window always be in the same place? Probably not. So even though we can get the positon of the window with WinGetPos, we also need to know where the symbol is relative to the window. Let us guess that the symbol is at 100, 480 on the window itself. You would therefore calculate the position relative to the screen (so we can use PixelSearch) like this:; get the window position $aPos = WinGetPos("FCEUX 2.1.3: PINBALL") ; Calculate the symbol position $iLeft = $aPos[0] + 100 $iTop = $aPos[1] + 480 $iRight = $iLeft + 20 ; let us assume it is about 20 pixels aross, you can check with the Window Info tool! $iBottom = $iTop + 20And there you have your parameters for the PixelSearch command.Ask again if anything is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
angelo88 Posted May 5, 2010 Author Share Posted May 5, 2010 incredibly clear, thank you very much. 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