Sign in to follow this  
Followers 0
bigassmuffin

Help with mouse move!

26 posts in this topic

#1 ·  Posted (edited)

So first I want this to start if you hold down the shift button..clearly this is:

How do I do this simple part?

When you hold mouse down, I want the screen to constantly look for the color red (almsot a red, the hex color I put there is correct)

$coord = PixelSearch( 0, 1023, 0, 651, 0xB50400 )
If Not @error Then
    MsgBox(No monsters were found)
EndIf

Now if it does locate the hex color 0xB50400, I want the mouse to move 12 pixels underneath/below where it found the hex color...

This is where I need major help on

THANK YOU FOR YOUR TIME AND HELP IF YOU GIVE HELP!

Edited by bigassmuffin

Share this post


Link to post
Share on other sites



Wait which is key needs to be held down to start searching? Shift or the mouse?

Share this post


Link to post
Share on other sites

shift

Share this post


Link to post
Share on other sites

Set a hotkey like this

HotKeySet("+l", "Search")oÝ÷ Ù8Z·l¶ Ëh~+@±ú+Ê«¢Ø^®«²Ø¨f²mëkÉ«­¢+ØÀÌØí½½ÉôA¥á±MÉ  À°ÄÀÈÌ°À°ØÔÄ°ÁáÔÀÐÀÀ¤)%%ÍÉÉä ÀÌØí½½É¤ôÄQ¡¸(%5½ÕÍ
±¥¬ Ìäí±ÐÌäì°ÀÌØí½½ÉlÁt°ÀÌØí½½ÉlÅt´ÄÔ°Ä°À¤(%M±À ÔÌÀ¤)¹%

Can't remember if x or y is up and down just mess around with it a bit, it might work.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Set a hotkey like this

HotKeySet("+l", "Search")oÝ÷ Ù8Z·l¶ Ëh~+@±ú+Ê«¢Ø^®«²Ø¨f²mëkÉ«­¢+ØÀÌØí½½ÉôA¥á±MÉ  À°ÄÀÈÌ°À°ØÔÄ°ÁáÔÀÐÀÀ¤)%%ÍÉÉä ÀÌØí½½É¤ôÄQ¡¸(%5½ÕÍ
±¥¬ Ìäí±ÐÌäì°ÀÌØí½½ÉlÁt°ÀÌØí½½ÉlÅt´ÄÔ°Ä°À¤(%M±À ÔÌÀ¤)¹%

Can't remember if x or y is up and down just mess around with it a bit, it might work.

HotKeySet("+l", "Search")?

I never heard of this..

Edit:

And it doesnt work because of the

HotKeySet("+l", "Search")

But thank you for other part of code so far!

Edited by bigassmuffin

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

HotKeySet("+l", "Search")?

I never heard of this..

I'll explain.. If you press Shift and "l" (L) at the same time it will call the function. (I should have done like q or something so you wouldn't get confused). Like this

Hotkeyset("+l", "Search")
While 1 
    Sleep(250)
WEnd
Func Search()
     Msgbox(0, "Yippee", "You pressed Shift + l....Congratulations!")
EndFunc

Press Shift and l at the same time and see what happens.

Edit: I swear Smoke N just posted. Why did it get deleted? I have picture for proof :D

I'll threatin' to release unless I get an answer! :D

Edited by bucky002

Share this post


Link to post
Share on other sites

Ok, what u hshowed me with msg box works, but wen i try:

Hotkeyset("+l", "Search")

Func Search()

$coord = PixelSearch( 0, 1023, 0, 651, 0xB50400 )

If IsArray($coord) = 1 Then

MouseClick('left', $coord[0], $coord[1] - 15, 1, 0)

Sleep(530)

EndIf

EndFunc

it does not work

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hmm, maybe something like this?

WinWaitActive(;Game Name)
$color = 0xB50400
$game = 0
HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 1023, 0, 651, $color)
        If IsArray($coord) = 1 Then
            MouseClick('left', $coord[0], $coord[1] - 15, 1, 0)
            Sleep(530)
        EndIf
    EndIf   
WEnd    
Func Play()
    If $game < 1 Then
        $game = $game + 1
    Else
        $game = 0
    EndIf
EndFunc
 


Func quit()
    Exit
EndFunc
to the window name. Use the autoit window info tool to find out.

Still confused why Smoke N's post is gone....

Edited by bucky002

Share this post


Link to post
Share on other sites

Hmm, maybe something like this?

WinWaitActive(;Game Name)
$color = 0xB50400
$game = 0
HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 1023, 0, 651, $color)
        If IsArray($coord) = 1 Then
            MouseClick('left', $coord[0], $coord[1] - 15, 1, 0)
            Sleep(530)
        EndIf
    EndIf   
WEnd    
Func Play()
    If $game < 1 Then
        $game = $game + 1
    Else
        $game = 0
    EndIf
EndFunc
 
Func quit()
    Exit
EndFunc
to the window name. Use the autoit window info tool to find out.
Wow, THANK YOU FOR SPENDIN SPO MUCH TIME, one problem though, the game active window has the cahracters [, ], and .

