PDA

View Full Version : TUTORIAL: Creating a bot that will auto-host/spam games, advertising your new map.



I3lade203
07-22-2007, 01:02 PM
Tutorial:
Creating a bot that will auto-host/spam games, advertising your new map.

What it does:
As the tutorial name implies, teaches you how to create a bot that will automatically create games, spam a message, or messages, and repeat the process. Ideal for spreading a new map, or advertising something such as a website name.

How it works:
When you heard the term 'bot' used in this tutorial, you probably thought of something like Stealthbot, which is something programmed to run as a separate application on your computer in the background, independent of starcraft altogether. This tutorial uses the term 'bot' much more generically - as something that carries out an automated process, rather then an application. You will need absolutely NO programing skills to complete this tutorial, and it IS written for just about anyone who's interested. This tutorial uses the technique of applying computer 'macros' to Starcraft in order to make this work. For those of you who don't know, a computer macro is a series of commands you create, record, or customize to do virtually anything on your computer. The commands can be set up to run VIA hot key, but for the sake of this tutorial they will be run using an infinite loop, that way the bot will run indefinitely until you tell it to stop.

Essentially, what you'll be doing:

1) Creating a plan - What you want your bot to do, how, when, and why.
2) Setting up the elements for your plan, getting everything together.
3) Recording a generic macro to act as a template.
4) Customizing the macro template to preform exactly what you'd like it to.
and finally.. 5) Running the macro!

What's Required:

- A working copy of Starcraft, of course!
- The ability to host games on battle.net/Starcraft - if you cannot you may need to disable your firewall/open some ports - I will not go into this here however, but if don't know how to open ports search Google - you'll find plenty of tutorials on there.
- Macro recording software. Any piece of macro recording software will do - however for simplicities sake I'm going to show you how to do this step by step on the piece of software I personally used - Jbit macro recorder. The program unfortunately is not free, but you can download a free 28-day trial here: http://www.jitbit.com/macrorecorder.aspx. My advice: Download the trial, follow this tutorial step by step, and then find a free piece of macro software somewhere on the web, and apply what you learnt in this tutorial to that piece of software.


Lastly, before I begin this tutorial I'd like to say I'm not trying to take credit for accomplishing some marvel or doing something extremely complicated. This is more like a 'do it yourself at home' type of thing, taking stuff 'around the house' and using them to accomplish a task. I'm simply here to share my creative innovation with others map makers, to hopefully give people a new better way to spread their maps then having to sit at their computers for an hour making games. As I mentioned earlier, this tutorial is for anyone and everyone, so you need very little knowledge coming into it. I'm not going to hold your hand and tell you how to , for example, open up and extract files, as any five year old should be able to do this.

Before I begin with the first step, I'd just like to make something clear: You cannot run this 'bot' at the same time you're using the computer. So, if you have a spare old computer around, and an extra Starcraft cd-key, use that. Otherwise, use this bot when you're asleep, at the mall, seeing a movie, or whenever your generally not at your computer. That way you don't drive yourself mad with boredom sitting there watching your bot spam games, and when you do go somewhere you can feel comforted knowing your bot is back at home spreading your game to unsuspecting battle.net newbies. Anyway, enough background, time to get into the tutorial!


Step 1: Introduction to the software

If you haven't already obtained Jbit, go here and download it:
http://www.jitbit.com/macrorecorder.aspx
If you plan on using some other macro software, then skip this step.

When you install the software, you should see two applications: MacroLauncher.exe, and MacroRecorder.exe. Forget about Macro Launcher, recorder is what we'll be using. You should see a screen like this:

http://img523.imageshack.us/img523/6504/tut1dy6.jpg

There's not much to familiarize yourself with here, but if you would like take a few moments now to feel your way through the software. If I were you, I'd change the default hot keys. To do this, click the settings button, go to the Keyboard Shortcuts tab, and change the hot keys here. I made my play/resume Ctrl+P, my Abort Playback Ctrl+S, my Start Recording Ctrl+R, and my Stop Recording Ctrl+E. Make yours whatever you feel comfortable with.


