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