分享

自动喊话脚本源码,适用各种游戏脚本精灵

 落墨凝红颜 2016-05-31
  1. -----------------------------------------------------------------------
  2. -- 本文件为脚本入口文件,请不要删除
  3. -- 该脚本适用于脚本精灵2.0.1及以上版本
  4. -- 脚本从main()开始执行
  5. -- 脚本界面从createUI()开始执行,脚本可以无界面
  6. -----------------------------------------------------------------------

  7. -- 创建脚本界面入口
  8. function createUI()
  9.         showLoopSetting(false)
  10.         createTextView('plocation', '烈火遮天喊话,魔游游 大神作品');newLine()
  11.         createTextView('myy', 'bbs.moyoyo.com');newLine()
  12.         createTextView('info', '输入喊话内容,多句喊话内容用“=”等号隔开');newLine()
  13.         createEditText('content','',MATCH_PARENT,MATCH_PARENT);newLine()
  14.         createTextView('time','输入喊话间隔时间(秒)');newLine()
  15.         createEditText('inter_time','',MATCH_PARENT,MATCH_PARENT);newLine()
  16. end

  17. clarity=90

  18. local w,h = getResolutionRatio()
  19. if w==720 and h==1280 then
  20.         a,b=580,560                --输入框
  21.         x,y=580,870        --发送       
  22. else
  23.         toast('暂不支持此分辨率')
  24.         sleep(3000)
  25.         exit();
  26. end


  27. function main()
  28.         timespace=inter_time*1000                --时间间隔
  29.         str1={}
  30.         str1=split(content,'=')
  31.         repeat
  32.                 for i, v in pairs(str1) do  
  33.                         touchClick(a,b)                -- 喊话框的位置,点击激活
  34.                         sleep(500)
  35.                         deleteText(100,100)
  36.                         sleep(500)
  37.                         if i==1 then
  38.                                 input(v..'-魔游游')               
  39.                         else
  40.                                 input(v)                                               
  41.                         end
  42.                         --输入喊话内容
  43.                         sleep(1000)
  44.                         inputDone()
  45.                         sleep(1000)
  46.                         touchClick(x,y)
  47.                         --点击发送
  48.                         sleep(timespace)
  49.                         --喊话间隔时间
  50.                 end
  51.         until false
  52. end

  53. function split(str, pat)
  54.         local t = {}
  55.         local fpat = '(.-)' .. pat
  56.         local last_end = 1
  57.         local s, e, cap = str:find(fpat, 1)
  58.         while s do
  59.                 if s ~= 1 or cap ~= '' then
  60.                 table.insert(t,cap)
  61.                 end
  62.                 last_end = e 1
  63.                 s, e, cap = str:find(fpat, last_end)
  64.         end
  65.         if last_end <= #str then
  66.                 cap = str:sub(last_end)
  67.                 table.insert(t, cap)
  68.         end
  69.         return t
  70. end

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多