Step 2: Creating a plan

This is the most important step, as it's what you'll be following for the rest of the tutorial. What you now need to do is figure out EXACTLY what you'd like your bot to do, ideally. The first thing you need to do is figure out what screen you'd like the bot to start on, as you'll need to start it on this screen every time you run the bot. I choose to start my bot in Starcraft itself. If you're going to follow me word from word on the tutorial, then this means every time you go to run your bot, you must first have starcraft open and running, with your bot in a channel - any channel. Here's what the first two steps of my game plan looked like:

1) Start in a starcraft channel.
2) Type a message to anyone in the channel, and then my friends list.
"Hi, I am a bot, so I cannot respond to you in any way."
"/f m I am a bot, so I cannot respond to anyone at this time."

OK, so it's told people I'm a bot. (I run my bot on my normal account, but feel free to make a new account for yours.) Now what? Well, you COULD have it create a game now. However, a thought occurred to me: What if someone was using host hack? Or, what if someone, while my bot was in the channel, made the same game as me? My bot would get stuck and wouldn't be able to make more games! I solved this problem with a rather simple solution, add a random number to the end! There was also another obstacle to overcome at this stage. How will my bot get it's game name? I solved this with a simple solution as well. Simply have a notepad file on my desktop! This way my bot would go to my desktop, get whatever game name I put in the notepad file (This could always be updated) and then go get a random number. So, a recap:

3) Minimize Starcraft.
4) Open notepad. Copy and paste game name.
5) Open random number generator. Generate number. Put game name in front of number.
6) Copy and paste new game name, minimize random number generator, open Starcraft.

The bot now has a game name, and will now be back in Starcraft. Now you can have it make a game. The macro recorder does record mouse movements, so this is very simple. Have it open the create game window, have it insert the game name, and have it press 'OK.'

TIP: When running your bot, make sure that the last game played is the one you want it to host. Make sure the game name field is left blank, so it can insert the game name with ease.

7) Create a game, insert the game name.

So what now? Well, I wanted my bot to spam a message letting stupid people who say 'GO' in DL only games to know I was a bot. I wanted it to do this for 10 minutes, that way it'd give people time to DL, and also prevent my bot from getting ip banned for joining games to fast.

8) Spam this message for 10 minutes: "I am a bot, please download the map then leave. I cannot respond to you in any way. Thank you."

Then of course, you'd need the bot to leave the game. So...

9) Press 'esc' or click 'Cancel.'

Guess what? You're bot is back where it started! The starcraft channel screen. That's why I choose to start my bot in the starcraft window, so I wouldn't have to minimze anything and allow for a rather seamless loop.

Here's a final recap of my whole gameplan, if you're not following mine exactly, yours should look at least somewhat similiar.

1) Start in a starcraft channel.
2) Type a message to anyone in the channel, and then my friends list.
"Hi, I am a bot, so I cannot respond to you in any way."
"/f m I am a bot, so I cannot respond to anyone at this time."
3) Minimze Starcraft.
4) Open notepad. Copy and paste game name.
5) Open random number generator. Generate number. Put game name infront of number.
6) Copy and paste new game name, minimize random number generator, open Starcraft.
7) Create a game, insert the game name.
8) Spam this message for 10 minuites: "I am a bot, please download the map then leave. I cannot respond to you in any way. Thank you."
9) Press 'esc' or click 'Cancel.'
10) End up in a channel, and now repeat from step one.

I can't stress enough how important this whole step is - if you don't have a good game plan, then you won't know what you're doing when it comes time to recording your macro and you'll be left screwed. So now we know what we want the bot to do. What's next? Recording? Not quite yet - we first need to set up our materials so everything is ready to record.

Step 3: Setting up the elements for your plan, getting everything together.

So, take a look at your list from the previous step. Look carefully, and ask yourself 'What materials are required?' In my case, I need four things:

1) Starcraft
2) A random number generator
3) Notepad
and 4) Jbit macro recorder.

