Evan
Evan - 认证专家

注册于 5年前

回答
310
文章
36
关注者
39

你是不是代码里面写了table=xxx之类的代码把table给覆盖了

--[[/var/touchelf/1.txt
111--222---111
112--222---111
113--222---111
]]
function main()
    data = file.readTable("/var/touchelf/1.txt")
    data[1] = data[1].."----完成"
    data[2] = data[2].."----失败"
    data[3] = data[3].."----完成"
    flag,err = file.writeTable("/var/touchelf/1.txt",data);
    if flag then
        sys.dialog("文件写入Table成功")
    else
        sys.log(err)
        sys.dialog("文件写入Table失败")
    end
end

写个文本.做完任务写入个内容,执行日常任务的时候判断文本内容

function main()
  sys.exec("zip -q -r /var/touchelf/scripts.zip /var/touchelf/scripts")
end

将/var/touchelf/scripts下的脚本打包成scripts.zip

如果无法使用需要在cydia中安装zip插件
image.png

安卓系统各个厂家修改的版本太多,无法一一适配,如果无法正常使用就是没适配

登录提示登录超时,请重新登录,原因是本地电脑与服务器时间不符导致,同步本地电脑时间即可,同步完依旧提示登录超时请尝试重新启动控制中心或重启电脑.

支持的.手册触摸模块里面的滑动下面有例子

function main()
  math.randomseed(tostring(os.time()):sub(5):reverse()); -- 随机种子
  x, y = screen.findImage("/var/touchelf/a.png");--这里是描述中的检测到图片
  if x ~= -1 and y ~= -1 then
    act = math.random(1, 2); --这里是随机
    if act == 1 then
      fight1()
    elseif act == 2 then
      fight2()
    end
  end
end
function fight1()
  --自动打怪1
end
function fight2()
  --自动打怪2
end

升级触摸至最新版并使用触摸自带的httppost那段代码

问题1:

function main()
  while true do
    local t = os.date("*t",net.time())
    if t.hour >= 8 then 
      --执行任务
    else
      sys.sleep(5000)
    end
  end
end

上面代码有一个问题就是只要是超过8点就会执行,建议写一个变量用来记录今天已经执行过了

function main()
  local work = false
  while true do
    local t = os.date("*t",net.time())
    if t.hour >= 8 and not work then 
      --执行任务
      work = true
    elseif t.hour < 8 and work then 
      --当时间小于8点的时候重置任务
      work = false
    else
      sys.sleep(5000)
    end
  end
end

问题2:

function main()
  local worktime = 0
  while true do
    --判断任务时间
    if os.time() >= worktime + 3*60*60  then 
      --执行任务
      --执行完后记录任务完成时间
      worktime = os.time()
    else
      sys.sleep(5000)
    end
  end
end

发布
问题