Yes, it sounds like your current program is a pixelbased bot. Your gona need a bot that uses a different method such as the ones i posted before. Pixelbased searches pixels in the current window, which would be your game. It will scan for changes in pixels, like the colour of your health. Where it will detect a change from red to black or something and then use a potion. Memory read bots monitors addresses (which u would have used in cheat engine) and scans changes in the value. So even if the game window isnt open, it will still read that the HP value has gone from 100 to 50 or something..
So yes you will need a different program