AutoIt Forums: Facebook Farmville automation - AutoIt Forums

Jump to content

  • (26 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Facebook Farmville automation plow, plant and harvest without a click... Rate Topic: ****- 4 Votes

#21 User is offline   Eliran 

  • Newbie
  • Group: Members
  • Posts: 3
  • Joined: 31-August 09

Posted 31 August 2009 - 11:35 PM

View PostJackalo, on 30 August 2009 - 06:07 PM, said:

I didn't want to create a new thread for the same kind of program, so I figured that I would post my alternative take on a Facebook Farmville click script here.

All this program does is automate the clicking process, with variable speeds, columns, and rows, and has hotkeys to make it quicker. This script was really great before they nerfed the instant farm technique, but it's still a time saver for me to this day.

I guess I should also note that this is made to work with Farmville when it's fully zoomed out. Take it or leave it, I just felt like sharing.

[ autoIt ]    ( ExpandCollapse - Popup )
;*** Farmville Bot ; v2009-07-30 - Now has a GUI, a target button, and optional avoidance of spawning square. ; v2009-07-31 - Added a Mouse Speed variable, made the GUI look better ; v2009-08-23 - Reworked the entire script to use hotkeys and a variable harvest area ; v2009-08-24 - Finished the rewrite, cleaned and compacted the code, added Help button ; Just some things to remember... ; When zoomed all the way out, the below are true... ; Moving across columns, x+25, y-12 ; Moving down rows, x+25, y+12 ;*** Design Goals ; 1. Create a better looking interface ; Includes #include <GUIConstantsEx.au3> #include <EditConstants.au3> ; Define a few (global) variables $script_x = 0 $script_y = 0 $script_speed = 25 $script_size_columns = 4 $script_size_rows = 4 $script_running = 0 ; Hotkeys HotKeySet("{HOME}", "set_position") HotKeySet("{INSERT}", "start_script") HotKeySet("{DELETE}", "stop_script") ; Hotkey Functions Func set_position()     $script_x = MouseGetPos(0)     $script_y = MouseGetPos(1)         GUICtrlSetData($label_coordinate_x, $script_x)     GUICtrlSetData($label_coordinate_y, $script_y) EndFunc Func start_script()     GUICtrlSetColor($graphic_background, "0x33FF33") ;~  GUICtrlSetBkColor($button_help, "0x33FF33")     $script_running = 1 EndFunc Func stop_script()     GUICtrlSetColor($graphic_background, "0xF0F0F0") ;~  GUICtrlSetBkColor($button_help, "0xF0F0F0")     $script_running = 0 EndFunc $window_main = GUICreate("Farmville Bot", 200, 165) $graphic_background = GUICtrlCreateGraphic(0, 0, 200, 165) GUICtrlSetState($graphic_background, $GUI_DISABLE) GUICtrlCreateGroup("Coordinates", 5, 5, 75, 60) GUICtrlCreateLabel("X:", 20, 25, 50) GUICtrlCreateLabel("Y:", 20, 40, 50) $label_coordinate_x = GUICtrlCreateLabel($script_x, 40, 25, 30) $label_coordinate_y = GUICtrlCreateLabel($script_y, 40, 40, 30) $button_help = GUICtrlCreateButton("Help", 15, 95, 75, 45) GUICtrlCreateGroup("Size", 90, 5, 105, 61) GUICtrlCreateLabel("Columns:", 98, 20) $input_size_columns = GUICtrlCreateInput($script_size_columns, 145, 18, 40, 20) $updown_size_columns = GUICtrlCreateUpdown($input_size_columns) GUICtrlSetLimit($updown_size_columns, 20, 1) GUICtrlCreateLabel("Rows:", 98, 42) $input_size_rows = GUICtrlCreateInput($script_size_rows, 145, 40, 40, 20) $updown_size_rows = GUICtrlCreateUpdown($input_size_rows) GUICtrlSetLimit($updown_size_rows, 20, 1) GUICtrlCreateGroup("Mouse Speed", 110, 75, 85, 85) $input_speed = GUICtrlCreateInput($script_speed, 125, 95, 50, 20, $ES_CENTER) $updown_speed = GUICtrlCreateUpdown($input_speed) GUICtrlSetLimit($updown_speed, 50, 1) $button_speed_1 = GUICtrlCreateButton("1", 115, 120, 25, 15) $button_speed_5 = GUICtrlCreateButton("5", 140, 120, 25, 15) $button_speed_10 = GUICtrlCreateButton("10", 165, 120, 25, 15) $button_speed_15 = GUICtrlCreateButton("15", 115, 140, 25, 15) $button_speed_25 = GUICtrlCreateButton("25", 140, 140, 25, 15) $button_speed_50 = GUICtrlCreateButton("50", 165, 140, 25, 15) $window_help = GUICreate("Help", 170, 65, -1, -1, -1, 0, $window_main) GUICtrlCreateLabel("Home = Set starting coordinates", 10, 5) GUICtrlCreateLabel("Insert = Start the script", 10, 25) GUICtrlCreateLabel("Delete = Stop the script", 10, 45) GUISetState(@SW_SHOW, $window_main) While 1     If $script_running Then         ; Seriously, why is this even necessary...?         $script_size_columns = GUICtrlRead($input_size_columns)         $script_size_rows = GUICtrlRead($input_size_rows)                 farm()     EndIf             $script_speed = GUICtrlRead($input_speed)     $gui_msg = GUIGetMsg(1)         Select         Case $gui_msg[0] = $GUI_EVENT_CLOSE             If $gui_msg[1] = $window_main Then                 ExitLoop             ElseIf $gui_msg[1] = $window_help Then                 GUISetState(@SW_HIDE, $window_help)             EndIf         Case $gui_msg[0] = $button_help             GUISetState(@SW_SHOW, $window_help)         Case $gui_msg[0] = $button_speed_1             GUICtrlSetData($input_speed, "1")         Case $gui_msg[0] = $button_speed_5             GUICtrlSetData($input_speed, "5")         Case $gui_msg[0] = $button_speed_10             GUICtrlSetData($input_speed, "10")         Case $gui_msg[0] = $button_speed_15             GUICtrlSetData($input_speed, "15")         Case $gui_msg[0] = $button_speed_25             GUICtrlSetData($input_speed, "25")         Case $gui_msg[0] = $button_speed_50             GUICtrlSetData($input_speed, "50")     EndSelect     Sleep(25) WEnd Func farm()     ; Some (local) variables     $current_x = $script_x     $current_y = $script_y         For $current_row = 1 To $script_size_rows Step 1         For $current_column = 1 To $script_size_columns Step 1             MouseClick("primary", $current_x, $current_y, 1, $script_speed)                         $current_x = $current_x + 25             $current_y = $current_y - 12                         If Not $script_running Then ExitLoop         Next                 ; Reset to beginning of row         $current_x = $current_x - (25 * $script_size_columns)         $current_y = $current_y - (-12 * $script_size_columns)                 ; Advance to the next row         $current_x = $current_x + 25         $current_y = $current_y + 12                 If Not $script_running Then ExitLoop     Next         ; Stop running now     stop_script() EndFunc  


how can i instal this script? on firefox? thank you so much guys

#22 User is offline   wetwlly 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 47
  • Joined: 26-August 09

Posted 01 September 2009 - 12:03 AM

View PostEliran, on 31 August 2009 - 11:35 PM, said:

how can i instal this script? on firefox? thank you so much guys


download autoit and compile it

#23 User is offline   Eliran 

  • Newbie
  • Group: Members
  • Posts: 3
  • Joined: 31-August 09

Posted 01 September 2009 - 09:57 AM

kk i made it but why its not in aloop?
its stops after the first turn
i want him to keep doing it till i need to harvest

#24 User is offline   linder 

  • Newbie
  • Group: Full Members
  • Posts: 7
  • Joined: 01-September 09

Posted 01 September 2009 - 06:22 PM

View PostJackalo, on 30 August 2009 - 06:07 PM, said:

I didn't want to create a new thread for the same kind of program, so I figured that I would post my alternative take on a Facebook Farmville click script here.

All this program does is automate the clicking process, with variable speeds, columns, and rows, and has hotkeys to make it quicker. This script was really great before they nerfed the instant farm technique, but it's still a time saver for me to this day.

I guess I should also note that this is made to work with Farmville when it's fully zoomed out. Take it or leave it, I just felt like sharing.

[ autoIt ]    ( ExpandCollapse - Popup )
;*** Farmville Bot ; v2009-07-30 - Now has a GUI, a target button, and optional avoidance of spawning square. ; v2009-07-31 - Added a Mouse Speed variable, made the GUI look better ; v2009-08-23 - Reworked the entire script to use hotkeys and a variable harvest area ; v2009-08-24 - Finished the rewrite, cleaned and compacted the code, added Help button ; Just some things to remember... ; When zoomed all the way out, the below are true... ; Moving across columns, x+25, y-12 ; Moving down rows, x+25, y+12 ;*** Design Goals ; 1. Create a better looking interface ; Includes #include <GUIConstantsEx.au3> #include <EditConstants.au3> ; Define a few (global) variables $script_x = 0 $script_y = 0 $script_speed = 25 $script_size_columns = 4 $script_size_rows = 4 $script_running = 0 ; Hotkeys HotKeySet("{HOME}", "set_position") HotKeySet("{INSERT}", "start_script") HotKeySet("{DELETE}", "stop_script") ; Hotkey Functions Func set_position()     $script_x = MouseGetPos(0)     $script_y = MouseGetPos(1)         GUICtrlSetData($label_coordinate_x, $script_x)     GUICtrlSetData($label_coordinate_y, $script_y) EndFunc Func start_script()     GUICtrlSetColor($graphic_background, "0x33FF33") ;~  GUICtrlSetBkColor($button_help, "0x33FF33")     $script_running = 1 EndFunc Func stop_script()     GUICtrlSetColor($graphic_background, "0xF0F0F0") ;~  GUICtrlSetBkColor($button_help, "0xF0F0F0")     $script_running = 0 EndFunc $window_main = GUICreate("Farmville Bot", 200, 165) $graphic_background = GUICtrlCreateGraphic(0, 0, 200, 165) GUICtrlSetState($graphic_background, $GUI_DISABLE) GUICtrlCreateGroup("Coordinates", 5, 5, 75, 60) GUICtrlCreateLabel("X:", 20, 25, 50) GUICtrlCreateLabel("Y:", 20, 40, 50) $label_coordinate_x = GUICtrlCreateLabel($script_x, 40, 25, 30) $label_coordinate_y = GUICtrlCreateLabel($script_y, 40, 40, 30) $button_help = GUICtrlCreateButton("Help", 15, 95, 75, 45) GUICtrlCreateGroup("Size", 90, 5, 105, 61) GUICtrlCreateLabel("Columns:", 98, 20) $input_size_columns = GUICtrlCreateInput($script_size_columns, 145, 18, 40, 20) $updown_size_columns = GUICtrlCreateUpdown($input_size_columns) GUICtrlSetLimit($updown_size_columns, 20, 1) GUICtrlCreateLabel("Rows:", 98, 42) $input_size_rows = GUICtrlCreateInput($script_size_rows, 145, 40, 40, 20) $updown_size_rows = GUICtrlCreateUpdown($input_size_rows) GUICtrlSetLimit($updown_size_rows, 20, 1) GUICtrlCreateGroup("Mouse Speed", 110, 75, 85, 85) $input_speed = GUICtrlCreateInput($script_speed, 125, 95, 50, 20, $ES_CENTER) $updown_speed = GUICtrlCreateUpdown($input_speed) GUICtrlSetLimit($updown_speed, 50, 1) $button_speed_1 = GUICtrlCreateButton("1", 115, 120, 25, 15) $button_speed_5 = GUICtrlCreateButton("5", 140, 120, 25, 15) $button_speed_10 = GUICtrlCreateButton("10", 165, 120, 25, 15) $button_speed_15 = GUICtrlCreateButton("15", 115, 140, 25, 15) $button_speed_25 = GUICtrlCreateButton("25", 140, 140, 25, 15) $button_speed_50 = GUICtrlCreateButton("50", 165, 140, 25, 15) $window_help = GUICreate("Help", 170, 65, -1, -1, -1, 0, $window_main) GUICtrlCreateLabel("Home = Set starting coordinates", 10, 5) GUICtrlCreateLabel("Insert = Start the script", 10, 25) GUICtrlCreateLabel("Delete = Stop the script", 10, 45) GUISetState(@SW_SHOW, $window_main) While 1     If $script_running Then         ; Seriously, why is this even necessary...?         $script_size_columns = GUICtrlRead($input_size_columns)         $script_size_rows = GUICtrlRead($input_size_rows)                 farm()     EndIf             $script_speed = GUICtrlRead($input_speed)     $gui_msg = GUIGetMsg(1)         Select         Case $gui_msg[0] = $GUI_EVENT_CLOSE             If $gui_msg[1] = $window_main Then                 ExitLoop             ElseIf $gui_msg[1] = $window_help Then                 GUISetState(@SW_HIDE, $window_help)             EndIf         Case $gui_msg[0] = $button_help             GUISetState(@SW_SHOW, $window_help)         Case $gui_msg[0] = $button_speed_1             GUICtrlSetData($input_speed, "1")         Case $gui_msg[0] = $button_speed_5             GUICtrlSetData($input_speed, "5")         Case $gui_msg[0] = $button_speed_10             GUICtrlSetData($input_speed, "10")         Case $gui_msg[0] = $button_speed_15             GUICtrlSetData($input_speed, "15")         Case $gui_msg[0] = $button_speed_25             GUICtrlSetData($input_speed, "25")         Case $gui_msg[0] = $button_speed_50             GUICtrlSetData($input_speed, "50")     EndSelect     Sleep(25) WEnd Func farm()     ; Some (local) variables     $current_x = $script_x     $current_y = $script_y         For $current_row = 1 To $script_size_rows Step 1         For $current_column = 1 To $script_size_columns Step 1             MouseClick("primary", $current_x, $current_y, 1, $script_speed)                         $current_x = $current_x + 25             $current_y = $current_y - 12                         If Not $script_running Then ExitLoop         Next                 ; Reset to beginning of row         $current_x = $current_x - (25 * $script_size_columns)         $current_y = $current_y - (-12 * $script_size_columns)                 ; Advance to the next row         $current_x = $current_x + 25         $current_y = $current_y + 12                 If Not $script_running Then ExitLoop     Next         ; Stop running now     stop_script() EndFunc  



Where do you have your farmer trapped?
I got my farmer trapped at the middle spot and with this script it presses my farmer and ill get upp the "female or male" popup

I dont know how this script thing works but it cant be that hard to exclude the middlespot?




And it would be lovely if someone made a script for soybeans-delete method... Just one spot would be enough and just loop it :)


edit:

[ autoIt ]    ( Popup )
For $current_column = 1 To $script_size_columns Step 1             MouseClick("primary", $current_x, $current_y, 1, $script_speed)                         $current_x = $current_x + 25             $current_y = $current_y - 12                                 If $current_row = $script_size_rows/2  Then                     If $current_column = (($script_size_clumns/2)+1) Then                             $current_x = $current_x + 25                             $current_y = $current_y - 12                     EndIf                 EndIf             If Not $script_running Then ExitLoop         Next  


I put this in and im gonna see if it works :)

This post has been edited by linder: 01 September 2009 - 06:35 PM


#25 User is offline   linder 

  • Newbie
  • Group: Full Members
  • Posts: 7
  • Joined: 01-September 09

Posted 01 September 2009 - 07:01 PM

why couldnt i edit my last post more?

[ autoIt ]    ( Popup )
                If $current_row = $script_size_rows / 2  Then                     If $current_column = $script_size_columns / 2 Then                             $current_x = $current_x + 25                             $current_y = $current_y - 12                     EndIf                 EndIf  


Added this code worked for me

It skipps the middle square where i have my farmer stucked

http://img384.imageshack.us/img384/4061/farmville.jpg

#26 User is offline   Valik 

  • Do You Wanna Date My Avatar?
  • Icon
  • Group: Developers(Dev)
  • Posts: 14,457
  • Joined: 05-December 03
  • Gender:Male
  • Location:Silent Hill

Posted 01 September 2009 - 11:31 PM

linder, do not misuse the report feature or you will be banned.

#27 User is offline   linder 

  • Newbie
  • Group: Full Members
  • Posts: 7
  • Joined: 01-September 09

Posted 01 September 2009 - 11:59 PM

View PostValik, on 01 September 2009 - 11:31 PM, said:

linder, do not misuse the report feature or you will be banned.


That was a good answer to why I cant edit the post...


In my opinion you should be able to edit your posts as many times as you want and also being able to delete it

This post has been edited by linder: 02 September 2009 - 12:03 AM


#28 User is offline   linder 

  • Newbie
  • Group: Full Members
  • Posts: 7
  • Joined: 01-September 09

Posted 02 September 2009 - 01:07 AM

Tried to edit my last posts but this forum doesnt let me to :/


I did manage to fix a "plow-plant-soybean-delete" script using Jackalo maincode (not much is like it was from the begining tho)


And as I have never ever worked with scripting before. I couldnt figure out how to fix it for different resolutions etc so this only works for ppl with same resolution as me, 1280x800 ... And I also bet it doesnt work on farms smaller then 20x20, but cant see why that should be a problem as you arent supposed to use this method with a farm smaller than 20x20.

[ autoIt ]    ( ExpandCollapse - Popup )
; This script require a 20x20 farm and a 1280 x 800 resolutin ; Includes #include <GUIConstantsEx.au3> #include <EditConstants.au3> ; Define a few (global) variables $script_speed = 30 $script_amount = 4 $script_running = 0 ; Hotkeys HotKeySet("{INSERT}", "start_script") HotKeySet("{DELETE}", "stop_script") ; Hotkey Functions Func start_script()     GUICtrlSetColor($graphic_background, "0x33FF33") ;~  GUICtrlSetBkColor($button_help, "0x33FF33")     $script_running = 1 EndFunc Func stop_script()     GUICtrlSetColor($graphic_background, "0xF0F0F0") ;~  GUICtrlSetBkColor($button_help, "0xF0F0F0")     $script_running = 0 EndFunc $window_main = GUICreate("Beanbot", 100, 145) $graphic_background = GUICtrlCreateGraphic(0, 0, 200, 165) GUICtrlSetState($graphic_background, $GUI_DISABLE) GUICtrlCreateGroup("Amount", 10, 5, 85, 40) $input_amount = GUICtrlCreateInput($script_amount, 12, 18, 80, 20, $ES_CENTER) $updown_amount = GUICtrlCreateUpdown($input_amount) GUICtrlSetLimit($updown_amount, 20, 1) GUICtrlCreateGroup("Mouse Speed", 10, 50, 85, 40) $input_speed = GUICtrlCreateInput($script_speed, 12, 63, 80, 20, $ES_CENTER) $updown_speed = GUICtrlCreateUpdown($input_speed) GUICtrlSetLimit($updown_speed, 50, 1) GUICtrlCreateLabel("Insert = Start", 10, 100) GUICtrlCreateLabel("Delete = Stop", 10, 120) GUISetState(@SW_SHOW, $window_main) While 1     If $script_running Then                         $script_amount = GUICtrlRead($input_amount)                 farm()     EndIf             $script_speed = GUICtrlRead($input_speed)     $gui_msg = GUIGetMsg(1)     Select         Case $gui_msg[0] = $GUI_EVENT_CLOSE             If $gui_msg[1] = $window_main Then                 ExitLoop             EndIf     EndSelect     Sleep(25) WEnd Func farm()     For $current_amount = 1 To $script_amount Step 1         MouseClick("primary", 948, 707, 1, $script_speed) ;plow1     MouseClick("primary", 945, 648, 1, $script_speed) ;plow2     MouseClick("primary", 1112, 414, 1, $script_speed) ;last square     MouseClick("primary", 940, 768, 1, $script_speed) ;market     MouseClick("primary", 498, 596, 1, $script_speed) ;soybeans     MouseClick("primary", 1112, 414, 1, $script_speed) ;last square     MouseClick("primary", 997, 707, 1, $script_speed) ;delete     MouseClick("primary", 1112, 414, 1, $script_speed) ;last square         If Not $script_running Then ExitLoop  ;this is before delete accept just for safety             MouseClick("primary", 569, 493, 1, $script_speed) ;delete accept Next ; Stop running now     stop_script() EndFunc  


____________________________________________________________________________________

And for you guys out there with the farmer in boxed up in middle / startposition

This actually works (only tested on 20x20)... Just be sure that you set your position so high that you doesnt hit the head (or mainly the mohikan) of your farmer :D
I just added 7 lines so all credit to Jackalo


