Fun piece of code! You’re right; having the genie , I would also click it, just like most real players would. I’m not sure if you already have all the necessary widgets, but if not, let me know, and I can post them here if you respond to this post.
However, the code doesn’t consider who the genie is targeting. You’ll end up in an endless loop, trying to interact with the genie until it dissolves into thin air when the timer runs out.
Add some code to check if the genie is interacting with the player. You could maybe check the text, extract the name from the genie’s message, and see if it matches the current player. I’ll take a look at my code to see how I handled it.
Great snippet, keep it up!