SUB(action, $lg)
LOGWRITE($lg)
DBLCLICK($_return1 + RND(10,20),$_return2 + RND(10,20))
WAITMS(100)
DBLCLICK($_return1 + RND(10,20),$_return2 + RND(10,20))
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(125,135))
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(90,100))
WAITMS(100)
END_SUB
$check4 = 0
WHILE($check4 = 0)
GETSCREEN
COLORMODE(7)
$con2 = PXLCOUNT ($korwx - 128,$korwy + 388, $korwx - 95,$korwy + 421, 8355711)
IF($con2 = 1156)
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(125,135))
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(90,100))
WAITMS(100)
LCLICK($korwx + RND(120,150), $korwy + RND(455,466))
LOGWRITE ("Пусто")
ELSE
LOGWRITE ("поиск атаки")
IF_PICTURE_IN ($korwx - 142,$korwy + 340, $korwx - 82,$korwy + 440, "куба.bmp", -1, 100)
action("атака")
ELSE
LOGWRITE ("поиск защиты")
IF_PICTURE_IN ($korwx - 142,$korwy + 340, $korwx - 82,$korwy + 440, "кубз.bmp", -1, 100)
action("защита")
ELSE
LOGWRITE ("поиск 10+")
IF(PXL($korwx + 217, $korwy + 119) = 16777215)
$check4 = 1
WAITMS(200)
ELSE
IF_PIXEL_IN($korwx + 232,$korwy + 116, $korwx + 243,$korwy + 125, 8355839)
$check4 = 1
WAITMS(200)
ELSE
LOGWRITE ("добиваем")
WAITMS(500)
DBLCLICK($korwx + RND(225,235),$korwy + RND(90,100))
WAITMS(400)
LCLICK($korwx + RND(120,150), $korwy + RND(455,466))
WAITMS(1900)
END_IF
END_IF
END_IF
END_IF
END_IF
END_CYC
Или что ты хотел уменьшить? Если хотел уменьшить вложенность в одном месте, то
SUB(action, $lg, $pic)
$act = 1
LOGWRITE("поиск '", $lg, "'")
IF_PICTURE_IN ($korwx - 142,$korwy + 340, $korwx - 82,$korwy + 440, $pic)
LOGWRITE($lg)
DBLCLICK($_return1 + RND(10,20),$_return2 + RND(10,20))
WAITMS(100)
DBLCLICK($_return1 + RND(10,20),$_return2 + RND(10,20))
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(125,135))
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(90,100))
WAITMS(100)
ELSE
$act = 0
END_IF
END_SUB
SUB(find_10plus)
LOGWRITE("поиск 10+")
IF(PXL($korwx + 217, $korwy + 119) = 16777215)
$check4 = 1
WAITMS(200)
ELSE
IF_PIXEL_IN($korwx + 232,$korwy + 116, $korwx + 243,$korwy + 125, 8355839)
$check4 = 1
WAITMS(200)
ELSE
LOGWRITE("добиваем")
WAITMS(500)
DBLCLICK($korwx + RND(225,235),$korwy + RND(90,100))
WAITMS(400)
LCLICK($korwx + RND(120,150), $korwy + RND(455,466))
WAITMS(1900)
END_IF
END_IF
END_SUB
$check4 = 0
WHILE($check4 = 0)
GETSCREEN
COLORMODE(7)
$con2 = PXLCOUNT ($korwx - 128,$korwy + 388, $korwx - 95,$korwy + 421, 8355711)
IF($con2 = 1156)
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(125,135))
WAITMS(100)
DBLCLICK($korwx + RND(225,235),$korwy + RND(90,100))
WAITMS(100)
LCLICK($korwx + RND(120,150), $korwy + RND(455,466))
LOGWRITE("Пусто")
ELSE
action("атака", "куба.bmp")
IF($act = 0)
action("защита", "кубз.bmp")
IF($act = 0)
find_10plus()
END_IF
END_IF
END_IF
END_CYC