So autoit keeps thinking its a new funciton, so I cant use WinWAitActive on this

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

What's the window name? You could probably do

Opt("WinTitleMatchMode", 2)
WinWaitActive(;Game Name)
$color = 0xB50400
$game = 0
HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 1023, 0, 651, $color)
        If IsArray($coord) = 1 Then
            MouseClick('left', $coord[0], $coord[1] - 15, 1, 0)
            Sleep(530)
        EndIf
    EndIf   
WEnd   
Func Play()
    If $game < 1 Then
        $game = $game + 1
    Else
        $game = 0
    EndIf
EndFunc
 
Func quit()
    Exit
EndFunc

I still need to know the window name though.

Otherwise the code above probably won't work.

Edited by bucky002

Share this post


Link to post
Share on other sites

Wow, THANK YOU FOR SPENDIN SPO MUCH TIME, one problem though, the game active window has the cahracters [, ], and .

So autoit keeps thinking its a new funciton, so I cant use WinWAitActive on this

make sure you put it all in quotes

winwaitactive("[Game,name]")

should work

Share this post


Link to post
Share on other sites

What's the window name? You could probably do

Opt("WinTitleMatchMode", 2)
WinWaitActive(;Game Name)
$color = 0xB50400
$game = 0
HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 1023, 0, 651, $color)
        If IsArray($coord) = 1 Then
            MouseClick('left', $coord[0], $coord[1] - 15, 1, 0)
            Sleep(530)
        EndIf
    EndIf   
WEnd   
Func Play()
    If $game < 1 Then
        $game = $game + 1
    Else
        $game = 0
    EndIf
EndFunc
 
Func quit()
    Exit
EndFunc

I still need to know the window name though.

Otherwise the code above probably won't work.

[Conquer2.0]

[] and . are part of name

Share this post


Link to post
Share on other sites

[Conquer2.0]

[] and . are part of name

Are you sure

WinWaitActive("[Conquer2.0]")

Doesn't work?

anyything in quotes is called a "string" in autoit, and strings should not be broken by commas periods or brackets unless you end the Double quotes

if not,

maybe "WinSetTitle" will help you :D

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Since you are using WinTitleMatchMode this should work.

Opt("WinTitleMatchMode", 2)
WinWaitActive("Conquer")
$color = 0xB50400
$game = 0
HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 1023, 0, 651, $color)
        If IsArray($coord) = 1 Then
            MouseClick('left', $coord[0], $coord[1] - 15, 1, 0)
            Sleep(530)
        EndIf
    EndIf   
WEnd   
Func Play()
    If $game < 1 Then
        $game = $game + 1
    Else
        $game = 0
    EndIf
EndFunc
 
Func quit()
    Exit
EndFunc

Also I don't think it will work because I think your pixel search is messed up. All you are searching is "Left" and "Right" when you need to also know "Top" and "Bottom".

Edited by bucky002

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

This is what I want you to do. Open your game then open Autoit Window info tool usually located at C:\Program Files\AutoIt3\Au3Info.exe

Then click anywhere on the screen next take a screenshot of it or copy and paste what is inside it.

Edited by bucky002

Share this post


Link to post
Share on other sites

Also I don't think it will work because I think your pixel search is messed up. All you are searching is "Left" and "Right" when you need to also know "Top" and "Bottom".

Thats the money right there,

your pixelsearch is totally inverted, you have it searching one line of pixel on the far left of your screen,

just to test if this is the problem w/ script try doing this

PixelSearch(0,0,1279,1023, color)

This is a whole screen search

Share this post


Link to post
Share on other sites

Dont you think this is whole screen?

PixelSearch( 0 , 0 ,  @DesktopWidth - 1 , @DesktopHeight - 1, color )

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

Dont you think this is whole screen?

PixelSearch( 0 , 0 ,  @DesktopWidth - 1 , @DesktopHeight - 1, color )
Yes that is too, but i knew his resolution fit that because he had already made a search, he just but the nubers in the wrong place, and i didn't want to confuse with macros

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Still doesnt work, the error says:

Opt("[Conquer2.0]", 2)

Error: Unkown option or bad parameter specified..

I used this code:

Opt("[Conquer2.0]", 2)
WinWaitActive("Conquer")
$color = 0xB50400
$game = 0
HotKeySet("+p", "Play")
HotKeySet("{ESC}", "quit")
While 1
    If $game = 1 Then
        $coord = PixelSearch( 0, 0, 1023, 651, $color)
        If IsArray($coord) = 1 Then
            MouseClick('left', $coord[0], $coord[1] - 15, 1, 0)
            Sleep(530)
        EndIf
    EndIf   
WEnd   
Func Play()
    If $game < 1 Then
        $game = $game + 1
    Else
        $game = 0
    EndIf
EndFunc
 
Func quit()
    Exit
EndFunc
Edited by bigassmuffin

Share this post


Link to post
Share on other sites

Opt("[Conquer2.0]", 2) should be Opt('WinTitleMatchMode', 2)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0