Jump to content
Sign in to follow this  
longxx

how to active this in game?

Recommended Posts

longxx

hi guys.

I am trying to make this SearchPixel works in game

this is what I have so far:

$coord = PixelSearch( 20, 300, 700, 850, 0x02F000, 10 )

If Not @error Then

Send("found color at",$coord[0] & "," & $coord[1] )

Else

Send("Could not find color")

EndIf

my question is how to active it? how to let it search it in game? does it only do it once when I active it?

because I prefer it constantly scan the area and when it observes the desired color can trigger the command.

thanks.

Share this post


Link to post
Share on other sites
TnTProductions

i found 1 error in your script after color dont have anything else its fine before you have something after it


"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Share this post


Link to post
Share on other sites
Generator

Put it in a loop such as While 1...WEnd or Do....Until or For..Step...Next or For..In..Next

Share this post


Link to post
Share on other sites
TnTProductions

also stop using the send function that doesnt display messages for you thats a key function try this:

$coord = PixelSearch( 20, 300, 700, 850, 0x02F000)
If Not @error Then
MsgBox("Color Found!","Color found at: & $coord[0] & $coord[1]" )
Else 
MsgBox("Color not Found..","Color wasn't found")
EndIf
Edited by TnTProductions

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Share this post


Link to post
Share on other sites
Orgins

You can try something like this: (Like Generator suggested but with a hotkeyset)

Hit the pause key and it'll do the search. (keep hitting pause it'll keep doing a new search)

HotKeySet("{PAUSE}", "search")
HotKeySet("{ESC}", "Terminate")

While 1
    Sleep(100)
WEnd

Func search()
$coord = PixelSearch( 20, 300, 700, 850, 0x02F000, 10 )
If Not @error Then
Tooltip("found color at",$coord[0] & "," & $coord[1] )
Else
Tooltip("Could not find color")
EndIf
EndFunc


Func Terminate()
    Exit 0
EndFunc
Edited by Orgins

I'm a newbie.Sorry if I don't reposed to your replays very fast.

Share this post


Link to post
Share on other sites
Rydextillxixdiex

I recommend the following over tool tips:

HotKeySet("{PAUSE}", "search")
HotKeySet("{ESC}", "Terminate")

While 1
    Sleep(100)
WEnd

Func search()
Global $show = 0
    $coord = PixelSearch( 20, 300, 700, 850, 0x02F000, 10 )
    If Not @error Then
    MsgBox(0, "PixelSearch", "found color at",$coord[0] & "," & $coord[1] )
    Else
    MsgBox(0, "PixelSearch", "Could not find color")
    EndIf
EndFunc


Func Terminate()
    MsgBox(0,"PixelSearch", "Press ok to exit" & @CRLF & "or" & @CRLF & "Press pause to search again")
    Exit 
EndFunc

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites
longxx

hey thanks for your help, it works!!! tooltip is great idea compare to message window.

now I have more advanced question to make this works towards the goal closer

-----I want to do two different things depends on two different color collected,

is it better to to two sets of PixelSearch, or two PixelSearch two colors? then to add IF color=A ... If color=B ...

some sample codes will be greatly appreciated! since i am really new at this..

thanks.

Share this post


Link to post
Share on other sites
TnTProductions

Just have two pixel searches in will make things simpler

let me get this strait you want it to do this: If the 1 pixel search returns true then do a certian function but if another pixel search is true then do another function?

Edited by TnTProductions

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Share this post


Link to post
Share on other sites
TnTProductions

ex:

$coord = PixelSearch( 20, 300, 700, 850, 0x02F000, 10 )
 $coord2 = PixelSearch(your second pixel search cordinates)
        $color = PixelSearch()
        Select
        Case $color = PixelSearch(20, 300, 700, 850, 0x02F000, 10 )
        ;;add function you want here;;
        Case $color = PixelSearch(second pixel search coordinates)
        ;;add function you want here;;
        EndSelect

use case for events like urs

Edited by TnTProductions

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Share this post


Link to post
Share on other sites
longxx

hey TnT thanks for your advice, I tried to run the script but there is error message with the $color variable, however I got it working with this code with two IFs, will it be ok?

Func search()
Global $show = 0
    $c1 = PixelSearch( 20, 300, 700, 850, 0x009933, 10 )
    If Not @error Then
    tooltip("yes1" )
EndIf

   $c2 = PixelSearch( 20, 300, 700, 850, 0xFFFFFF, 10 )
    If Not @error Then
    tooltip("yes2" )
    EndIf

EndFunc

so now this is working each time I press hotkey, how to make it KEEP scanning? ----I havent done anything like this before,

is it ok to make computer keep scanning one area??? will that make CPU temperature too hot?

and can anyone explain what the codes of " While 1 Sleep(100) WEnd" mean?

thanks.

Edited by longxx

Share this post


Link to post
Share on other sites
TnTProductions

yea thats fine i was using casing so it chooses from the options but i frgot to make the pixel searches a variable

Edited by TnTProductions

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

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  

×