分享一个手游脚本源码

目的

给大家接触手游模拟脚本的一个样板,支持多分辨率适配
脚本功能为批量送体力给好友,功能简单

源码 lua

--版本
--[[
	此脚本功能
	日期
	制作
--]]


function IniScript()
	VERSION="1.2"
end 

function ReadUI()
	local  isNomal = false
	setmetatable(_G, {
		__index = function (_, n)
			error("attempt to read undeclared variable "..n, 2)
		end,
	})
end

function ScriptMain()	
	if  (math.abs( screenX/screenY - 9/16) < 0.01)  then
		送体力480854()
	elseif  ( math.abs( screenX/screenY - 3/5) < 0.01)  then
		送体力480800()	
	end
end

function 送体力480854()
	WriteLog(" 送体力开始",1)
	while true do
		KeepCapture() 
		local intX,intY = FindMultiColBGR(82,357,370,359,"06BB37","0|1|06BB37,0|2|06BB37,0|3|06BB37,0|19|11BE42,-5|15|29CE3B,9|15|0EFCB5",4,0.9)
		--体力上限查找
		if intX > -1 and intY > -1 then 
			RndTap(intX, intY) 
			for i=1,10 do
				KeepCapture() 
				local Tmp_ret,intX,intY = FindColBGR(329,430,358,500,"FFFFFF",0,0.9)
				if intX > -1 and intY > -1 then 
					WriteLog("体力已上限",1)
					return true
				elseif CmpColBGR("112|298|2C8F00,114|547|2A7CBE,369|361|332312,390|363|614006", 0.9)==1 then
					break
				end
				Delay(300)
			end
		elseif CmpColBGR("112|298|2C8F00,114|547|2A7CBE,369|361|332312,390|363|614006", 0.9)==1 then 
			RndTap(123, 273) 
			WriteLog("下次吧")
		elseif CmpColBGR("225|109|944210,272|111|EBB13D,256|120|FFFBEB,219|108|9E4412", 0.9)==1 then 
			RndTap(253,119) 
			WriteLog("首页")
			Delay(1300)
		else
			Swipe(99,248,337,248,1500)
		end
		Delay(200)
	end	
end

function 送体力480800()
	--WriteLog(" 送体力开始",1)
	while true do
		KeepCapture() 
		local intX,intY = FindMultiColBGR(82,357,370,359,"06BB37","0|1|06BB37,0|2|06BB37,0|3|06BB37,0|19|11BE42,-5|15|29CE3B,9|15|0EFCB5",4,0.9)
		if intX > -1 and intY > -1 then 
			RndTap(intX, intY) 
			for i=1,10 do
				KeepCapture() 
				local Tmp_ret,intX,intY = FindColBGR(329,446,358,513,"FFFFFF",0,0.9)
				if intX > -1 and intY > -1 then 
					WriteLog("体力已上限",1)
					return true
				elseif CmpColBGR("114|246|2F9200,111|285|2C8F00,116|471|2B7DBF,114|546|2A7CBE", 0.9) == 1 then
					RndTap(123, 246) 
					break
				end
				Delay(500)
			end
		elseif CmpColBGR("114|246|2F9200,111|285|2C8F00,116|471|2B7DBF,114|546|2A7CBE", 0.9) == 1 then 
			RndTap(123, 246) 
			WriteLog("下次吧")
		elseif CmpColBGR("225|109|944210,272|111|EBB13D,256|120|FFFBEB,219|108|9E4412", 0.9) == 1 then 
			RndTap(253,119) 
			WriteLog("首页")
			Delay(1300)
		else
			Swipe(99,248,337,248,1500)
		end
		Delay(200)
	end	
end

MoveWindow(0,0)
IniScript()
ReadUI()
ScriptMain()
ExitEx()

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

骇客之技术

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值