Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

FarmVille Bot Program!


  • Please log in to reply
123 replies to this topic

#1 BlaineSch

BlaineSch

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1559 posts

Posted 14 October 2009 - 04:47 PM

FarmVille Bot
So I just created my bot. I had it working last night, but when I was thinking of how I could make it more cross compatible between browsers and resolutions I solved the issue and rewrote it!

Compiling and Running
To compile the source save it as .au3 and compile using the program available for download here.

Run the program, hit "Alt + A" to start the program, youll be promompted to input a code, you probably don't have one (you get yours at the end) so just type in 0, then just follow the answer all the other questions 1 for true 0 for false. Press "Esc" to exit the program, it won't exit unless you do this or kill the process in the task manager.

Known Issues
This is one of the first programs I made and had a ton of issues with global/local variables in functions and such so don't piss and moan about my procedural code haha.

The mouseover part confused my test subjects, basically when the alert box is on top, put your mouse where your crop is, and hit the enter key so your mouse is still over your crop when you go to the next one, this will happen for the amount of crops you entered. Do that for all the questions, it will also ask you to hover over all your tools. And two of your tools like the "delete accept" button when you delete something you have to "accept" it. And in the Market, but for right now it only allows first page, I might enable it later to scroll pages to get better crops.

Possible Uses:
Basically if you set this to repeat 100 times or so, and "plow, plant, delete" your experience will grow. If you want to make harvesting more automated use the import/export feature. So when your crops are ready, harvest them, plow them again, and plant. Just run the program once a day and you should be good.

Import/export:
Basically this allows you to save coordinates, I didn't enable the use of file editing/saving but it'll prompt you at the end and give you the coordinates. If your wanting to use this feature make sure the coordinates of everything do not change. If your in Firefox like me, I had to remove my toolbars, bookmarks and the address bar. Safari and Chrome both showed my entire game without me scrolling. If you scroll there is a chance you might be messing it up by a few pixels.

HotKeySet("{ESC}", "Terminate");
HotKeySet("!a", "start")
;Start Program
MsgBox(0, "FarmVille App", "Alt+A to start this program. Load FarmVille before this starts. Have you mouse over where it says and hit enter to go to the next cords.");
WinWaitActive("Does_NOT-Ex1sT");insures the program will keep going
;End Program
Func Terminate()
MsgBox(0,"FarmVille", "Goodbye cruel world.")
Exit 0;
EndFunc
Func start()
;;Declare Variables below
local $market[2]; //x,y of the market
local $multi[2];//x,y of multi tool
local $plow[2];//x,y of multi tool
local $delete[2];//x,y of multi tool
local $deleteacc[2];//x,y of multi tool
local $topplant[2];//x,y of multi tool