[ autoIt ]    ( ExpandCollapse - Popup )
;*** Farmville Bot ; v2009-07-30 - Now has a GUI, a target button, and optional avoidance of spawning square. ; v2009-07-31 - Added a Mouse Speed variable, made the GUI look better ; v2009-08-23 - Reworked the entire script to use hotkeys and a variable harvest area ; v2009-08-24 - Finished the rewrite, cleaned and compacted the code, added Help button ; Just some things to remember... ; When zoomed all the way out, the below are true... ; Moving across columns, x+25, y-12 ; Moving down rows, x+25, y+12 ;*** Design Goals ; 1. Create a better looking interface ; Includes #include <GUIConstantsEx.au3> #include <EditConstants.au3> ; Define a few (global) variables $script_x = 0 $script_y = 0 $script_speed = 25 $script_size_columns = 4 $script_size_rows = 4 $script_running = 0 ; Hotkeys HotKeySet("{HOME}", "set_position") HotKeySet("{INSERT}", "start_script") HotKeySet("{DELETE}", "stop_script") ; Hotkey Functions Func set_position()     $script_x = MouseGetPos(0)     $script_y = MouseGetPos(1)         GUICtrlSetData($label_coordinate_x, $script_x)     GUICtrlSetData($label_coordinate_y, $script_y) EndFunc Func start_script()     GUICtrlSetColor($graphic_background, "0x33FF33") ;~  GUICtrlSetBkColor($button_help, "0x33FF33")     $script_running = 1 EndFunc Func stop_script()     GUICtrlSetColor($graphic_background, "0xF0F0F0") ;~  GUICtrlSetBkColor($button_help, "0xF0F0F0")     $script_running = 0 EndFunc $window_main = GUICreate("Farmville Bot", 200, 165) $graphic_background = GUICtrlCreateGraphic(0, 0, 200, 165) GUICtrlSetState($graphic_background, $GUI_DISABLE) GUICtrlCreateGroup("Coordinates", 5, 5, 75, 60) GUICtrlCreateLabel("X:", 20, 25, 50) GUICtrlCreateLabel("Y:", 20, 40, 50) $label_coordinate_x = GUICtrlCreateLabel($script_x, 40, 25, 30) $label_coordinate_y = GUICtrlCreateLabel($script_y, 40, 40, 30) $button_help = GUICtrlCreateButton("Help", 15, 95, 75, 45) GUICtrlCreateGroup("Size", 90, 5, 105, 61) GUICtrlCreateLabel("Columns:", 98, 20) $input_size_columns = GUICtrlCreateInput($script_size_columns, 145, 18, 40, 20) $updown_size_columns = GUICtrlCreateUpdown($input_size_columns) GUICtrlSetLimit($updown_size_columns, 20, 1) GUICtrlCreateLabel("Rows:", 98, 42) $input_size_rows = GUICtrlCreateInput($script_size_rows, 145, 40, 40, 20) $updown_size_rows = GUICtrlCreateUpdown($input_size_rows) GUICtrlSetLimit($updown_size_rows, 20, 1) GUICtrlCreateGroup("Mouse Speed", 110, 75, 85, 85) $input_speed = GUICtrlCreateInput($script_speed, 125, 95, 50, 20, $ES_CENTER) $updown_speed = GUICtrlCreateUpdown($input_speed) GUICtrlSetLimit($updown_speed, 50, 1) $button_speed_1 = GUICtrlCreateButton("1", 115, 120, 25, 15) $button_speed_5 = GUICtrlCreateButton("5", 140, 120, 25, 15) $button_speed_10 = GUICtrlCreateButton("10", 165, 120, 25, 15) $button_speed_15 = GUICtrlCreateButton("15", 115, 140, 25, 15) $button_speed_25 = GUICtrlCreateButton("25", 140, 140, 25, 15) $button_speed_50 = GUICtrlCreateButton("50", 165, 140, 25, 15) $window_help = GUICreate("Help", 170, 65, -1, -1, -1, 0, $window_main) GUICtrlCreateLabel("Home = Set starting coordinates", 10, 5) GUICtrlCreateLabel("Insert = Start the script", 10, 25) GUICtrlCreateLabel("Delete = Stop the script", 10, 45) GUISetState(@SW_SHOW, $window_main) While 1     If $script_running Then         ; Seriously, why is this even necessary...?         $script_size_columns = GUICtrlRead($input_size_columns)         $script_size_rows = GUICtrlRead($input_size_rows)                 farm()     EndIf             $script_speed = GUICtrlRead($input_speed)     $gui_msg = GUIGetMsg(1)         Select         Case $gui_msg[0] = $GUI_EVENT_CLOSE             If $gui_msg[1] = $window_main Then                 ExitLoop             ElseIf $gui_msg[1] = $window_help Then                 GUISetState(@SW_HIDE, $window_help)             EndIf         Case $gui_msg[0] = $button_help             GUISetState(@SW_SHOW, $window_help)         Case $gui_msg[0] = $button_speed_1             GUICtrlSetData($input_speed, "1")         Case $gui_msg[0] = $button_speed_5             GUICtrlSetData($input_speed, "5")         Case $gui_msg[0] = $button_speed_10             GUICtrlSetData($input_speed, "10")         Case $gui_msg[0] = $button_speed_15             GUICtrlSetData($input_speed, "15")         Case $gui_msg[0] = $button_speed_25             GUICtrlSetData($input_speed, "25")         Case $gui_msg[0] = $button_speed_50             GUICtrlSetData($input_speed, "50")     EndSelect     Sleep(25) WEnd Func farm()     ; Some (local) variables     $current_x = $script_x     $current_y = $script_y         For $current_row = 1 To $script_size_rows Step 1         For $current_column = 1 To $script_size_columns Step 1             MouseClick("primary", $current_x, $current_y, 1, $script_speed)                         $current_x = $current_x + 25             $current_y = $current_y - 12                                 If $current_row = $script_size_rows / 2  Then                     If $current_column = $script_size_columns / 2 Then                         $current_x = $current_x + 25                         $current_y = $current_y - 12                                                $current_column = $current_column + 1                     EndIf                 EndIf             If Not $script_running Then ExitLoop         Next                 ; Reset to beginning of row         $current_x = $current_x - (25 * $script_size_columns)         $current_y = $current_y - (-12 * $script_size_columns)                 ; Advance to the next row         $current_x = $current_x + 25         $current_y = $current_y + 12                 If Not $script_running Then ExitLoop     Next         ; Stop running now     stop_script() EndFunc  

This post has been edited by linder: 02 September 2009 - 01:08 AM


#29 User is offline   C2C 

  • Advanced Member
  • PipPip
  • Group: Full Members
  • Posts: 108
  • Joined: 17-January 08
  • Location:0x5649851

Posted 02 September 2009 - 09:58 AM

Its Jackalos script but modified to go in other direction when it finishes all the columns in the row, that way you dont waste time while the farmer walks it off
[ code='text' ]    ( ExpandCollapse - Popup )
;*** Farmville Bot ; v2009-07-30 - Now has a GUI, a target button, and optional avoidance of spawning square. ; v2009-07-31 - Added a Mouse Speed variable, made the GUI look better ; v2009-08-23 - Reworked the entire script to use hotkeys and a variable harvest area ; v2009-08-24 - Finished the rewrite, cleaned and compacted the code, added Help button ; Just some things to remember... ; When zoomed all the way out, the below are true... ; Moving across columns, x+25, y-12 ; Moving down rows, x+25, y+12 ;*** Design Goals ; 1. Create a better looking interface ; Includes #include <GUIConstantsEx.au3> #include <EditConstants.au3> ; Define a few (global) variables $script_x = 0 $script_y = 0 $script_speed = 0 $script_size_columns = 20 $script_size_rows = 4 $script_running = 0 $order = 0 ; Hotkeys HotKeySet("{1}", "set_position") HotKeySet("{2}", "start_script") HotKeySet("{3}", "stop_script") ; Hotkey Functions Func set_position()     $script_x = MouseGetPos(0)     $script_y = MouseGetPos(1)         GUICtrlSetData($label_coordinate_x, $script_x)     GUICtrlSetData($label_coordinate_y, $script_y) EndFunc Func start_script()     GUICtrlSetColor($graphic_background, "0x33FF33") ;~  GUICtrlSetBkColor($button_help, "0x33FF33")     $script_running = 1 EndFunc Func stop_script()     GUICtrlSetColor($graphic_background, "0xF0F0F0") ;~  GUICtrlSetBkColor($button_help, "0xF0F0F0")     $script_running = 0 EndFunc $window_main = GUICreate("Farmville Bot", 200, 165) $graphic_background = GUICtrlCreateGraphic(0, 0, 200, 165) GUICtrlSetState($graphic_background, $GUI_DISABLE) GUICtrlCreateGroup("Coordinates", 5, 5, 75, 60) GUICtrlCreateLabel("X:", 20, 25, 50) GUICtrlCreateLabel("Y:", 20, 40, 50) $label_coordinate_x = GUICtrlCreateLabel($script_x, 40, 25, 30) $label_coordinate_y = GUICtrlCreateLabel($script_y, 40, 40, 30) $button_help = GUICtrlCreateButton("Help", 15, 95, 75, 45) GUICtrlCreateGroup("Size", 90, 5, 105, 61) GUICtrlCreateLabel("Columns:", 98, 20) $input_size_columns = GUICtrlCreateInput($script_size_columns, 145, 18, 40, 20) $updown_size_columns = GUICtrlCreateUpdown($input_size_columns) GUICtrlSetLimit($updown_size_columns, 20, 1) GUICtrlCreateLabel("Rows:", 98, 42) $input_size_rows = GUICtrlCreateInput($script_size_rows, 145, 40, 40, 20) $updown_size_rows = GUICtrlCreateUpdown($input_size_rows) GUICtrlSetLimit($updown_size_rows, 20, 1) ;GUICtrlCreateGroup("Mouse Speed", 110, 75, 85, 85) ;$input_speed = GUICtrlCreateInput($script_speed, 125, 95, 50, 20, $ES_CENTER) ;$updown_speed = GUICtrlCreateUpdown($input_speed) ;GUICtrlSetLimit($updown_speed, 3000, 1) ;$button_speed_1 = GUICtrlCreateButton("1", 115, 120, 25, 15) ;$button_speed_5 = GUICtrlCreateButton("5", 140, 120, 25, 15) ;$button_speed_10 = GUICtrlCreateButton("10", 165, 120, 25, 15) ;$button_speed_15 = GUICtrlCreateButton("15", 115, 140, 25, 15) ;$button_speed_25 = GUICtrlCreateButton("25", 140, 140, 25, 15) ;$button_speed_50 = GUICtrlCreateButton("50", 165, 140, 25, 15) $window_help = GUICreate("Help", 170, 65, -1, -1, -1, 0, $window_main) GUICtrlCreateLabel("1 - Set starting coordinates", 10, 5) GUICtrlCreateLabel("2 - Start the script", 10, 25) GUICtrlCreateLabel("3 - Stop the script", 10, 45) GUISetState(@SW_SHOW, $window_main) While 1     If $script_running Then         ; Seriously, why is this even necessary...?         $script_size_columns = GUICtrlRead($input_size_columns)         $script_size_rows = GUICtrlRead($input_size_rows)                 farm()     EndIf             ;$script_speed = GUICtrlRead($input_speed)     $gui_msg = GUIGetMsg(1)         Select         Case $gui_msg[0] = $GUI_EVENT_CLOSE            If $gui_msg[1] = $window_main Then                 ExitLoop             ElseIf $gui_msg[1] = $window_help Then                 GUISetState(@SW_HIDE, $window_help)             EndIf     ;    Case $gui_msg[0] = $button_help     ;        GUISetState(@SW_SHOW, $window_help)     ;    Case $gui_msg[0] = $button_speed_1     ;        GUICtrlSetData($input_speed, "1")     ;    Case $gui_msg[0] = $button_speed_5      ;       GUICtrlSetData($input_speed, "5")      ;   Case $gui_msg[0] = $button_speed_10     ;        GUICtrlSetData($input_speed, "10")     ;    Case $gui_msg[0] = $button_speed_15     ;        GUICtrlSetData($input_speed, "15")     ;    Case $gui_msg[0] = $button_speed_25     ;        GUICtrlSetData($input_speed, "25")      ;   Case $gui_msg[0] = $button_speed_50     ;        GUICtrlSetData($input_speed, "50")     EndSelect     Sleep(25) WEnd Func farm()     ; Some (local) variables     $current_x = $script_x     $current_y = $script_y         For $current_row = 1 To $script_size_rows Step 1         For $current_column = 1 To $script_size_columns Step 1             MouseClick("primary", $current_x, $current_y, 1, $script_speed)                         If $order = 0 Then                 $current_x = $current_x + 25                 $current_y = $current_y - 12             Else                 $current_x = $current_x - 25                 $current_y = $current_y + 12             EndIf                         If Not $script_running Then ExitLoop         Next             If $order = 0 Then                 $order = 1                 $current_x = $current_x - 25                 $current_y = $current_y + 12             else                 $order = 0                 $current_x = $current_x + 25                 $current_y = $current_y - 12             EndIf         ; Reset to beginning of row         ;$current_x = $current_x - (25 * $script_size_columns)         ;$current_y = $current_y - (-12 * $script_size_columns)                 ; Advance to the next row         $current_x = $current_x + 25         $current_y = $current_y + 12                 If Not $script_running Then ExitLoop     Next         ; Stop running now     stop_script()     $order = 0 EndFunc    


