mrjohnsinclaire Posted January 31, 2012 Share Posted January 31, 2012 Hey guys, After a lot of headache I am about to give up. I'm trying to make a simple script, but it doesn't seem to work. Maybe you guys can help me. The only thing the script needs to do is to click (and hold) my left mouse button in the location of an object when it appears, and release the button after it dissappears. The object will be moving, so during the buton hold, the mouse will follow the object on my screen. Can someone help me with this script? If you need the pixel values of the object I can give that, or I can figure out where to place it in the script. Hopefully it is a short and simple script, as I imagine. Link to comment Share on other sites More sharing options...
Clark Posted January 31, 2012 Share Posted January 31, 2012 If you can post what you have come up with so far, we can take a look and offer constructive suggestions. Link to comment Share on other sites More sharing options...
mrjohnsinclaire Posted January 31, 2012 Author Share Posted January 31, 2012 OK. sounds like a plan. I'll add it to this post when I'm ready. Link to comment Share on other sites More sharing options...
mrjohnsinclaire Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) OK. Sorry for the double post. It won't allow me to edit the last one. OK. So: Func startover() ProcessClose ("bot.exe") while 1 PixelSearch(#,#,#,#,pixelcode,15) ;;;; now here I don't know how to make it search for a pixel on my entire screen, instead ;;;;of just an area. Do I set the 4 numbers as the border edges on my screen? If NOT @error Then Run("bot.exe") ExitLoop EndIf sleep(1000) Wend EndFunc So this script will start the sub-script after searching for the pixel on screen. while 1 $coord = PixelSearch(#,#,#,#,pixelcode,15) If not @error Then LButtondown (# #,1) ;after finds the value, it holds button down Sleep(5000) ;keeps it held for 5 seconds right? LButtonUp(#,#,1) ;releases leftbutton EndIf WEnd while 1 sleep(1000) wend Now I have no idea how to make me script follow the object, Hence why I don't think the #,#,# would work as these are specific locations on the screen. Any ideas? This is my first attempt at making an AutoIt script and sorry if it makes you laugh. Edited January 31, 2012 by mrjohnsinclaire Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 31, 2012 Share Posted January 31, 2012 You won't get any support for creating bots! Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
mrjohnsinclaire Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) Damn, well alright thanks anyway. Well it is a bot, but its for a simple game, not multiplayer. Its called OSU! and it uses mouse functions to play a song. Since I am not getting any type of advantage over "other players" (virtually no other players), would I get any support? Or still the same? Edited January 31, 2012 by mrjohnsinclaire Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 31, 2012 Share Posted January 31, 2012 I don't know, but try this PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, ... Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
mrjohnsinclaire Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) Okay, and how do I have my mouse follow the pixel? This part seems the most difficult to figure out Btw, Thanks alot for your assistance. Edited January 31, 2012 by mrjohnsinclaire Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 31, 2012 Share Posted January 31, 2012 (edited) PixelSearch returns an array. Have a look at the great help file ; Find a pure red pixel or a red pixel within 10 shades variations of pure red $coord = PixelSearch(0, 0, 20, 300, 0xFF0000, 10) If Not @error Then MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1]) EndIf This script shows how to find a read pixel and the result is shown by a MsgBox. Instead of showing it by a MsgBox you the coords with the command MouseMove Edited January 31, 2012 by Xenobiologist Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2012 Moderators Share Posted January 31, 2012 mrjohnsinclaire,Well it is a bot, but its for a simple gameThe Forum Rules are quite clear - and there are no exceptions.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...
Recommended Posts