Advertisement
kolton

Untitled

Jan 26th, 2015
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var getGameDetails = function (index) {
  2.         /*
  3.             First screen contains up to 9 unique games.
  4.             Clicking on the scroll bar above the down arrow gets us the next screen.
  5.             First game of the next screen is the last game of the previous screen.
  6.             It appears to be that the game list never shows more than 20 games, so 3rd screen will never contain 8 unique games.
  7.             Also, that means the index will be 0-19.
  8.         */
  9.  
  10.         var gameList = ControlAction.getGameList();
  11.  
  12.         print("Target game name: " + gameList[index].gameName);
  13.  
  14.         if (index <= 8) {
  15.             // Always go from top of the list for the first screen.
  16.             getControl().click(512, 232 + 19 * index);
  17.         } else if (index <= 16) {
  18.             getControl().click(598, 378); // Scroll down
  19.  
  20.             // Go from bottom, 2nd screen contains last game on the list
  21.             if (gameList.length <= 17) {
  22.                 getControl().click(512, 403 - 19 * (gameList.length - index));
  23.             } else { // Go from top
  24.                 getControl().click(512, 232 + 19 * (index - 8));
  25.             }
  26.         } else if (index <= 19) {
  27.             getControl().click(598, 378); // Scroll down
  28.             getControl().click(598, 378); // Scroll down
  29.  
  30.             // Go from bottom, 3rd screen always has less than 8 unique games, assuming there's never more than 20 games total.
  31.             getControl().click(512, 403 - 19 * (gameList.length - index));
  32.         }
  33.  
  34.         // Check whether the correct game was clicked. If not, return false. This means the game list got refreshed in the meantime.
  35.         if (getControl(1, 432, 148, 155, 20).text !== gameList[index].gameName) {
  36.             return false;
  37.         }
  38.  
  39.         delay(2000);
  40.  
  41.         return ControlAction.getText(4, 609, 393, 143, 194);
  42.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement