Hello,
When making a bot, there are essentially two major types of bots: easily detectable and (mostly) pixel-based bots. You may have noticed even these mostly pixel-based bots are also getting banned. This is easy to avoid, so please spare your downloading users their accounts and sanity by taking some considerations IN YOUR CODE, not just in the forum post.
The following employs pseudocode, which means it is not meant to directly be a specific programming language, but to convey the idea of what you should be coding.
1. Randomize ALL WAITS.
WRONG:
WRONG:
Code:
$sleep = random(1000,3000)
sleep($sleep)
(action)
sleep($sleep)
RIGHT:
Code:
sleep(random(1000,3000))
sleep(random(1000,3000))
MORE RIGHT:
Code:
$min = random(1000,3000)
$max = random(3000,5000)
sleep(random($min,$max))
sleep(random($min,$max))
RIGHTEREST:
Code:
function zzz()
$x = random(1000,4000)
$y = random(3000,6000)
sleep($x,$y)
end function
(do something)
zzz()
(do something else)
zzz()
Please note there are much more efficient and scalable ways to do this, with default timeouts that can be easily extended to be longer or shorter, and much better code. The above is NOT ABOUT THE SPECIFIC CODE, it's about the concept:
Summary -> REAL PEOPLE ARE NEVER, EVER, EVER doing the same thing in the same order with the exact same amount of milliseconds in between actions. EVER.
2. Strongly support the ability to do multiple OTHER things during the run or botting session aside from what it was made to do, or think of another way to extend the game time that will not annoy your user.
It is MUCH harder to detect a bot which is not creating 60 games a minute for 24+ hours straight, because NO HUMAN WILL DO THIS FOR EXTENDED PERIODS OF TIME, EVER, especially without completely, wildly random times in between actions.
At the VERY LEAST, MAKE YOUR BOT TAKE A LONG TIME TO COMPLETE ITS RUN, and offer a configuration setting to disable that behavior, with a strong warning about being banned.
There are tons of ways to do this, here is an example of one single way.
Set a few different types of timeouts. After all you will need to do some actions close together, such as waiting to start combat, etc. However, there is no reason you can't have longer timers for things like waiting to start moving after game starts, standing around at the merchant before/after repairs, etc. So what you can do is make 2-3 or more timeout profiles, and the user can change them at their own will:
GOOD:
Code:
; this timer is for waiting in between actions like clicking buttons, talking to merchants, etc
$normal_timer_increase = 0;
; this timer is for waiting in between fast actions like teleporting, attacking, running, etc
$action_timer_increase = 0;
; this timer is for unimportant things like before starting quests, etc.
; WARNING: IF YOU REDUCE THE TIMER INCREASE HERE YOU CAN SIGNIFICANTLY INCREASE THE CHANCES OF BEING BANNED
; YOU HAVE BEEN WARNED
$slow_timer_increase = 20;
...later, at the very end of a function that calculates the current wait time, like in step 1...
Code:
$normal_timer = $slow_timer + $normal_timer_increase
$action_timer = $slow_timer + $action_timer_increase
$slow_timer = $slow_timer + $slow_timer_increase
Another good thing you can do with your bot, which is harder to do, is to add more functionality, like instead of just running in and grabbing a potion and leaving, have it do SOMETHING beneficial, for example running a single boss as well, or whatever you know how to do, AND use the above tactics. The best bots are those which don't sit around doing nothing, but instead spend the time doing other runs. But this can be much harder to code, so at LEAST do the long waits.
Summary -> IT IS HIGHLY SUSPECT TO BLIZZARD WHEN SOMEONE IS DOING THE EXACT SAME THING OVER AND OVER AND OVER IN VERY SHORT GAMES AND EVERY ACTION THEY TAKE IS EXACTLY THE SAME TIMING
2b. If you can't or don't want to add more functionality to your bots, such as multiple types of runs in the same game, at least HAVE YOUR BOT DO SOME RANDOM THINGS.
It's really quite easy. Figure out how to get your character to go to town and go into some random part of the town. Figure out how to talk to the gem guy, the blacksmith, the followers, etc. and have the option (WHICH IS ON BY DEFAULT) to randomly go and visit them before and after runs. Not only does this help extend your run time without much coding, it also makes those extended run times more random, and the character behavior mirrors human behavior much closer.
Summary -> IF YOU DON'T WANT YOURSELF AND YOUR BOTTERS TO BE BANNED AND HAVE TO SPEND $$ TO BUY THE CLIENT AGAIN, TAKE A DAY TO ADD SOME HUMANISTIC FUNCTIONALITY TO YOUR SCRIPT. IT'S NOT HARD AND IT PAYS OFF.
It is really NOT hard to detect mostly pixel-based scripting language-based bots, if you don't use the above. It's quite easy, in fact.
The key thing to take away from this post is not the code, and not the randomization of waits and actions so much as the mindset: design your bot to BE A HUMAN.
There used to be a concept of an anti-idle bot in Diablo II. The problem was, if you just opened a game and sat there for a while, Battlenet would kick you out of the game. So this simple bot would just randomly move your character a tiny bit, every now and then. This is perhaps the simplest, slightly humanistic bot there is. It worked because it made itself more like a human and less like a computer.
Apply the same logic to your bot. Have a bot that scrapes the auction house? Make it enter games at random times, and have it do something useful while it's in there. Don't want to do all that coding? Work with someone else who already has done this, to combine some features of your bot and theirs.
Have a bot that sits in chat saying things? Have it join and play too. Have it check some auction prices. There just isn't much reason not to do this kind of thing.