#30 User is offline   wetwlly 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 47
  • Joined: 26-August 09

Posted 03 September 2009 - 01:12 AM

Quote

While 1
If $script_running Then
; Seriously, why is this even necessary...?
$script_size_columns = GUICtrlRead($input_size_columns)
$script_size_rows = GUICtrlRead($input_size_rows)

farm()
EndIf


could i insert sleep( 4 hours[whatever that is in miliseconds]) and then farm(), farm(), and if possible replanting.. and then loop the whole thing?

just need to figure out how to do the math and coords for making a market() and then make it click market and blueberries or whatever and then go back into farm().

maybe ill try that tonight. see how fail my farm is in the morning haha..

#31 User is offline   C2C 

  • Advanced Member
  • PipPip
  • Group: Full Members
  • Posts: 108
  • Joined: 17-January 08
  • Location:0x5649851

Posted 03 September 2009 - 06:54 PM

View Postwetwlly, on 02 September 2009 - 04:12 PM, said:

could i insert sleep( 4 hours[whatever that is in miliseconds]) and then farm(), farm(), and if possible replanting.. and then loop the whole thing?

just need to figure out how to do the math and coords for making a market() and then make it click market and blueberries or whatever and then go back into farm().

maybe ill try that tonight. see how fail my farm is in the morning haha..


you could make it so that another hotkey defines the market button and just so you dont have to do it over and over again write all of the info to the ini file, make an input field where you input the hours and thats the sleep period, ofcourse add an extra 10 minutes for all the crops to grow in order to be harvested. was thinking about the same thing actually but i dont like my computer running while im away

#32 User is offline   DWad 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 22
  • Joined: 24-January 06

Posted 03 September 2009 - 07:39 PM

Hey all.

I wrote a pretty basic script for clicking through a user-defined amount of squares, source is on http://newtechrevolution.blogspot.com. I also wrote a tree harvester (also available on the page)

Source for tree harvester is-

[ code='text' ]    ( ExpandCollapse - Popup )
While 1 HotKeySet ("{pause}", "HarvestTree") HotKeySet ("{9}", "HarvestTreeOp") HotKeySet ("{esc}", "exitScript") WEnd Func exitScript()     Exit EndFunc Func HarvestTree()             $startPos = MouseGetPos()                 For $i = 30 to 1 Step -1         $pos = MouseGetPos()            MouseMove($pos[0]-4,$pos[1]-2, 1)                 MouseClick("left")                 $pSum = PixelChecksum($pos[0],$pos[1],$pos[0]+15, $pos[1]+53)                 If $pSum = 1847393948 Then             $tPos=MouseGetPos()             MouseMove($tPos[0]+1,$tPos[1]+1)             MouseClick("left",$pos[0]+15, $pos[1]+53)             mousemove($startPos[0],$startPos[1])             HarvestTree()                         Sleep (4000)                     EndIf         Next         $pos = MouseGetPos() EndFunc Func HarvestTreeOp()             $startPos = MouseGetPos()                 For $i = 30 to 1 Step -1         $pos = MouseGetPos()            MouseMove($pos[0]+4,$pos[1]-2, 1)                 MouseClick("left")                 $pSum = PixelChecksum($pos[0],$pos[1],$pos[0]+15, $pos[1]+53)                 If $pSum = 1847393948 Then             $tPos=MouseGetPos()             MouseMove($tPos[0]+1,$tPos[1]+1)             Mouseclick("left",$pos[0]+15, $pos[1]+53)             mousemove($startPos[0],$startPos[1])             HarvestTreeOp()             Sleep (4000)         EndIf         Next         $pos = MouseGetPos() EndFunc  


Pretty simple, just clicks from bottom right to upper left tree until it sees the checksum for the 'harvest' button pop up (in relation to mouse position), clicks it, and starts over again. Farmer must be trapped for it to be useful though.

#33 User is offline   linder 

  • Newbie
  • Group: Full Members
  • Posts: 7
  • Joined: 01-September 09

Posted 04 September 2009 - 02:23 AM

View Postlinder, on 02 September 2009 - 01:07 AM, said:

Tried to edit my last posts but this forum doesnt let me to :/


I did manage to fix a "plow-plant-soybean-delete" script using Jackalo maincode (not much is like it was from the begining tho)


And as I have never ever worked with scripting before. I couldnt figure out how to fix it for different resolutions etc so this only works for ppl with same resolution as me, 1280x800 ... And I also bet it doesnt work on farms smaller then 20x20, but cant see why that should be a problem as you arent supposed to use this method with a farm smaller than 20x20.