;;Input from user
$previous = InputBox("FarmVille", "Import previous settings:", "")
$result = StringInStr($previous, "fvbs:", 1, 1, 1, 5) ;//0 = false; 1 = true
If $result == 0 THEN
$noc = InputBox("FarmVille", "Emter the amount of crops you have.", "9")
$toharvest = InputBox("FarmVille", "Should I harvest these? 1/0", "1", " M1")
$toplow = InputBox("FarmVille", "Should I plow these? 1/0", "1", " M1")
$toplant = InputBox("FarmVille", "Should I plant these? 1/0", "1", " M1")
$todelete = InputBox("FarmVille", "Should I delete these? 1/0", "1", " M1")
$torepeat = InputBox("FarmVille", "How many times should this occur? 1+", "100")
local $plants[$noc*2];//9 plants max?
$nop = 0; ;//keeping track of the number of plants
$i = 0;
While $i < $noc
MsgBox(0, "Set Cords", "Please mouseover a plant where you want it to plow. Be exact!", 10)
$t = MouseGetPos()
$plants[$nop] = $t[0]
$nop = $nop + 1;
$plants[$nop] = $t[1]
$nop = $nop + 1;
$i = $i + 1;
WEnd
MsgBox(0, "Set Cords", "Please place your mouse over the MultiTool.", 10)
$multi = MouseGetPos()
MsgBox(0, "Set Cords", "Please place your mouse over the Plow Tool.", 10)
$plow = MouseGetPos()
MsgBox(0, "Set Cords", "Please place your mouse over the Delete Tool.", 10)
$delete = MouseGetPos()
MsgBox(0, "Set Cords", "Please place your mouse over the Delete Accept.", 10)
$deleteacc = MouseGetPos()
MsgBox(0, "Set Cords", "Please place your mouse over the Market.", 10)
$market = MouseGetPos()
MsgBox(0, "Set Cords", "Click the market, then mouse over the plant you wish to plant. First page only!", 10)
$topplant = MouseGetPos()
MsgBox(0, "Starting", "Make sure everything is already deleted", 10);
Else
$res = StringRegExp($previous, '([0-9]{1,5}),',3)
$market[0] = $res[0]
$market[1] = $res[1]
$multi[0] = $res[2]
$multi[1] = $res[3]
$plow[0] = $res[4]
$plow[1] = $res[5]
$delete[0] = $res[6]
$delete[1] = $res[7]
$deleteacc[0] = $res[8]
$deleteacc[1] = $res[9]
$topplant[0] = $res[10]
$topplant[1] = $res[11]
$noc = $res[12]
global $plants[$noc*2]
$i = 0;
While $i < ($noc*2)
$plants[$i] = $res[13+$i]
$plants[$i+1] = $res[14+$i]
$i = $i + 2
WEnd
$toharvest = InputBox("FarmVille", "Should I harvest these? 1/0", "1", " M1")
$toplow = InputBox("FarmVille", "Should I plow these? 1/0", "1", " M1")
$toplant = InputBox("FarmVille", "Should I plant these? 1/0", "1", " M1")
$todelete = InputBox("FarmVille", "Should I delete these? 1/0", "1", " M1")
$torepeat = InputBox("FarmVille", "How many times should this occur? 1+", "100")
EndIf
$bs = 1;
While $bs <= $torepeat
$bs = $bs + 1;
if $toharvest == 1 Then
;;only happens if you want to harvest the land first
MouseClick("left", $multi[0], $multi[1], 1); click mutli tool
$i = 0; need to plow
While $i < ($noc*2)
MouseClick("left", $plants[$i]-10, $plants[$i+1]-10, 1);click each plant to harvest
$i = $i + 2;
Wend
EndIf
if $toplow == 1 Then
;;only happens if you want to plow the land first
MouseClick("left", $plow[0], $plow[1], 1); click plow tool
$i = 0; need to plow
While $i < ($noc*2)
MouseClick("left", $plants[$i], $plants[$i+1], 1);click each plant to plow them
$i = $i + 2;
Wend
EndIf
If $toplant == 1 THEN
;;only happens if you want to plant something
MouseClick("left", $market[0], $market[1], 1); click market
MouseClick("left", $topplant[0], $topplant[1], 1); click the plant
$i = 0; need to plow
While $i < ($noc*2)
MouseClick("left", $plants[$i]-10, $plants[$i+1]-10, 1);click each plant to plant them
$i = $i + 2;
Wend
EndIf
If $todelete == 1 THEN
;;wanna delete when your done?
MouseClick("left", $delete[0], $delete[1], 1); delete tool
$i = 0; need to plow
While $i < ($noc*2)
MouseClick("left", $plants[$i]-10, $plants[$i+1]-10, 1);click each plant to delete them
MouseClick("left", $deleteacc[0], $deleteacc[1], 1);delete accept
$i = $i + 2;
Wend
EndIf
Wend
$i = 0; need to plow
local $cords = ""
While $i < ($noc*2)
$cords = $cords&$plants[$i]&","&$plants[$i+1]&",";
$i = $i + 2;
Wend
$export = InputBox("FarmVille", "Export Settings. Hit Alt+A to restart this process.", "fvbs:"&$market[0]&","&$market[1]&","&$multi[0]&","&$multi[1]&","&$plow[0]&","&$plow[1]&","&$delete[0]&","&$delete[1]&","&$deleteacc[0]&","&$deleteacc[1]&","&$topplant[0]&","&$topplant[1]&","&$noc&","&$cords)
EndFunc

Attached Files


  • -1

#2 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 14 October 2009 - 06:02 PM

This is so funny. Isn't it taking the fun away from the game? :P
  • 0

#3 BlaineSch

BlaineSch

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1559 posts

Posted 14 October 2009 - 06:16 PM

Fun? Games are made to win, not for this "fun" you speak of :P
  • 0

#4 Vswe

Vswe

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1989 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript

Posted 15 October 2009 - 03:23 AM

You're wrong. Games are made for programemrs to try to get advantages by using some logics and help from the computer so all non-programmers will feel stupid for actually playing the game. :P

Personally I think creating bots for web browser game is really funny, however when they're done I don't even use them, since who wants to have the highest level(or something similar) on the game, not me, I want the challenge :D
  • 0

#5 nicolost

nicolost

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 15 October 2009 - 04:12 PM

thanks
  • 0

#6 BlaineSch

BlaineSch

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1559 posts

Posted 15 October 2009 - 04:42 PM

You're wrong. Games are made for programemrs to try to get advantages by using some logics and help from the computer so all non-programmers will feel stupid for actually playing the game. :P

Personally I think creating bots for web browser game is really funny, however when they're done I don't even use them, since who wants to have the highest level(or something similar) on the game, not me, I want the challenge :D


I created the logic, so in a sense all it's doing is automating what I would/could be doing. The challenge is to figure out the best/fastest way to win, and I did. In a sense this is just a different approach I took to beating the game. Right? :D
  • 0

#7 Vswe

Vswe

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1989 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript

Posted 16 October 2009 - 01:49 AM

Yes :P
  • 0

#8 slaters

slaters

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 16 October 2009 - 03:02 AM

nice
  • 0

#9 lolipearl

lolipearl

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 16 October 2009 - 03:06 AM

thx
  • 0

#10 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 16 October 2009 - 04:12 AM

Wow, I guess your thread/bot is bringing in the Farmville crowd. lol

Edited by Jordan, 16 October 2009 - 06:48 AM.

  • 0

#11 Vswe

Vswe

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1989 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript

Posted 16 October 2009 - 05:46 AM

This will be the end of farmville :P
  • 0

#12 Aereshaa

Aereshaa

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 638 posts

Posted 16 October 2009 - 12:25 PM

I was thinking of making a bot for Ogame. Essentially, it would allow me to schedule buildings and ships in advance.
  • 0
Watches: Nanoha, Haruhi, AzuDai. Listens to: E-Type, Dj Melodie, Nightcore.
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download