Jump to content

Difficulties with simple script


Recommended Posts

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

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
Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

mrjohnsinclaire,

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

The Forum Rules are quite clear - and there are no exceptions.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...