Jump to content

Recommended Posts

Posted (edited)

Here is part of my code of two functions. For some reason, the while loop freezes inside a full screened game unless I minimize the game.

Func CheckLogin()
    $login = "-1"
    While $login <> "0"
        MouseClick("left",731,53)
        MouseClick("left",0,0)
        If CheckLogin2()="1" Then
            MouseClick("left",680,683)
            StartGame()
            $login = "0"
        ElseIf CheckLogin2()="2" Then
            Send("{ENTER}{ENTER}")
        ElseIf CheckLogin2()="3" Then
            MouseClick("left",680,683)
            StartGame()
            $login = "0"
        ElseIf CheckLogin2()="4" Then
            SelectCharacter()
            $login = "0"
        EndIf
    WEnd
EndFunc

Func CheckLogin2()
    If PixelChecksum(558,490,598,508,1)="3517004610" Then 
        Return 1
    ElseIf PixelChecksum(0,911,89,945)="166012633" Then
        Return 2
    ElseIf PixelChecksum(0,911,89,945)="976319356" Then 
        Return 3
    ElseIf PixelChecksum(99,120,99,120)="45220162" Then 
        Return 4
    EndIf
EndFunc
Edited by Kero
Posted

when the window is full screen, do you still have the start bar, or is it hidden? If it is hidden, you may need to debug by writting to console to see what is happening.

I see no bar. I made a GUICtrlCreateEdit that output things I wrote in the program. The problem I found is that the while loop freezes until I focus that GUICtrlCreateEdit window.
Posted (edited)

I changed this a bit of the code, it still seems to freeze unless I press the gui window.

Func CheckLogin()
    $login = "-1"
    
    While $login <> 0
        Addstatus("Checking Login")
        
        $login = CheckLogin2()
        
        If $login="1" Then
            MouseClick("left",680,683)
            StartGame()
            $login = "0"
        ElseIf $login="2" Then
            Send("{ENTER}{ENTER}")
        ElseIf $login="3" Then
            MouseClick("left",680,683)
            StartGame()
            $login = "0"
        ElseIf $login="4" Then
            SelectCharacter()
            $login = "0"
        EndIf
    WEnd
EndFunc

Func CheckLogin2()
    AddStatus("CheckLogin2()")
    If PixelChecksum(558,490,598,508,1)="3517004610" Then
        AddStatus("1")
        Return 1
    ElseIf PixelChecksum(0,911,89,945)="166012633" Then
        AddStatus("2")
        Return 2
    ElseIf PixelChecksum(0,911,89,945)="976319356" Then
        AddStatus("3")
        Return 3
    ElseIf PixelChecksum(99,120,99,120)="45220162" Then
        AddStatus("4")
        Return 4
    Else
        AddStatus("-1")
        Return -1
    EndIf
EndFunc
Edited by Kero
Posted

try using message boxes at intervals... if possable... i didnt really go through all your code i dont have time, but thats what i do, or make tooltips... like i did with this nifty prog...

do
$pos = MouseGetPos()
$color = PixelGetColor ( $pos[0] , $pos[1] )
ToolTip ( $pos[0] & "," & $pos[1] & @LF & $color );, $pos[0] , $pos[1] )
until 1 = 2

Just shows the mouse pos and color, but you get the idea. Anyways, i really need to get going, but i hope this helps...

Posted (edited)

heh, aonlan i guess ? 8) anyways its pretty hard to say just w/ partial code.

i could help you out if your willing to give me your source, as i dont have anything better to do atm (:

if no, then you should use msgboxes / tooltips to find out where it stucks as suggested above.

:edit

played around a bit, this wont get stuck unless all pixelchecksums are different from set values or SelectCharacter/StartGame funcs are stuck 8)

MsgBox(0, "test", CheckLogin())

Func CheckLogin()
    Local $Login
    Local $Return
    
    While 1
        MouseClick("left",731,53)
        MouseClick("left",0,0)
        $Login = CheckLogin2()
        Select
            Case $Login = 1
                MouseClick("left",680,683)
                StartGame()
                $Return = "StarGame func executed, $Login was = " & $Login
                ExitLoop
                
            Case $Login = 2
                Send("{ENTER}{ENTER}")
            
            Case $Login = 3
                MouseClick("left",680,683)
                StartGame()
                $Return = "StarGame func executed, $Login was = " & $Login
                ExitLoop
            
            Case $Login = 4
                SelectCharacter()
                $Return = "SelectCharacter func executed, $Login was = " & $Login
                ExitLoop
                
            Case Else
                Sleep(100); CheckLogin2 returned 0, PixelChecksums <> set values
        EndSelect
    WEnd
    Return $Return
EndFunc

Func CheckLogin2()
    Select
        Case PixelChecksum(558,  490, 598, 508, 1) = "3517004610"
            Return 1
        
        Case PixelChecksum(0, 911, 89, 945) = "166012633"
            Return 2
        
        Case PixelChecksum(0, 911, 89, 945) = "976319356"
            Return 3
        
        Case PixelChecksum(99, 120, 99, 120) = "45220162"
            Return 4
        
        Case Else 
            Return 0
    EndSelect
EndFunc
Edited by julmae
Posted

Whats the game?

If screen colors are nop exactly the same each time then pixelchecksum will fail and thus a endless loop.

What is addstatus?

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
  • Recently Browsing   0 members

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