Jump to content
Sign in to follow this  
thenewkid

need some help with my code

Recommended Posts

thenewkid

Hi if u have a few min and dont mind looking over my code and telling me whats wrong it would mean a lot theres a erorr in there some where and i dont know how to fix it thanks

Func init()
    Local $X, $Y, $Z, $A

    WinActivate("Magic Online V2")

    If @DesktopDepth < 24 Then
        
        _ShowError( "Your color depth should be 24bit or 32bit")
    EndIf

    If @DesktopHeight > 768 And @DesktopWidth > 1024 Then

        WinMove( "Magic Online V2", "", 0, 0, 1024, 755)

        $Y = 0
        While PixelGetColor(500, $Y) <> 0
            $Y = $Y + 1
        WEnd

;~  721

        $X = 0
        While PixelGetColor($X, $Y) <> 0
            $X = $X + 1
        WEnd

        $Z = $Y + $X

        $Y = $Y - 19

        WinMove( "Magic Online V2", "", -$X, -$Y, 1024 + 2 * $X, 721 + $Z)

    Else

        WinSetState( "Magic Online V2", "", @SW_MAXIMIZE)

        $A = WinGetClientSize( "Magic Online V2")
        
        If $A[0] <> 1024 Or $A[1] <> 721 Then
            _ShowError( "There's an error on your system configuration." & @CRLF & @CRLF & "If you can't solve the problem, please send the latest screenshot at " & @CRLF & """" & @ScriptDir & "\support"" to cammy-14@hotmail.co.uk")
        EndIf

    EndIf

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Share this post


Link to post
Share on other sites
Valuater

You didn't state the actual problem..

but this,,

While PixelGetColor(500, $Y) <> 0

$Y = $Y + 1

WEnd

will never end until it crashes...

this is the same

While PixelGetColor($X, $Y) <> 0

$X = $X + 1

WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
thenewkid

o srry the erorr is in the bit

If $A[0] <> 1024 Or $A[1] <> 721 Then
;  ^ here

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Share this post


Link to post
Share on other sites
tresa

o srry the erorr is in the bit

$A = WinGetClientSize( "Magic Online V2")
 If $A[0] <> 1024 Or $A[1] <> 721 Then
;  ^ here
the WinGetClientSize returns 0 if the window is'nt found. With 0 the array dos'nt exists anymore so AutoIt says there cannot be a subscript.

To avoid this test the @error to 0 and do the if only in this case. If @error<>0 you have to write what you'll do

$A = WinGetClientSize( "Magic Online V2")
if @error=0 then
      If $A[0] <> 1024 Or $A[1] <> 721 Then
          ....
      EndIf
else
     ...
EndIf
Edited by tresa

Share this post


Link to post
Share on other sites
Thatsgreat2345

could also be done using Isarray

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.