[ autoIt ]    ( ExpandCollapse - Popup )
; This script require a 20x20 farm and a 1280 x 800 resolutin ; Includes #include <GUIConstantsEx.au3> #include <EditConstants.au3> ; Define a few (global) variables $script_speed = 30 $script_amount = 4 $script_running = 0 ; Hotkeys HotKeySet("{INSERT}", "start_script") HotKeySet("{DELETE}", "stop_script") ; Hotkey Functions Func start_script()     GUICtrlSetColor($graphic_background, "0x33FF33") ;~  GUICtrlSetBkColor($button_help, "0x33FF33")     $script_running = 1 EndFunc Func stop_script()     GUICtrlSetColor($graphic_background, "0xF0F0F0") ;~  GUICtrlSetBkColor($button_help, "0xF0F0F0")     $script_running = 0 EndFunc $window_main = GUICreate("Beanbot", 100, 145) $graphic_background = GUICtrlCreateGraphic(0, 0, 200, 165) GUICtrlSetState($graphic_background, $GUI_DISABLE) GUICtrlCreateGroup("Amount", 10, 5, 85, 40) $input_amount = GUICtrlCreateInput($script_amount, 12, 18, 80, 20, $ES_CENTER) $updown_amount = GUICtrlCreateUpdown($input_amount) GUICtrlSetLimit($updown_amount, 20, 1) GUICtrlCreateGroup("Mouse Speed", 10, 50, 85, 40) $input_speed = GUICtrlCreateInput($script_speed, 12, 63, 80, 20, $ES_CENTER) $updown_speed = GUICtrlCreateUpdown($input_speed) GUICtrlSetLimit($updown_speed, 50, 1) GUICtrlCreateLabel("Insert = Start", 10, 100) GUICtrlCreateLabel("Delete = Stop", 10, 120) GUISetState(@SW_SHOW, $window_main) While 1     If $script_running Then                         $script_amount = GUICtrlRead($input_amount)                 farm()     EndIf             $script_speed = GUICtrlRead($input_speed)     $gui_msg = GUIGetMsg(1)     Select         Case $gui_msg[0] = $GUI_EVENT_CLOSE             If $gui_msg[1] = $window_main Then                 ExitLoop             EndIf     EndSelect     Sleep(25) WEnd Func farm()     For $current_amount = 1 To $script_amount Step 1         MouseClick("primary", 948, 707, 1, $script_speed) ;plow1     MouseClick("primary", 945, 648, 1, $script_speed) ;plow2     MouseClick("primary", 1112, 414, 1, $script_speed) ;last square ;   MouseClick("primary", 1087, 402, 1, $script_speed) ;2nd square ;   MouseClick("primary", 1087, 426, 1, $script_speed) ;3rd square     MouseClick("primary", 940, 768, 1, $script_speed) ;market     MouseClick("primary", 846, 452, 1, $script_speed) ;soybeans     MouseClick("primary", 1112, 414, 1, $script_speed) ;1st square ;   MouseClick("primary", 1087, 402, 1, $script_speed) ;2nd square ;   MouseClick("primary", 1087, 426, 1, $script_speed) ;3rd square     MouseClick("primary", 997, 707, 1, $script_speed) ;delete     MouseClick("primary", 1112, 414, 1, $script_speed) ;lst square     If Not $script_running Then ExitLoop  ;this is before delete accept just for safety             MouseClick("primary", 569, 493, 1, $script_speed) ;delete accept ;   MouseClick("primary", 1087, 402, 1, $script_speed) ;2nd square ;   MouseClick("primary", 569, 493, 1, $script_speed) ;delete accept ;   MouseClick("primary", 1087, 426, 1, $script_speed) ;3rd square ;   MouseClick("primary", 569, 493, 1, $script_speed) ;delete accept   Next ; Stop running now     stop_script() EndFunc  


Updated after the change in market, soybeans changed from 5th to 4th place

also put in so you can choose if you want to go with 1,2 or 3 squares for this

http://img196.imageshack.us/img196/9667/soybeandel.jpg

Just to let you know, with 3 squares it takes aprox 19sec to plow, plant, delete with costs 90coins and you gain 9xp, that is 2 seconds per xp...


Short explain on soybean deletemethod...

Its the best exp/money in the game! (except architec ribbon) ...
and it will give you 1xp/10coin


I have gone from 15000xp to 45000xp in 3days using this method

This post has been edited by linder: 04 September 2009 - 02:44 AM


#34 User is offline   Zinthose 

  • Advanced Member
  • PipPip
  • Group: Full Members
  • Posts: 126
  • Joined: 17-April 08
  • Location:Ohio USA

Posted 04 September 2009 - 02:56 AM

This is just what I'm working on at the moment .. feel free to pick it apart and add to your scripts.

