Advertisement
Guest User

AutoTouch script

a guest
Jan 23rd, 2020
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.79 KB | None | 0 0
  1. function SetUpApp()
  2.     CheckFocus()
  3.     touchDown(2, 960.17, 624.95);
  4.     usleep(89691.71);
  5.     touchUp(2, 960.17, 624.95);
  6.     usleep(4503836.54);
  7.     touchDown(4, 67.21, 200.72);
  8.     usleep(98196.83);
  9.     touchUp(4, 67.21, 200.72);
  10.     usleep(1469303.75);
  11.     touchDown(6, 576.10, 1706.20);
  12.     usleep(64698.12);
  13.     touchUp(6, 576.10, 1706.20);
  14.     usleep(2210070.67);
  15.     touchDown(1, 788.30, 2278.58);
  16.     usleep(91570.46);
  17.     touchUp(1, 788.30, 2278.58);
  18.     usleep(1653559.50);
  19.     touchDown(3, 827.67, 302.68);
  20.     usleep(80714.08);
  21.     touchUp(3, 827.67, 302.68);
  22.     usleep(1569602.25);
  23.     touchDown(5, 655.80, 494.11);
  24.     usleep(55492.96);
  25.     touchUp(5, 655.80, 494.11);
  26. end
  27.  
  28. function newClicker()
  29.     local found = false;
  30.     local loc1 = findColors({{16777215,0,0}, {16777215,-20,18}, {16777215,-41,0}}, 0, {60.11, 182.67, 51.28, 39.35});
  31.     local loc2 = findColors({{12830672,0,0}, {13619929,19,-7}, {12830672,22,4}, {13225429,33,-11}, {12830672,35,14}, {12830672,44,-10}, {12830672,56,11}, {12830672,68,-9}, {12830672,79,-10}, {12830672,94,-11}, {12830672,78,14}, {13028050,95,13}, {12830672,80,2}, {12830672,92,1}, {12830672,118,-10}, {12830672,127,14}, {12830672,138,-10}, {12830672,151,-9}, {12830672,150,12}, {12830672,169,-3}}, 0, {466.13, 1660.25, 194.38, 72.80});
  32.     local loc3 = findColors({{12830928,0,0}, {12830928,47,-1}, {12830928,11,14}, {12830928,24,26}, {12830928,34,14}, {12830928,49,51}, {12830928,-2,53}, {12830928,24,54}, {12830928,-3,28}, {12830928,23,0}, {12830928,48,25}}, 0, {749.32, 2227.61, 77.78, 77.14});
  33.     local loc4 = findColors({{16777215,0,0}, {16777215,-18,-17}, {16777215,14,-16}, {16777215,15,16}, {16777215,-17,15}}, 0, {1008.02, 139.23, 48.09, 43.42});
  34.     local loc5 = findColors({{16448250,0,0}, {16448250,32,-1}, {16448250,33,32}, {16448250,1,31}, {16448250,18,14}}, 0, {1056.58, 139.34, 62.40, 56.21});
  35.     local loc6 = findColors({{16777215,0,0}, {16777215,33,1}, {16777215,32,32}, {16777215,15,16}, {16777215,-1,33}}, 0, {1007.89, 133.43, 49.58, 52.82});
  36.     local arrLocations = {loc1, loc2, loc3, loc4, loc5, loc6}
  37.     for index, loc in ipairs(arrLocations) do
  38.         if #loc > 0 then
  39.             tap(loc[1][1],loc[1][2]);
  40.             found = true;
  41.             startTime = os.time();
  42.         end
  43.     end
  44.     return found;
  45. end
  46.  
  47. function CheckFocus()
  48.     if frontMostAppId() ~= "com.higheroven.cydhtfour" then
  49.         appActivate("com.higheroven.cydhtfour")
  50.         usleep(1000000)
  51.     end
  52. end
  53.  
  54. function DoThis()
  55.     touchDown(2, 777.75, 492.21)
  56.     usleep(86975.88)
  57.     touchUp(2, 777.75, 492.21)
  58.     repeat
  59.         if os.difftime(os.time(), startTime) > checkHowLong then
  60.             appKill("com.higheroven.cydhtfour");
  61.             usleep(3000000);
  62.             startTime = os.time();
  63.             SetUpApp();
  64.             break;
  65.         end
  66.         usleep(1000000)
  67.     until newClicker() == true
  68.     usleep(1000000)
  69.     CheckFocus()
  70. end
  71.  
  72. checkHowLong = 30; -- seconds
  73. startTime = os.time();
  74. SetUpApp()
  75. while true do
  76.     DoThis()
  77.     usleep(1000000)
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement