Jump to content

Need some help


Recommended Posts

; Made by Geoff Haneckow
;Arena combat macro
;Global Commands
Global $Paused = 0, $Paused2 = 0
Dim $Color = "0x930000"
Dim $Shade = "5"

;Hotkeys
HotKeySet("{F2}", "run")
HotKeySet("{DELETE}", "End")


;Run Method
While 1
    If $Paused = 1 Then
     Exist()
        sleep(100)
    EndIf
    
 
ToolTip("")   
WEnd

;Main Program Funcations
Func Exist()
    If WinActive("game") Then
    Box1()
Else
    ToolTip("Be in the game.", 0, 0)
Sleep(2000)
ToolTip("", 0, 0)
EndIf
EndFunc

Func Box1()
    Send("{ASC 049}")
    Sleep(100)
    PixelSearch( 0, 0, 543, 730, $Color, $Shade)
    sleep(10)
If Not @error Then
    Box2()
Else
    Box1()
EndIf
EndFunc

Func Box2()
    Send("{ASC 049}")
    Sleep(100)
    PixelSearch( 0, 0, 561, 730, $Color, $Shade)
    sleep(10)
If Not @error Then
    Box3()
Else
    Box2()
EndIf
EndFunc

Func Box3()
    Send("{ASC 049}")
    Sleep(100)
    PixelSearch( 0, 0, 582, 730, $Color, $Shade)
    sleep(10)
If Not @error Then
    Box4()
Else
    Box3()
EndIf
EndFunc

Func Box4()
    Send("{ASC 049}")
    Sleep(100)
    PixelSearch( 0, 0, 600, 730, $Color, $Shade)
    sleep(10)
If Not @error Then
    Box5()
Else
    Box4()
EndIf
EndFunc

Func Box5()
    Send("{ASC 049}")
    Sleep(100)
    PixelSearch( 0, 0, 619, 730, $Color, $Shade)
    sleep(10)
If Not @error Then
    Sleep(4000)
    Send("{ASC 052}")
Else
    Box5()
EndIf
EndFunc




;Activates Macro
Func run()
    If $Paused = 0 Then
        $Paused = 1
    Else
        $Paused = 0
    EndIf
EndFunc

;Hotkey exit
Func End()
    Exit 0
EndFunc

Well, this is try two at this, Im not really liking how well the script is working.

What I need is, a hotkey that will when it's pressed constantly look for a pixel.

Box1:

X: 543 Y: 730

Box2:

X: 561 Y: 730

Box3:

X: 582 Y: 730

Box4:

X: 600 Y: 730

Box5:

X: 619 Y: 730

I need to pixel search in three different spots, same y:, but the X: differs.

I need it Send the number '1', sleep(100), then pixel search

at the X

if it finds the pixel then it can move to the next pixel search, if it @error's then it needs to repeat the previous. Ie. Send the number '1', sleep(100), then pixel search

That above was the best method I could think of, if anyone could help me with a better method/cleaner idea

that would be excellent.

Jeff

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

Are these fixed spots... Example ... 530 x and 730 y .. you only want to check those 2 coords or is it that you want to start searching in the top left corner (0, 0) and search to those specific coords?

I mean, would PixelGetColor() be an option here?

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.

Link to comment
Share on other sites

  • Moderators

There fixed coords.

No Sh**! :D ... I asked if you could use PixelGetColor() or do you have to use the PixelSearch() in that big of an area? Your searching a large area right now!! Is that what you want to do, or only search those 2 speicific x and y coordinates?

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.

Link to comment
Share on other sites

Sorry, I mis-understood you.

I need to search in those 2 speicific x & y coors.

It would be nice if I could search for 3 pixels in the same search.

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

1st thing... Func run() ?? You can't use Run() like that.

Replace all your Box1 etc... functions with this one and see if it works:

Global $StaySearching

Func _StartSearch()
    $StaySearching = Not $StaySearching
    Local $xCoords[6] = ['', 543, 561, 582, 600, 619], $yCoords[2] = ['', 730]
    Local $ColorToFind = 0x930000, $shadeVariation = 5, $KeepTrack = 1
    While $StaySearching
        For $iCount = $KeepTrack To UBound($xCoords) - 1
            $PixSearch = PixelSearch($xCoords[$iCount], $yCoords[1], $xCoords[$iCount], $yCoords[1], $ColorToFind, $shadeVariation)
            If Not IsArray($PixSearch) Then
                $KeepTrack = $iCount
                ExitLoop
            ElseIf IsArray($PixSearch) And $iCount = 5 Then
                Sleep(4000)
                Send("{ASC 052}")
                $StaySearching = Not $StaySearching
            EndIf
            Send("{ASC 049}")
            Sleep(100)
        Next
        Sleep(10)
    WEnd
EndFunc
Edited by SmOke_N

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.

Link to comment
Share on other sites

I know I can't, I just renamed it. Not really interested in let people know what game it's for.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

I know I can't, I just renamed it. Not really interested in let people know what game it's for.

So we shouldn't be interested in helping you figure out your "secret" game? I could care less, as I don't play online games, but that sounded a tad one sided to me.

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.

Link to comment
Share on other sites

It's going in the scraps, when I was working on my Pixel Scanning bot, I changed names when I posted the code. If the server wasn't all "hell in a hand basket" id test this.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

I had to put a "Not" in there I think, or else it would fail... be sure to replace this edited function above in yours.

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.

Link to comment
Share on other sites

Well I was able to test it, it just keeps sending "Send("{ASC 049}")", it never Sends ASC 052

With that not now, it does nothing.

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

Well I was able to test it, it just keeps sending "Send("{ASC 049}")", it never Sends ASC 052

With that not now, it does nothing.

Cool

Edit:

I have the solution, but I don't want anyone to know it :D

Edited by SmOke_N

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.

Link to comment
Share on other sites

*Sigh*?

What would you like me to do Smoke, Share with everyone my "Master" Plan. I was looking for guidance, not the run around.

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

*Sigh*?

What would you like me to do Smoke, Share with everyone my "Master" Plan. I was looking for guidance, not the run around.

Guidance? No, you want someone to write a solution to your issue, let's not mistake your intentions... you said above, you wrote something, it works (Err... No.. There is a mistake in every function, however suttle it is, it's still a mistake), but you would like to know how to make it better. I showed you a plan/idea with no help from you (providing a working enviroment to test in), and you haven't even got off your ass to try and figure out why it was sending it multiple times, I'll bet anything you haven't put a MsgBox() / ConsoleWrite() / or anything to debug...

How the hell am I supposed to test it? Your amazing, I have this game that I don't want anyone to know what I'm playing, but hey, can you fix my code... Pathetic!

I was being sarcastic when I said what I said, and I was waiting to see how you would respond, yes I do have the fix, yes I do know why yours doesn't work, no I won't tell you, I'll let someone else be the huckleberry this time...

Edit:

Ok, I've calmed down now, and after actually looking at the forum, I think we all can tell what game it is for:

http://www.autoitscript.com/forum/index.php?showtopic=27387

Edited by SmOke_N

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.

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...