Jump to content

PixelSearch + Array then MouseMove MouseClick Problem


Recommended Posts

I am making a PowerMining Script for the game Runescape. However, I currently have its mouse moves and mouseclicks predetermined regardles if they are actually the object I am Looking for. But I did add a trigger, that when a certain Block obtains this color the drop sequence begins.

I want to change this a little bit. First the user defines the slot which will trigger the drop sequence, and the script has no predertimined mouseclicks or moves. When the trigger is recognized using a PixelSearch, It will begin search a predetermined area (or window) of them game. When the color is found it right clicks, and scrolls down 45 Pixels, and left clicks. Starting with the objects in the top left. It repeats its sequence until the final object, the trigger is dropped.

If anyone has done somthing like this, or could teach me how; it would be appreciated. I was thinking I could have an Array with the Mouse Clicks and Mouse Moves or somthing, and the pixels change each time it finds the next one. But I dont know how to implement Arrays in this language.

Edited by inline853
Link to comment
Share on other sites

I am making a PowerMining Script for the game Runescape. However, I currently have its mouse moves and mouseclicks predetermined regardles if they are actually the object I am Looking for. But I did add a trigger, that when a certain Block obtains this color the drop sequence begins.

I want to change this a little bit. First the user defines the slot which will trigger the drop sequence, and the script has no predertimined mouseclicks or moves. When the trigger is recognized using a PixelSearch, It will begin search a predetermined area (or window) of them game. When the color is found it right clicks, and scrolls down 45 Pixels, and left clicks. Starting with the objects in the top left. It repeats its sequence until the final object, the trigger is dropped.

If anyone has done somthing like this, or could teach me how; it would be appreciated. I was thinking I could have an Array with the Mouse Clicks and Mouse Moves or somthing, and the pixels change each time it finds the next one. But I dont know how to implement Arrays in this language.

Hmmm... interesting idea. I think you're on the right track and you should look into MouseGetPos since it returns the X,Y into an array. You could setup your screen coords like a map and those values be held in an array, prompting the user for the drop sequence (x,y) and use MouseMove and the coords from the arrays to move the mouse where you wanted.

Read up on MouseGetPos and the example code in the help file.

$pos = MouseGetPos()
MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])
Link to comment
Share on other sites

ok i'm gonna try this ... but I almost know its wrong. If anyone could help me get this right. lol

This is the Trigger

$data = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)
    If $data <> 1 Then
        Drop()
        EndIf

This is the Drop Sequence Function

Func Drop()
            While $data = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)  
            If $data <> 1 Then
            $pos = MouseGetPos()
            $pos = PixelSearch(810,175,602,175,$DropColor,$Sens)
            MouseMove($pos[0], $pos[1])
            MouseClick( "right" [,$pos[0], $pos[1]])
            MouseMove($pos[0], $pos[1]-45)
            MouseClick( "left" [,$pos[0], $pos[1]-45])
            EndIf
            WEnd
            EndFunc
Edited by inline853
Link to comment
Share on other sites

ok i'm gonna try this ... but I almost know its wrong. If anyone could help me get this right. lol

This is the Trigger

$data = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)
    If $data <> 1 Then
        Drop()
        EndIf

This is the Drop Sequence Function

Func Drop()
            While $data = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)  
            If $data <> 1 Then
            $pos = MouseGetPos()
            $pos = PixelSearch(810,175,602,175,$DropColor,$Sens)
            MouseMove($pos[0], $pos[1])
            MouseClick( "right" [,$pos[0], $pos[1]])
            MouseMove($pos[0], $pos[1]-45)
            MouseClick( "left" [,$pos[0], $pos[1]-45])
            EndIf
            WEnd
            EndFunc
i dont think that this part is good

$pos = MouseGetPos()
            $pos = PixelSearch(810,175,602,175,$DropColor,$Sens)

becose you set the same variable 2 times with diffrent data

use

Func Drop()
    While $data = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)    
        If $data <> 1 Then
            $pos = PixelSearch(810,175,602,175,$DropColor,$Sens)
            MouseMove($pos[0], $pos[1])
            MouseClick( "right" ,$pos[0], $pos[1])
            MouseMove($pos[0], $pos[1]-45)
            MouseClick( "left" ,$pos[0], $pos[1]-45)
        EndIf
    WEnd
EndFuncoÝ÷ ÚÚºÚ"µÍ[ÈÜ

BUÚ[H  ÌÍÙ]HH^[ÙXÚ
    ÌÍÜÛX[
Ì  ÌÍÜÛX[JÍ   ÌÍÜÛX[
ÌÉÌÍÜÛX[ØØ[ÚY  ÌÍÜÛX[JÍÉÌÍÜÛX[ØØ[ZYÚ  ÌÍÑÜÛÛÜ  ÌÍÔÙ[ÊHBRY ÌÍÙ]H    ÉÝÈH[    ÌÍÜÜÈH[ÝÙQÙ]ÜÊ
B[ÝÙS[ÝJ ÌÍÜÜÖÌK   ÌÍÜÜÖÌWJB[ÝÙPÛXÚÊ    ][ÝÜYÚ   ][ÝÈ  ÌÍÜÜÖÌK   ÌÍÜÜÖÌWJB[ÝÙS[ÝJ   ÌÍÜÜÖÌK   ÌÍÜÜÖÌWKM
JB[ÝÙPÛXÚÊ ][ÝÛY ][ÝÈ  ÌÍÜÜÖÌK   ÌÍÜÜÖÌWKM
JBBQ[YUÑ[[[

if you need data from your curent mouse position and data from your next pixelsearch then ser 2 diffrent variable names .

$pos = MouseGetPos()
$pos_1 = PixelSearch(810,175,602,175,$DropColor,$Sens)

and the to use their data

$pos[0],$pos[1]

$pos_1[0],$pos_1[1]

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

ok i'm gonna try this ... but I almost know its wrong. If anyone could help me get this right. lol

Its a little difficult for me to determine exactly what this is suppose to do since I don't game nor am familar with Runescape. From what you've provided I would make the following suggestions. Mainly so its easier to understand the code, imo.

FROM:

$data = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)
If $data <> 1 Then
    Drop()
    EndIf

TO:

Dim $left = $smallx+2, $top = $smally+42, $right = $smallx+2+$smallScanWidth, $bottom = $smally+42+$smallScanHeight

$data = PixelSearch($left, $top, $right, $bottom, $DropColor, $Sens)
If $data <> 1 Then Drop()oÝ÷ Ù.¬[§p:è¥Ú²}ý¶f¤zǧ±ëhë"Dz¢æ«zÞ¯
â¶)àÊ«Ó~©¢

Also having your conditional statement both inside and outside your function seems wrong, but I'm not sure what you're trying to do with you example code.

Link to comment
Share on other sites

yea dont know why I did that, but I fixed it. It is prolly my inexperience with this language, but even then it is evident it would serve no purpose. Any I solved the issue shortly after my last post, and have moved on to other aspects of the script. Thanks for the advice tho.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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