So, I opened up all four on my desktop, in that order. For the random number generator you can use a web-generator for simplicities sake, but it'd be better if you downloaded some simple one as an exe, that allows you to copy and paste the field. I used a web generator for now, here's the link: http://www.mdani.demon.co.uk/para/random.htm Open up all of these on your desktop.

**IMPORTANT** It's EXTREMLY important that you open up the elements in the SAME order each time. Why? Well, quite simply if you're going to be clicking the applications on the taskbar on your desktop, then they are going to need to be in the same position each time. Just jot down a note somewhere of which order you opened everything in, so you can set up your desktop the same way with ease each time you want to run the bot.

That's basiclly all there is to this step for me. If you have any other complications or materials in your gameplan, be sure to get them ready for recording.

Step 4: Creating a Macro Template

I say template, because i'm going to record everything in my gameplan EXECPT the following: The message spamming and the waiting 10 minuites. If you'd like, you can sit at your computer for 10 minuites typing the same message over and over again, and the macro software WILL record this. However I found that to tedious, and I wanted my bot to spam rather rapdily, instead of typing it out every time.

Anyway, it's going to be a little bit more difficult to walk you through this one, because all it is, is repeating the gameplan. First things first: Get rid of EVERYTHING on your desktop/computer (this includes side applications) besides the materials you need. You don't want something slowing you down or inturrpeting you during recording. (Do the same during playback as well.) Once that's done, open starcraft.

Ready? Take a deep breathe. This is it, recording time. When you're ready, press your start record hotkey.

