4

I am trying to code a bot to automate some tasks on a videogame with JS and Node, so far I've been using RobotJS. The problem I'm facing is that I need to find something on the screen as it moves from time to time to then click on it. Something similar to PyAutoGUI locateOnScreen() function.

It needs to use AI to have some tolerance too, as the image will not be exactly the same from time to time, though it's almost the same so I think any basic AI for image recognition would detect it fine.

Does anyone have an idea on what to use for this specific case?

Oscar Arranz
  • 631
  • 2
  • 9
  • 23
  • You could invoke a python script from NodeJS using a child process, see https://stackoverflow.com/questions/23450534/how-to-call-a-python-function-from-node-js – KyleRifqi Feb 11 '22 at 10:26
  • @KyleRifqi In this case it doesn't make much sense as it is a pretty small bot and I could just code it in Python then, but I want to know if there are any NodeJS libraries similar to PyAutoGUI with image recognition as I haven't been able to find one. Thanks anyways! – Oscar Arranz Feb 11 '22 at 10:29

1 Answers1

1

Try this package called node-moving-things-tracker. I have been using it reliably for a while. It is being actively maintained. Data outputs are well-organized and interpretable. There are a few examples here: https://www.npmjs.com/package/node-moving-things-tracker

  • 1
    Thanks! I also want to add that I found a package similar to pyautogui called Nut.js https://nutjs.dev/ though it doesn't work as good as pyautogui, I'll take a look at yours and will mark this question as solved. – Oscar Arranz Mar 03 '22 at 10:26