Errores varios al compilar (detallados)
Publicado: 18 Feb 2014, 22:50
Hola este es mi bot para capturar movimientos en pantalla, pero tengo problemas al compilar y hacerlo funcionar.
Func get_moves($num)
Local $moves[$num]
For $i = 0 to ($num-1)
Local $left = 0, $right = 0, $up = 0, $down = 0
While 1
PixelSearch($start_x+64-12, $start_y+32, $start_x+64-12, $start_y+32, 0x282806, 20 , 1)
If Not(@error) Then
; left or right
$left = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xE0D75E, 40, 1, $wiz_han)
If @error Then
Dim $right[2] = (0, 0)
EndIf
ExitLoop
EndIf
PixelSearch($start_x+32, $start_y+64-12, $start_x+32, $start_y+64-12, 0x282806, 20, 1, $wiz_han)
If Not(@error) Then
; up or down
$up = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xFFED27, 40, 1, $wiz_han)
If @error Then
Dim $down(2) = (0, 0)
EndIf
ExitLoop
EndIf
WEnd
If IsArray($left) Then
$moves($i) = "left"
ElseIf IsArray($right) Then
$moves($i) = "right"
ElseIf IsArray($up) Then
$moves($i) = "up"
ElseIf IsArray($down) Then
$moves($i) = "down"
EndIf
ConsoleWrite($moves($i)) & @CRLF)
Sleep(350)
Next
Return $moves
EndFunc
Cuando presiono CTRL+F5 me sale:
error: get_moves(): undefined function.
warning: $wiz_han: possibly used before declaration.
$left = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xE0D75E, 40, 1, $wiz_han)
error: syntax error
Dim $right[2] = (
~~~~~~~~~~~~~~~~~~~^
error: unbalanced paranthesis expression.
Dim $right[2] = (0,
A ver si me pueden orientar, estaba pensando en sacar esos DIM de ahi, pero no se como hacer entonces para tomar los movimientos de arriba y abajo por separado.
Func get_moves($num)
Local $moves[$num]
For $i = 0 to ($num-1)
Local $left = 0, $right = 0, $up = 0, $down = 0
While 1
PixelSearch($start_x+64-12, $start_y+32, $start_x+64-12, $start_y+32, 0x282806, 20 , 1)
If Not(@error) Then
; left or right
$left = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xE0D75E, 40, 1, $wiz_han)
If @error Then
Dim $right[2] = (0, 0)
EndIf
ExitLoop
EndIf
PixelSearch($start_x+32, $start_y+64-12, $start_x+32, $start_y+64-12, 0x282806, 20, 1, $wiz_han)
If Not(@error) Then
; up or down
$up = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xFFED27, 40, 1, $wiz_han)
If @error Then
Dim $down(2) = (0, 0)
EndIf
ExitLoop
EndIf
WEnd
If IsArray($left) Then
$moves($i) = "left"
ElseIf IsArray($right) Then
$moves($i) = "right"
ElseIf IsArray($up) Then
$moves($i) = "up"
ElseIf IsArray($down) Then
$moves($i) = "down"
EndIf
ConsoleWrite($moves($i)) & @CRLF)
Sleep(350)
Next
Return $moves
EndFunc
Cuando presiono CTRL+F5 me sale:
error: get_moves(): undefined function.
warning: $wiz_han: possibly used before declaration.
$left = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xE0D75E, 40, 1, $wiz_han)
error: syntax error
Dim $right[2] = (
~~~~~~~~~~~~~~~~~~~^
error: unbalanced paranthesis expression.
Dim $right[2] = (0,
A ver si me pueden orientar, estaba pensando en sacar esos DIM de ahi, pero no se como hacer entonces para tomar los movimientos de arriba y abajo por separado.