[ autoIt ]    ( ExpandCollapse - Popup )
Global Const $curHarvest[2][3] = [[27,18,0x13A89E], [19,31,0xD1D2D4]] Global Const $curMarket[3][3] = [[10,10,0xC49A6C], [16,32,0xEF4036], [25,28,0xFCB040]] Global Const $curHoe[3][3] = [[26,17,0x39B54A], [19,28,0xD1D2D4], [12,38,0xC9CACC]] Global Const $curShovel[3][3] = [[29,14,0xEF4036], [20,29,0xD1D2D4],[16,28,0x939598]] Global $WorkingArea[4] = [162,223,162+760,223+612] Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("MouseCoordMode",0) Opt("PixelCoordMode",0) HotKeySet("{Esc}", "captureEsc") If WinWait("FarmVille on Facebook - Mozilla Firefox","", 5) = 0 Then     ShellExecute("http://apps.facebook.com/onthefarm/index.php?ref=tab") EndIf WinWait("FarmVille on Facebook - Mozilla Firefox","", 30) $hWnd = WinGetHandle("FarmVille on Facebook - Mozilla Firefox","") If Not WinActive("FarmVille on Facebook - Mozilla Firefox","") Then WinActivate("FarmVille on Facebook - Mozilla Firefox","") WinWaitActive("FarmVille on Facebook - Mozilla Firefox","") While 1     If WinWait("FarmVille on Facebook - Mozilla Firefox","", 30) = 0 Then         ShellExecute("http://apps.facebook.com/onthefarm/index.php?ref=tab")         ContinueLoop     EndIf     $hWnd = WinGetHandle("FarmVille on Facebook - Mozilla Firefox","")     If Not WinActive("FarmVille on Facebook - Mozilla Firefox","") Then WinActivate("FarmVille on Facebook - Mozilla Firefox","")     WinWaitActive("FarmVille on Facebook - Mozilla Firefox","")     ;## Zoom to max         Sleep(15000)         MouseClick("primary",835,709,4,0)     For $i = 1 to 3         HarvestSearch()         HarvestSearch()         HarvestSearch()         PlowSearch()         PlowSearch()         AnimalSearch()         AnimalSearch()         MarketSearch()         MarketSearch()         Sleep(10000)     Next     WinClose("FarmVille on Facebook - Mozilla Firefox","")     $Wait = Random(1800000, 7200000, 1)     LogEvent("Waiting for " & $Wait / 1000 / 60 & " minutes for next cycle.")     Sleep($Wait) WEnd ;## TODO: Function currently only assumes you planted tomatos     Func HarvestSearch($hWnd = Default)         Local Const $PlotColor = 0xD03212;  <-- Red part of Tomatoes         Local $Coord         Local $x = 0         Local $y = 0         Local $SearchArea         LogEvent("Searching for plots that need harvested.")         ;## Multi Tool             MouseClick("primary",808,753,2,1)         For $y = $WorkingArea[1] To $WorkingArea[3]             For $x = $WorkingArea[0] To $WorkingArea[2]                 $Coord = PixelSearch($x,$y,$WorkingArea[2],$y,$PlotColor,5,1,$hWnd)                 If @error Then ExitLoop                 MouseMove($Coord[0], $Coord[1], 1)                 Sleep(300)                 If CheckPixelPattern($Coord, $curHarvest) Then                     LogEvent("+> Plot ready for harvest!")                     ;## Click Plot                         MouseClick("primary", $Coord[0], $Coord[1],1,2)                     ;## Multi Tool                         MouseClick("primary",808,753,2,2)                 EndIf                 $x = $Coord[0] + 1             Next         Next     EndFunc Func PlowSearch($hWnd = Default)     Local Const $PlotColor = 0x7A6311     Local $Coord     Local $x = 0     Local $y = 0     Local $SearchArea     LogEvent("Searching for plots that need plowed.")     ;## Multi Tool         MouseClick("primary",808,753,2,1)     For $y = $WorkingArea[1] To $WorkingArea[3]         For $x = $WorkingArea[0] To $WorkingArea[2]             $Coord = PixelSearch($x,$y,$WorkingArea[2],$y,$PlotColor,5,5,$hWnd)             If @error Then ExitLoop             MouseMove($Coord[0], $Coord[1], 1)             Sleep(300)             If CheckPixelPattern($Coord, $curHoe) Then                 LogEvent("+> Plot ready for plowing!")                 ;## Click Plot                     MouseClick("primary", $Coord[0], $Coord[1],1,2)                 ;## Multi Tool                     MouseClick("primary",808,753,2,2)             EndIf             $x = $Coord[0] + 1         Next     Next EndFunc Func MarketSearch($hWnd = Default)     Local Const $PlotColor = 0x843b10     Local $Coord     Local $x = 0     Local $y = 0     Local $SearchArea     $SearchArea = $WorkingArea     LogEvent("Searching for plots that need planted.")     MouseClick("primary",808,753,2,1)     For $y = $WorkingArea[1] To $WorkingArea[3]         For $x = $WorkingArea[0] To $WorkingArea[2]             $Coord = PixelSearch($x,$y,$WorkingArea[2],$y,$PlotColor,0,1,$hWnd)             If @error Then ExitLoop             MouseMove($Coord[0], $Coord[1], 1)             Sleep(300)             If CheckPixelPattern($Coord, $curMarket) Then                 LogEvent("+> Plot ready for Planting!")                 ;## Click Plot                     MouseClick("primary", $Coord[0], $Coord[1],1,1)                     Sleep(500)                 ;## Select Tomatoes                     MouseClick("primary",838,582,1,30)                     Sleep(200)                     MouseClick("primary",838,582,1,2)                     Sleep(500)                     MouseClick("primary",546,740,1,5)                 ;;## Select Strawberries                 ;   MouseClick("primary",402,587,1,20)                 ;   Sleep(250)                 ;## Multi Tool                     MouseClick("primary",808,753,2,0)                 Sleep(1000)             EndIf             $x = $Coord[0] + 1         Next     Next EndFunc Func AnimalSearch($hWnd = Default)     Const $AnimalGlow = 0xFFCFF0     Local $x = $WorkingArea[0], $y = $WorkingArea[1]     Local $Coord     LogEvent("Searching for animals that need collected/harvested.")     While 1         $Coord = PixelSearch($x, $y, $WorkingArea[2], $WorkingArea[3], $AnimalGlow, 0, 1, $hWnd)         If @error Then Return         MouseMove($Coord[0], $Coord[1] + 2, 1)         Sleep(300)         If CheckPixelPattern($Coord, $curHarvest) Then             LogEvent("+> Animal ready for harvest!")             MouseClick("primary", $Coord[0], $Coord[1] + 2,1, 1)             MouseClick("primary", $Coord[0] + 16, $Coord[1] + 54,1, 10)         Else             ;LogEvent($Coord[0] & " " & $Coord[1] & " !! Not Harvestable!!")             ;Sleep(5000)         EndIf         $y = $Coord[1] + 1     WEnd EndFunc Func CheckPixelPattern($Coord, $Pattern, $hWnd = Default)     Local $i     For $i = 0 To UBound($Pattern, 1) - 1         If PixelGetColor($Coord[0] + $Pattern[$i][0], $Coord[1] + $Pattern[$i][1], $hWnd) <> $Pattern[$i][2] Then             LogEvent("Failed: " & $i & " - 0x" & Hex(PixelGetColor($Coord[0] + $Pattern[$i][0], $Coord[1] + $Pattern[$i][1], $hWnd),6))             Return False         EndIf     Next     Return True EndFunc Func LogEvent($Message)     ConsoleWrite("+> " & @YEAR & @MON & @MDAY & @HOUR & @SEC & "." & @MSEC & @TAB & $Message & @CRLF) EndFunc

FYI: They updated the game again so some of these function are broken untill I can update them.
http://facebook2.farmville.static.zynga.com/current/v4633/gameSettings.xml

This post has been edited by Zinthose: 04 September 2009 - 03:07 AM


#35 User is offline   Malakai 

  • Newbie
  • Group: Full Members
  • Posts: 8
  • Joined: 04-September 09

Posted 04 September 2009 - 05:02 PM

anybody feel like adding ini file support for the above scripts. Being able to save where our plots are negates the need for resolution matched scripts.


Currently looking to do that but don't have the free time to learn ini writing/reading today

#36 User is offline   wetwlly 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 47
  • Joined: 26-August 09

Posted 05 September 2009 - 02:56 AM

im pretty sure you could just make a couple hotkeys that get the coords of where you want to start clicking on plots, one for coords to delete accept, and one to the harvest button and finally to the seed you want to plant. and just make different option menu on what you want it to do.

maybe i will start working on it (got banned from wow for unknown!!!), but i gotta get a library to autoit, i only know C++.. but ya! anyone got a library of autoit language.

cause i would just be like

hotkey= current x,y store as plotcoords ( to do the 20x20)
hotkey2 = currentx,y stores as harvestbutton
and so on.

#37 User is offline   wetwlly 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 47
  • Joined: 26-August 09

Posted 05 September 2009 - 04:49 AM

[ code='text' ]    ( ExpandCollapse - Popup )
While $i < $loop ; all defined in the beginning     If $script_running Then         $script_size_columns = GUICtrlRead($input_size_columns)         $script_size_rows = GUICtrlRead($input_size_rows)                         farm()         Sleep(60000)                 ;waits 60000, for finishing harvesting/plowing         farm()         Sleep(60000)         harvest()                 ;clicks harvest button         Sleep(1000)         arrow()                 ;clicks arrow, add more if needed         Sleep(1000)         selectcrop()                 ;selects ur crop         Sleep(1000)         farm()         $i = $i + 1         Sleep($script_seedtime) WEnd


would this work as an auto overnight? :)

the rest of the script is completed. but just wanna make sure the loop sequence looks right. please comment if it doesnt look correct.

also i cant seem to close the bot out when i open this, i have to usually end process.. any clues on fixing that?

any way to make a hotkey kill the script?

This post has been edited by wetwlly: 05 September 2009 - 04:58 AM


#38 User is offline   wetwlly 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 47
  • Joined: 26-August 09

Posted 05 September 2009 - 07:29 AM

