Jump to content

My code has problem ... Help me check it


BlackCat
 Share

Recommended Posts

Here is information box error:

Line 5 (File"C:\Ddocuments and Setting\Administrator\Desktop\auto ttk.au3"):

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> $hpcolor

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> ^ERROR

Error:Variable used without being declared.

---Line 5 (File"C:\Ddocuments and Setting\Administrator\Desktop\auto ttk.au3"):

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> $hpcolor

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> ^ERROR

Error:Variable used without being declared.

---------------------------

Here is my code:

; This is my firt script about auto Thuan Thien Kiem

MsgBox ( 64, "Auto Thuan Thien Kiem", "Ban muon su dung?" , 1000 )

While 1

Select ; Select the firt correct case, first r hp and mp so that you dont die

Case "0x" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> $hpcolor

Rechargehp()

Case "0x" &Hex ( PixelGetColor ( 120 , 107 , 6 ) <> $mpcolor

Rechargemp()

Case "0x" &Hex ( PixelGetColor ( 120 , 107 , 6 ) <> $Selectedmob

Autoattackmob()

Case Else

Selectmob()

EndSelect

Sleep ( 100 )

WEnd

Func Rechargehp()

Send ( "{1}" )

EndFunc

Func Rechargemp()

Send ( "{2}" )

EndFunc

Func Autoattackmob()

Send ( "{3}" )

Do

Sleep ( 100 )

If "0x" &Hex ( PixelGetColor ( 119 , 18 , 6 ) <> $hpcolor Then

Rechargehp()

Sleep ( 500 )

Send ( "{3}" )

ElseIf "0x" &Hex ( PixelGetColor ( 120 , 107 , 6 ) <> $mpcolor Then

Rechargemp()

Sleep ( 500 )

Send ( "{3}" )

EndIf

Until "0x" &Hex ( PixelGetColor ( 34 , 24 , 6 ) <> $SelectedmobHP

EndFunc

Func Selectmob()

Do

$coord = PixelSearch ( 0, 0, 20, 30, 0xFF0000 )

Until IsArray ( $coord )

MouseClick ( "", $coord [0], $coord [1] )

EndFunc

---------------------------

Help me check it, please

Link to comment
Share on other sites

Here is information box error:

Line 5 (File"C:\Ddocuments and Setting\Administrator\Desktop\auto ttk.au3"):

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> $hpcolor

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> ^ERROR

Error:Variable used without being declared.

---Line 5 (File"C:\Ddocuments and Setting\Administrator\Desktop\auto ttk.au3"):

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> $hpcolor

Case "ox" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> ^ERROR

Error:Variable used without being declared.

---------------------------

Here is my code:

; This is my firt script about auto Thuan Thien Kiem

MsgBox ( 64, "Auto Thuan Thien Kiem", "Ban muon su dung?" , 1000 )

While 1

Select ; Select the firt correct case, first r hp and mp so that you dont die

Case "0x" & Hex ( PixelGetColor ( 119 , 18 , 6 )) <> $hpcolor

Rechargehp()

Case "0x" &Hex ( PixelGetColor ( 120 , 107 , 6 ) <> $mpcolor

Rechargemp()

Case "0x" &Hex ( PixelGetColor ( 120 , 107 , 6 ) <> $Selectedmob

Autoattackmob()

Case Else

Selectmob()

EndSelect

Sleep ( 100 )

WEnd

Func Rechargehp()

Send ( "{1}" )

EndFunc

Func Rechargemp()

Send ( "{2}" )

EndFunc

Func Autoattackmob()

Send ( "{3}" )

Do

Sleep ( 100 )

If "0x" &Hex ( PixelGetColor ( 119 , 18 , 6 ) <> $hpcolor Then

Rechargehp()

Sleep ( 500 )

Send ( "{3}" )

ElseIf "0x" &Hex ( PixelGetColor ( 120 , 107 , 6 ) <> $mpcolor Then

Rechargemp()

Sleep ( 500 )

Send ( "{3}" )

EndIf

Until "0x" &Hex ( PixelGetColor ( 34 , 24 , 6 ) <> $SelectedmobHP

EndFunc

Func Selectmob()

Do

$coord = PixelSearch ( 0, 0, 20, 30, 0xFF0000 )

Until IsArray ( $coord )

MouseClick ( "", $coord [0], $coord [1] )

EndFunc

---------------------------

Help me check it, please

As Zedna says, but I think you are also confused by numbers when they are represented in different ways.

A number is a number and not a string. A number can be represented in various ways using any number base you like but they all equate to the same number. Because colors are made up of three primary colours which are multiplied by 1, 256 and 256x256 and added together, they are conveniently represented using hexidecimal notation. But the number is the same number whether it's in decimal or hex or binary. So it's quite alright to have

$hpcolor = 0x00000f
If $hpcolor = 15 then step3()

But you shouldn't try to compare a string to a number, so

if 15 = '0x' & hex(15) then step1()

is not going to run step1 ever because the value of '0x...' will always equate to 0 which is the starting digits of the string.

You could cinvert the string to a number -

If 15 = Number('0x' & Hex(15)) ...

but there no need because you can simply compare two numbers and not worry about whether they are decimal or not. 5 (decimal) apples are the same number of apples as 101 (binary) and the same number as 0X000005.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...