Jump to content

Recommended Posts

Posted

Hi,

I wanna implement into my script to search for a colour until it finds its

961, 677, 961, 677, 0x845136 (thats the coords and color for the pixel)

how ever when i run my script as soon as it gets to that commend its instantly goes to the next function.

At the minute my coding is

PixelSearch( 961, 677, 961, 677, 0x845136 )

If Not @error Then

MsgBox(0, "unlucky")

EndIf

so if it doesnt find it iw will bring up a box( i just did that to test it)

im curious to why it isnt right, and when its working do i need to put it in a while true loop or some other kind?

Thanks

Posted (edited)

If I'm not mistaken, your code should look like this (just testing)

PixelSearch( 961, 677, 961, 677, 0x845136 )

If @error Then

MsgBox(0, "unlucky")

EndIf

by using "If Not @error Then", you move the "false" expression to after the else...since your code basically is stating "If there is not an @error flagged Then 'MsgBox ...'" When you want it to say "If there is an @error Then 'MsgBox'"...remove the not or put in a dummy command before the Else and put your msgbox after the else

Edited by DjKarate
Posted (edited)

Thanks that worked, for the repeat i want ii had another look and the do until loop sounds like what i need, but i cant figure out what i need inside it. Id imagine do pixelsearch until pixelsearch is truw but im not sure if its right/how to wright it.

Thanks

IT may be easier to show my script

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $Button_1, $Button_2, $msg
    GUICreate("What To Do Now?") ; will create a dialog box that when displayed is centered

    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton(" ", 50,50, 30,30)
    GUICtrlSetImage($Button_1, @DesktopDir & "\dekaron - Copy.jpg", 22)

    GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Run("C:\Program Files\GameHi_USA\GlobalDK\minilauncher.exe")    ; Will Run/Open Notepad
                
PixelSearch( 961, 677, 961, 677, 0x845136 )
If @error Then
MsgBox(0, "unlucky", "Try Again")
If Not @error Then
    Msgbox(0, "Success", "Well Done")

        
        EndSelect
    WEnd
EndFunc   ;==>Example

as you can see i need it do check the pixels till it turned to the right color

Thanks.

Edited by Noobcube
Posted

In reviewing your script, your attempting to work with a game called Dekaron.

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $Button_1, $Button_2, $msg
    GUICreate("What To Do Now?") ; will create a dialog box that when displayed is centered

    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton(" ", 50,50, 30,30)
    GUICtrlSetImage($Button_1, @DesktopDir & "\dekaron - Copy.jpg", 22) ;name of game is shown here

    GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Run("C:\Program Files\GameHi_USA\GlobalDK\minilauncher.exe")    ; Will Run/Open Notepad
                
PixelSearch( 961, 677, 961, 677, 0x845136 )
If @error Then
MsgBox(0, "unlucky", "Try Again")
If Not @error Then
    Msgbox(0, "Success", "Well Done")

        
        EndSelect
    WEnd
EndFunc   ;==>Example

The portal for this game can be found here

http://dekaron.gamehi.com/

Section 3, line 12 of the TOS of this game says BOTS are not to be used.

(12) The distribution, development, or use of any third- party software/hardware that allows for abnormal activities within the game.

for those who need to review the full TOS, look here:

http://support.gamehi.com/App/support/etc/operation_policy_04.aspx

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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