Latest Publications
Bot tip
Here’s a tip. If your bot ever gets stuck on something trying to repetitively click something over and over and you can’t close it, add this to your code:

It will kill your bot when you press the ESC key.
Tutorial: Make your own FishVille AutoFeeder in 5 minutes!
Mini-update/tip: follow the FarmVille tutorial (specifically PixelSearch()) to have it search and sell the fish automatically. I haven’t really played the game but have tested it and it will work even, if the fish are moving. I’ll post a pseudo-code up this week.
As easy as the basic FarmVille AutoClicker was, this one is pretty much a no-brainer.
1. Open the ScITE editor we installed for the AutoClicker.
2. Use the ‘AutoIt Window Info’ program that came with AutoIt to find your coordinates. Use the MouseClick() function do drop a pellet of food at your desired coordinate(s).
3. After your clicks, we might want it to wait a little before feeding again. For this, use the Sleep() function, it will wait x milliseconds before continuing. I’d say 20000 (20 seconds) is a good number.
4. Put it in a while loop.
Tutorial: Make your own FarmVille AutoClicker in 15 minutes!
You’ll be amazed how easy and quick it is to make a (very basic) AutoClicker for FarmVille. No need to blindly click those links spammed on their FarmVille wall. Sure I can post my own code but that saying about the guy and the fish..
1. Download and install the program we will be using to script the bot. AutoIt3.
Note: when it asks you what you want to do when you open .au3 files, choose to edit it, not run it.
2. Open up the ScITE editor. Feel free to read through the Help files. It explains all the built-in functions and has sample codes.
3. Open up FarmVille. Scroll out as far as possible. Then open up ‘AutoIt Window Info’ program that was also installed. Grab that target thing and drag it to what you want it to click, ie: dirt, a plant, whatever. (If you have Photoshop, take a screen shot of your farm, open it in Photoshop then use the eyedropper tool to get the color. It is 100x easier this way). Try to get a distinct color that can’t be confused with another object. For example, if you want it to click on a Sunflower, grab the yellow color, and not the green that may be confused with a tree.

4. So now you have your color. Write it down, keep it somewhere safe, Go back in ScITE and get ready to do some programming.
5. Ready? Declare that color as a variable by typing:
Local $Plant1 = 0x######
where ###### is your color code you found. So everytime you want to use that color, just type $Plant1, it’s just easier and cleaner this way. Sometimes it takes a couple tries to get the right color.
6. The meat of the program. There’s a great function called PixelSearch(). If you do a F1 on it, it will show you how it is used – basically it returns the coordinates of that pixel color it found. So declare a new variable that will accept the return value of the function:
$PlowHere = PixelSearch(L, T, R, B, Color)
L,T,R,B are the coordinates/perimeter of the rectangle that the function will search inside. Use this screen shot as a reference:

So you want the coordinates of where the blue splotches are. The last parameter should be the variable you declared earlier, so put that there.
Note: It is best to maximize the window so it is always at a constant size. The coordinates you get are relative to your monitor resolution, not browser.
7. So you have your function filled out. Now we need to tell it to click where it found the color we specified:
MouseClick(“left”, $PlowHere[0],$PlowHere[1])
Now open up FarmVille and open up ScITE, do to Tools > Run. If everything goes well, it should click on whatever you wanted it to, once. Yay! Woohoo! We are almost done.
8. Now we need to make it loop until it cannot find anymore of those colors. For this, we will use a while loop and we are done:
While Not @error
; put your PixelSearch function here.
If @error Then
ExitLoop
EndIf
; put your MouseClick function here
WEnd
So at beginning, I said it was going to be a very basic program, and that what it is. There’s no GUI, no fancy stuff, it just clicks the color you specify. You’ll need to edit the color parameter everytime you want it to click something else.
Maybe that will be on another lesson but go explore the Help section
Read up on the GUICreate() function and play with the sample codes it gives
P.S. Leave comments. If I was not clear or you need help or have anything creative to add, post. I’m no expert so any tips/suggestions would be great and share anything that may be helpful.