[ code='text' ]    ( ExpandCollapse - Popup )
;*** Farmville Bot ; v2009-09-05 - !revised so you dont have to use a million hotkeys, now just set on first plot/multitool and the crop you want on the second page(add more arrows if more pages) ; v2009-09-05 - added multitool in so it can continue on replanting (does both clicks! on the button and then on the tool and not the tractors!) ; v2009-09-04 - Work in Progress: added more hotkeys to make it farm completed crops, then plow, clicks harvest button (set by key 1), ;               clicks arrow (key 2) if you want, or just take it off with all the other things for arrow, select crop (set by key 3!) ;               not fully completed though. ; v2009-07-30 - Now has a GUI, a target button, and optional avoidance of spawning square. ; v2009-07-31 - Added a Mouse Speed variable, made the GUI look better ; v2009-08-23 - Reworked the entire script to use hotkeys and a variable harvest area ; v2009-08-24 - Finished the rewrite, cleaned and compacted the code, added Help button ; Just some things to remember... ; When zoomed all the way out, the below are true... ; Moving across columns, x+25, y-12 ; Moving down rows, x+25, y+12 ;*** Design Goals ; 1. Create a better looking interface ; press "1" is for harvest button ; press "2" is the crop you want ;Credit : Jackalo (whole script),  me*wetwlly*(just modding and copypasta) ; Includes #include <GUIConstantsEx.au3> #include <EditConstants.au3> ; Define a few (global) variables $loop = 5 ;$loop is a loop, how many times you want to loop the script! example loop = 10 $i = 1 $script_x = 0 $script_y = 0 $script_x3 = 0 $script_y3 = 0 $script_x6 = 0 $script_y6 = 0 $script_speed = 5 ;seedtime is whatever the crop is in milliseconds and then also add 60000, to add 10 minutes so all ur crops are ready ;but for now since this is a test its set to 1 second. $script_seedtime = 1500000 $script_size_columns = 20 $script_size_rows = 12 $script_running = 0 ; Hotkeys HotKeySet("{1}", "set_multitool") HotKeySet("{2}", "set_crop") HotKeySet("{HOME}", "set_position") HotKeySet("{INSERT}", "start_script") HotKeySet("{DELETE}", "stop_script") ; Hotkey Functions Func set_multitool()     $script_x6 = MouseGetPos(0)     $script_y6 = MouseGetPos(1) EndFunc Func set_crop()     $script_x3 = MouseGetPos(0)     $script_y3 = MouseGetPos(1) EndFunc Func set_position()     $script_x = MouseGetPos(0)     $script_y = MouseGetPos(1)     GUICtrlSetData($label_coordinate_x, $script_x)     GUICtrlSetData($label_coordinate_y, $script_y) EndFunc Func start_script()     GUICtrlSetColor($graphic_background, "0x33FF33") ;~  GUICtrlSetBkColor($button_help, "0x33FF33")     $script_running = 1 EndFunc Func stop_script()     GUICtrlSetColor($graphic_background, "0xF0F0F0") ;~  GUICtrlSetBkColor($button_help, "0xF0F0F0")     $script_running = 0 EndFunc $window_main = GUICreate("Farmville Bot", 200, 165) $graphic_background = GUICtrlCreateGraphic(0, 0, 200, 165) GUICtrlSetState($graphic_background, $GUI_DISABLE) GUICtrlCreateGroup("Coordinates", 5, 5, 75, 60) GUICtrlCreateLabel("X:", 20, 25, 50) GUICtrlCreateLabel("Y:", 20, 40, 50) $label_coordinate_x = GUICtrlCreateLabel($script_x, 40, 25, 30) $label_coordinate_y = GUICtrlCreateLabel($script_y, 40, 40, 30) $button_help = GUICtrlCreateButton("Help", 15, 95, 75, 45) GUICtrlCreateGroup("Size", 90, 5, 105, 61) GUICtrlCreateLabel("Columns:", 98, 20) $input_size_columns = GUICtrlCreateInput($script_size_columns, 145, 18, 40, 20) $updown_size_columns = GUICtrlCreateUpdown($input_size_columns) GUICtrlSetLimit($updown_size_columns, 20, 1) GUICtrlCreateLabel("Rows:", 98, 42) $input_size_rows = GUICtrlCreateInput($script_size_rows, 145, 40, 40, 20) $updown_size_rows = GUICtrlCreateUpdown($input_size_rows) GUICtrlSetLimit($updown_size_rows, 20, 1) $window_help = GUICreate("Help", 170, 85, -1, -1, -1, 0, $window_main) GUICtrlCreateLabel("Home = Set starting coordinates", 10, 5) GUICtrlCreateLabel("Insert = Start the script", 10, 25) GUICtrlCreateLabel("Delete = Stop the script", 10, 45) GUICtrlCreateLabel("1/2/3 = harvstbuton/arrow/crop", 10, 65) GUISetState(@SW_SHOW, $window_main) While $i < $loop     If $script_running Then         $script_size_columns = 20         $script_size_rows = 12                 harvest()         Sleep(1000)         arrow()         Sleep(1000)         selectcrop()         Sleep(1000)         farm()         $i = $i + 1         Sleep($script_seedtime)         friend()         Sleep(1000)         multitool()         Sleep(1000)         farm()         Sleep(60000)         farm()         Sleep(60000)     EndIf WEnd Func harvest()     $current_x4 = $script_x6 + 47     $current_y4 = $script_y6 + 54     MouseClick("primary", $current_x4, $current_y4, 1, 100) EndFunc Func friend()     $current_x5 = $script_x6 - 226     $current_y5 = $script_y6 - 436     MouseClick("primary", $current_x5, $current_y5, 1, 100)     MouseClick("primary", $current_x5, $current_y5, 1, 100)     MouseClick("primary", $current_x5, $current_y5, 1, 100)     MouseClick("primary", $current_x5, $current_y5, 1, 100) EndFunc Func selectcrop()     MouseClick("primary", $script_x3, $script_y3, 1, 100) EndFunc Func arrow()     $current_x3 = $script_x6 + 65     $current_y3 = $script_y6 - 143     MouseClick("primary", $current_x3, $current_y3, 1, 100) EndFunc Func multitool()     $current_x6 = $script_x6     $current_y6 = $script_y6 - 70         MouseClick("primary", $script_x6, $script_y6, 1, 100)     MouseClick("primary", $current_x6, $current_y6, 1, 100)     EndFunc Func farm()     ; Some (local) variables     $current_x = $script_x     $current_y = $script_y         For $current_row = 1 To $script_size_rows Step 1         For $current_column = 1 To $script_size_columns Step 1             MouseClick("primary", $current_x, $current_y, 1, $script_speed)                         $current_x = $current_x + 25             $current_y = $current_y - 12                             If Not $script_running Then ExitLoop         Next                 ; Reset to beginning of row         $current_x = $current_x - (25 * $script_size_columns)         $current_y = $current_y - (-12 * $script_size_columns)                 ; Advance to the next row         $current_x = $current_x + 25         $current_y = $current_y + 12                 If Not $script_running Then ExitLoop         Next EndFunc         ; Stop running now     stop_script()


This is what i have so far, only problem is, you have to stop it by process usually, and its time is for blueberries/strawberries, plus if u get friend farm requests to rake and shit, your screwed. :)

EDIT: just revised it this morning (at 6am!)
now you dont need to set a million hotkeys it just does the calculation to the next points.

if you need it to go to other pages add more arrow() into main script.

still is not supported when you level. ill have that up soon once i level.

uh its made for you to do 20 columns by 12 rows cause thats the max screen i can get unless someone can tell me how to expand it more to get 20x20.
its speed is 100 while moving around the screen, and 5 when plowing/harvesting.

button 1 is to set multi tool!, 2 is for the crop you want, the rest are still the same

all credit goes to jackalo, all i did was some randomness work :D

to be added (suggestions?):
maybe a delete script, dunno how that will go down for a 20x12.
and of course exiting out of the level congrats screen and then publish window that pops up after it.

please give me feedback :)

This post has been edited by wetwlly: 05 September 2009 - 02:56 PM


#39 User is offline   Malakai 

  • Newbie
  • Group: Full Members
  • Posts: 8
  • Joined: 04-September 09

Posted 06 September 2009 - 02:32 AM

anyone know how to get this working

MouseClick("primary", $crop, 1, $script_speed) ;soybeans

must I give it two seperate variables,(ie cropx and cropy)

or is there a way to do
$crop = 748,449

didnt work, gives a compile error

neither does
$crop = 748 & "," & 449
nor does
$crop = "748, 449"



am I limited to either using multiple variables, or an array? or am I missing something

This post has been edited by Malakai: 06 September 2009 - 02:35 AM


#40 User is offline   Malakai 

  • Newbie
  • Group: Full Members
  • Posts: 8
  • Joined: 04-September 09

Posted 06 September 2009 - 03:10 AM

^

I'm trying to reduce the ammount of variables for cleaner/easier to manage code.


String() didnt work either in various forms, same with isString()

  • (26 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

5 User(s) are reading this topic
0 members, 5 guests, 0 anonymous users

  1. MSN/Bing