[ If you're using the hotkeys I used, this is ctrl+R.]

Now whatever you do, your computer will record. So just follow your gameplan. Minimze the game, open up notepad. Copy the game name. Generate a number on the webpage, put the game name in front, and copy it all. Open up starcraft, enter your game name into the name window, and create the game.

Do NOT stop recording at this point. If you don't want to customize your macro later, then start typing your spam message over and over until you think you've hosted the game long enough. If you DO want to customize it and make it easy to edit later, then wait in the game lobby for about 5 seconds.

**IMPORTANT** At this point, if you plan on customizing your message later as opposed to typing it now, you NEED to create a marker for yourself! For the sake of this tutorial just press 'm.' Don't hit enter, just an m. Why you might ask? Well, later when we edit our macro we'll look for the 'm' on the command list so we know where to insert our spam messages.

Once your marker is in place, press cancel, or hit esc, any way that will get you back into a channel. Once you're in a channel again, congrulations! You're macros nearly, if not already, ready. Wait a moment, don't do anything else, and then STOP recording.

[If you're using the hotkeys I used, this is ctrl+E.]

That's it! Your bot is nearly complete. Minimze starcraft, and go back to Jbit. You should see a screen like this:

http://img153.imageshack.us/img153/9976/tut2ww1.jpg (http://img153.imageshack.us/img153/9976/tut2ww1.jpg)

If so, all your commands were recorded! Congrats. Now, before doing anything else, SAVE! Name the macro whatever you'd like, and save it somewhere you'll know to find it. That's all the recording you'll have to do. Onto the next step..

I3lade203
07-22-2007, 01:02 PM
Step 5: Editing/Customizing your macro

You can go in and edit anything you'd like, but for the sake of this tutorial i'll explain just how to go in and insert your message.

First: Save a BACKUP of the orginal macro. That way if you mess up, you don't have to re-record it.

Scroll down through the probbaly very large list of commands until you find the marker you put in during recording. If you followed me word from word, this will be an 'm'. Once you find it, click it, and press delete. Select the command above where it was, and go to "Insert -> Insert Text Type Commands -> Insert Text Type Command." Here's an image, just in case you're confused:

http://img503.imageshack.us/img503/7107/tut3dg0.jpg (http://img503.imageshack.us/img503/7107/tut3dg0.jpg)

A box will come up and ask you to type in a message. Type in whatever message you'd like your bot to spam, and click OK. The TYPE TEXT command will be inserted into your macro where your marker was. However, this will only input the text, it will NOT send it as well. To make it send, we just need to insert a quick command. Highlight your Type Text command, right click, and go to 'Insert -> Insert Keyboard event.'

A box will come up with a few options. In event type, select Keydown. In key, select 'Return.' (Equivlent of enter.) The last box is "Pause (ms) before the event." This is a very important field, because we don't want the bot just inserting the message and then leaving the game. We want it to spam the message every so often while waiting for 10 minuites. For the sake of this tutorial, we'll have the message said every 30 seconds. So enter 30000 into the Pause (ms) before the event field. Hit OK, and your new event should now be below your type text event.

The bot will now get a game name, add random numbers to the end, make the game, enter your message, wait 30 seconds and say it. Great! But.. wait. We want it to repeat this for 10 minuites. You COULD techinically copy and paste the previous two commands over 19 more times, but instead of doing that i'll show you an easier way.

Select the command ABOVE the type text command. Go to 'Insert -> Insert repeat X times statement -> Insert Repeat X times Statement..' A box will come up asking you the number of times to repeat. Since we already did it once, enter 19. Hit OK. Now, select your Keyboard 'Return Command' and go back to 'Insert -> Insert Repeat X times statement' only this time, select 'Insert "END REPEAT" statement." The end repeat statement should now be below your Keybaord 'return command.'

So your bot will now say a message every 30 seconds 20 times, making it wait 10 minuites and giving people a friendly remiender or message every 30 seconds until it remakes the game. Just to be sure, you're repeat commands with text message/enter commands should look like this:

http://img510.imageshack.us/img510/5136/tut4te9.jpg

That's it! You're macro is ready. Make sure to SAVE.

If you'd like play around with the software, or whatever software you're using, and edit/customize things. If you'd like, you could have the bot tell people it's rehosting another game before it leaves. Be creative, i'm sure there's tons of cool things you could do.

Step 6: Running the macro!

Now that everythings recorded, and edited, it's time to run your macro! Make sure that everytime you run your macro, the programs/elements are opened in the SAME order. Make sure you start in a battle.net channel. There's only one more thing you should do before running the macro. Since you want the bot to repeat by itself, you want the macro to run over and over again. Here's what you do: In jbit, go to the Settings button again. Go to the playback settings tab. MAKE SURE the "continious replay' tab is set to 0. It'll run infdefnitly until you stop it like this. Here's a quick image just to be sure:

http://img512.imageshack.us/img512/4879/tut5za6.jpg

Once that's done, all you have to do is run the macro!



Final Thoughts

I created this tutorial to, for the most part, help out other map makers. But don't let this tutorial limit you to just that. You can use this techinque to do dozens of things - both in and out of a game. You can even use this and apply it to other games or desktop applications. It's a lot of fun to be creative and come up with interesting things to do.

Although I used Jbit to write this tutorial, you can use ANY macro recording software you find. Just apply the same techinque/method to another application. It'll work just as great, if not better!

Finally, if anyone needs any help, just give me a PM or reply in this thread. I'll try my best to help you out. I would also apperciate any feedback or ideas/suggestions based on this tutorial and it's concept. Thanks to everyone for reading, and happy hosting!

Also: Sorry for spelling errors. Didn't bother to check.

DUI_
07-22-2007, 02:06 PM
great tutorial, thanks for sharing >.<

I3lade203
07-22-2007, 03:24 PM
great tutorial, thanks for sharing >.<

You're welcome, if you have any questions feel free to ask.

Raistlin
07-22-2007, 07:01 PM
If I'm trying to spread a map, I would rather cancel and rehost my game every so often and keep it further up the list than just host it for several hours with no intervention. And if I'm going to do the former, it would be nice to have it done for me in an automated fashion. In that situation this is a useful tool. If this doesn't apply to somebody then at worst it is useless... I'm not sure what is annoying about it. But, just my opinion.

Zaund
07-22-2007, 10:19 PM
Nicely done, can't try it yet because I've got to work in the morning but will tomorrow night! +Rep

Pure
08-05-2007, 07:37 AM
hmm a lil complicated?

Mojo9o
12-20-2008, 10:12 PM
I ran into a autohost today playing a rion game