戦闘を考える(その3)

プラン終了待ちの後をフォロー忘れてました
ささっと簡単に済ませてしまいましょう

		while true	//戦果表示待ち
			ifb chkimgx("result.bmp",NOXid,1,150,250,300,1,5,-1) then
print "Show Result"
				break
			endif
		sleep(2)
		wend
		P_adb_BTN(G_IMGX_X ,G_IMGX_Y ,1000 ,"Result_1")	//初回結果画面
		tim = gettime() + 60	//経過観察用
		while true	//戦果表示待ち、ドロップ無しのケースを一応考慮する
			ifb chkimgx("doll_get.bmp",NOXid) then
				break
			elseif tim < gettime() then	//タイムオーバー(ドロ無)
				break
			endif
		sleep(2)
		wend
		ifb tim > gettime() then	//タイムオオーバー前=画像確認してるのでクリックして進める
			P_adb_BTN(G_IMGX_X ,G_IMGX_Y ,1000 ,"Doll_get")	//ドロップ
		endif
		while true	//戦果表示待ち
			ifb chkimgx("result.bmp",NOXid,1,150,250,300,1,5,-1) then
				break
			endif
		sleep(2)
		wend
		P_adb_BTN(G_IMGX_X ,G_IMGX_Y ,1000 ,"Result_2")	//2回目結果画面

		formation = true
		repair = true	//戦闘したら修復フラグ立てる
		loop = loop +1
		G_count = G_count + 1
	endif
	sleep(3)

あとは次回周回までの準備用各種フラグを立ててループに戻ります
ごくごく稀に最終戦果で人形落ちないことがあるので60秒のタイムアウトを設けています