Sign in to follow this  
Followers 0
mrjohnsinclaire

Difficulties with simple script

10 posts in this topic

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.

Share this post


Link to post
Share on other sites



If you can post what you have come up with so far, we can take a look and offer constructive suggestions.

Share this post


Link to post
Share on other sites

OK. sounds like a plan. I'll add it to this post when I'm ready.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by mrjohnsinclaire

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by mrjohnsinclaire

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by mrjohnsinclaire

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 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

Share this post


Link to post
Share on other sites

mrjohnsinclaire,

Well it is a bot, but its for a simple game

The 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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0