前几天用wr写了一个背包的蓝绿装自动分解,用魔蜂的时候心血来潮也想写一个,昨晚想了一会发现有几个不会的问题,求助一下论坛里的大佬,有没有什么好的思路,研究一下,各位勿喷。下面上代码:
[AppleScript] 纯文本查看 复制代码
if(slotindex>16)
then slotindex=1 end
print(bagid)
print(slotindex)
local q=GetContainerItemLink(bagid,slotindex)
if(q==nil)
then
slotindex=slotindex+1
else
if(q:sub(5,10)=="1eff00" or q:sub(5,10)=="0070dd" )
then
if BeeUnitCastSpellName("player")=="分解" then return;end
BeeRun("/cast 分解");
UseContainerItem(bagid,slotindex)
end
end
if BeeUnitCastSpellName("player")=="分解" then return;end
if(q~=nil)
then
slotindex=slotindex+1
end
说明一下这个代码暂时只有第一个背包循环,残血版。而且没有加入是否是装备的判断,还有问题没解决就暂时没写。
代码里的全局变量是在另一个脚本里面,就没有贴出来了。下面说问题:
问题1:分解的时候有时候会把装备换上去,我觉得是不是运行速度太快,需要再放分解之后加一个延时。
问题2:全局变量怎么赋值一次就不去改变了。因为那个变量(bagid,slotindex)需要累加去循环背包格子
或者各位大佬有没有更好的思路,望各位大佬不吝赐教。
|