A bot for playing Flash Player in Python

There is an online game in the Flash Player, play it through the browser window. The game is simple - depending on the images you need to click on the corresponding buttons, without any complex mouse movements and without a keyboard at all. I need to write a bot for it in Python (I only know it). I've never done this before, so I see one option: take screenshots of all the necessary images from the game in the appropriate coordinates, use pyscreenshot to do this; write the code for the actual game; use autopy to move the mouse and click in the necessary places.

Question: Is this a normal approach? Possible?

Or try other options, try to find the API of this game, or how else do they write such bots?

The game is online, there are other players involved, the site will notice any interference 100%, and the option with screenshots can be lit (in the sense of using a bot) only by "inhuman" mouse movements. But this can be easily circumvented, adding random movements.

So, is this a working approach? Maybe someone has information\guide about this?

2 answers

With bots for flash games, you need to dig a little. I can't say anything about Phyton - it's a specific language. But you can write a bot to write a bot in ActionScript .

Inside the flash app, all the animation elements and buttons are organized into a tree of elements. It is very similar to the DOM tree in a web page: you can easily find any element in the tree, for example, a button; you can find out what color the button is, whether it is visible; you can easily find out its coordinates. Access to flash You can access the application from a third-party application via PreloadSwf.

The bottom line is this - you install the flash debug version , in the windows user folder, add the mm.cfg config . In the config, specify the parameter:

PreloadSwf=C:/путькswf/PreloadSwf.swf

And before downloading absolutely any flash drive in the browser, for example: PreloadSwf.swf will load . And it will have full access to the application: it will be able to iterate through the tree of elements, it will be able to emulate clicks or clicks keys.

Accordingly, you write PreloadSwf yourself, inside before loading you check for formal parameters like the name: whether this is the game. If yes, launch the bot.

The popular debugging plugin flashfirebug{[2] is based on the same principle of preloadswf]}

 1
Author: Гончаров Александр, 2018-09-04 19:25:16

Computer vision will help you recognize images cv2 Clicking on them with the mouse will help pyautogui

 1
Author: Интик, 2020-05-02 06:14:51