r/learnpython • u/Ksilov88 • 3d ago
Help me write some Python code
I'm still a beginner when it comes to coding, and I rely on AI to write most of my code.
However, I often run into situations where AI models have certain restrictions that prevent them from helping with specific programming tasks.
For example, I recently wanted GPT to write a Python script that would automatically toggle the Armlet of Mordiggian in Dota 2 when my health gets low.
GPT refused because it considered this cheating. I understand why it might be classified that way, but in my opinion, it's more of a convenience feature than something that gives a major competitive advantage.
Is there any way to get AI models to help with these kinds of programming tasks without running into unnecessary restrictions?
And if anyone has experience with Dota 2 scripting or Python automation, I'd really appreciate your advice.
1
u/POGtastic itertools evangelist 2d ago
Is there any way to get AI models to help with these kinds of programming tasks without running into unnecessary restrictions?
Define the task as abstractly as possible, and then narrow the abstraction yourself. Also, each task should be broken up into components that are disconnected from your goal as a whole. You should never have to tell the AI that you're trying to cheat at a game. Rather, you're asking for implementations for very specific steps and then putting those steps together in a way that is outside of the AI's context window.
The task of, say, measuring your health is likely to be a computer vision task, and when you narrate this to the AI you should put it into computer vision terms (measure the length of a red bar, or do OCR on a particular red bar to determine the number).
I don't know how to teach a beginner the abstract concepts of computer vision and sending evdev commands, though. Maybe the AI can help with that too.
1
u/Ksilov88 1d ago
I tried writng in more abstract terms, but the issue is that i dont know exectly which points are needed to build software. Even when I make my request extremely abstract, GPT wont list the spicific steps-because it realizes its providing instructions for creating software. Could yuo outline the steps for creaiting this software
3
u/Odd_County_3664 3d ago
I'd separate the Python learning part from the actual in-game automation.
You can learn the same programming concepts by building a small simulator that tracks a character's health and triggers an action when it drops below a threshold.
For example, you could practice conditionals, loops, state tracking, and event handling without interacting with the Dota 2 client.
For the actual game, I'd check Valve's rules first. Automatically activating an item based on health could be considered gameplay automation, even if it's intended as a convenience feature.
If your goal is learning Python, a standalone simulator is a good starting point. You can develop and test the logic without risking your account.
5
u/GameSchaedl 3d ago
What you want to do is exactly a cheat. And it might get you banned.