Facebook Farmville
Unfortunately I seem to be rubbish at this.
My problem seems to be that I can't figure out where in the script the input for row size is. If I have a row of 15, how do I tell it to go down and left after it's done 15 squares? After that it's just a matter of looping I guess.
Thanks in advance for any tips.
!^c:: GoSub GetFarmSq GoSub Getfirstsq i=1 Click %startx%,%starty% newx=%startx% newy=%starty% Loop, %farmy% { Loop, %farmx% { Click %newx%,%newy% newx+=25 newy-=12 Click %newx%,%newy% sleep 200 i++ } newx+=25 newy+=12 Click %newx%,%newy% Loop, %farmx% { newx-=25 newy+=12 Click %newx%,%newy% sleep 200 i++ } newx+=25 newy+=12 startx+=25 starty+=12 sleep 200 } return GoSub Getfirstsq GetFarmsq: Inputbox, farmx, Hey There, Enter the number of squares in your top row, ,100,150 Inputbox, farmy, Hey There, Enter half the number of squares in long, ,100,150 ;msgbox, you said your farm was %farmx% x %farmy% farmx-- return Getfirstsq: Msgbox, Click the middle of the top left square KeyWait, LButton, D KeyWait, LButton, D MouseGetPos, startx, starty return !^x::reload Return
I cheat and just trap my little dude with bails of hay, been messing about with getting it in full screen a little, when it stays, works like a dream, but farmville seems to throw a paddy sometime going to full screen
I did leave out some key points, you must zoom all the way out to use it... and I just figured out this trapping the farmer trick... I've got my farmer trapped in the bottom right corner by 3 hay bales.... he doesn't wander the farm to do anything now.
As far as going down and then left, I chose the pattern I did because it was easiest to code, not for efficiency. If you always go right left, than you need to do more math... not my strong point, and divide by two so you know whether to go left at the bottom or right at the bottom... in my head anyway.
the loop is nested, so the first loop handles the vertical.... and the inside loop is the horizontal... hopefully that helps. if you still can't figure it out, I might have time tomorrow to play some more. the hardest part was figuring out the size of the plots.
I want to work it out so that it checks the color of the plot and makes sure it's plant-able...
Here's the current code... added a default size to your plot size so that you only have to hit enter unless it changes, or you need to do something custom.
!^c:: GoSub GetFarmSq GoSub Getfirstsq i=1 Loop, %farmy% { Click %startx%,%starty% newx=%startx% newy=%starty% Loop, %farmx% { newx+=25 newy-=12 Click %newx%,%newy% i++ } startx+=25 starty+=12 } return GoSub Getfirstsq GetFarmsq: Inputbox, farmx, Hey There, Enter the number of squares in your top row,,100,150,,,,,14 if ErrorLevel GoSub Esc Inputbox, farmy, Hey There, Enter the number of squares in long,,100,150,,,,,14 if ErrorLevel GoSub Esc ;msgbox, you said your farm was %farmx% x %farmy% farmx-- return Getfirstsq: Msgbox, Click the middle of the top left square KeyWait, LButton, D KeyWait, LButton, D MouseGetPos, startx, starty return Esc: !^x::reload Return
You can see my little dude on the far right, and his status of plowing.
I just found this.... SetMouseDelay, 0
Add that to the top of the script, takes much less time.. I can't wait to use it on all 16 rows.
I've been trying to optimize this script to follow a more efficient pattern (going right on the first row, then left, rinse and repeat, that way your little dude doesn't have to walk all the way back every time.)
Although I have annihilated this script for my own purposes to entertain a basic pattern I have learnt enough to help you with this. If you have an odd number of Y fields it will probably attempt to do an extra line. I am unsure how to stop that from happening, but this will do as you asked.
Left to right..... next line
Right to left.... next line
left to right... etc
!^c:: GoSub GetFarmSq GoSub Getfirstsq i=1 cycle := farmy/2 newx=%startx% newy=%starty% loop, %cycle% { Click %newx%,%newy% Loop, %farmx% { newx+=25 newy-=12 Click %newx%,%newy% } newx+=25 newy+=12 Click %newx%,%newy% Loop, %farmx% { newx-=25 newy+=12 Click %newx%,%newy% } newx+=25 newy+=12 } return GoSub Getfirstsq GetFarmsq: Inputbox, farmx, Hey There, Enter the number of squares in your top row,,100,150,,,,,14 if ErrorLevel GoSub Esc Inputbox, farmy, Hey There, Enter the number of squares in long,,100,150,,,,,14 if ErrorLevel GoSub Esc ;msgbox, you said your farm was %farmx% x %farmy% farmx-- return Getfirstsq: Msgbox, Click the middle of the top left square KeyWait, LButton, D KeyWait, LButton, D MouseGetPos, startx, starty return Esc: !^x::reload Return
add this line to the script anywhere.
pause::Pause
now Run the script, when you now need to click on your first location, just press pause|break on the keyboard to pause the script. Go ahead and toggle fullscreen on farmville. zoom out twice, then press pause,break on keyboard and select your first location.
anyone tried to do one for the Soybean-delete method?
this script wait and klikk on okay its only an idea depends on pc where will it appear:P
!^Lbutton:: MouseGetPos, KezdoDestroyX, KezdoDestroyY click KezdoDestroyX, KezdoDestroyY ;Msgbox, kérem a várakozási idot az okéig (nagyban függ a gépsebességtol, netkapcsolattól) ;inputbox, WT,WT,wait time (WT), ,50,150 ;sleep %WT% sleep 800 click 472,503 MouseMove KezdoDestroyX, KezdoDestroyY;autoharvestklikk állatokon, fákon, használata: egy klikk és harvestol loopba rakva autoharvestálhat is:) 232,384 261,444
This script working, if u use this hotkey control+rightclick, dont need to click on harvest in pop-up menu working after 10th level (sell func). working on animals and trees.
^Rbutton:: MouseGetPos, HarvestLocX, HarvestLocY click HarvestLocX, HarvestLocY x1 := HarvestLocX + 48 y1 := HarvestLocY + 53 sleep 50 click %x1%,%y1% sleep 10 MouseMove HarvestLocX, HarvestLocY
Foolproof script based on the inital poster's one. Improved it to work for any farm, as long as you zoom out to the maximum.
(do note, when you trap your farmer with hay bales, you WILL click him or the haybales whenever you're harvesting. Whenever you have the plow tool or the plant tool selected, you will be able to just type in your entire farm ... 18x18 20x20 22x22 etc, you wont click your Farmerdude)
Script:
!^p:: GoSub GetFarmSq GoSub Getfirstsq looptimes := farmy // 2 checkmod := mod(farmy,2) newx := startx + 25 newy := starty - 12 oldx := startx - 25 oldy := starty + 12 nextx := startx + 25 nexty := starty + 12 if (farmy = 1) goto singleLine else if (farmy > 1) goto multiLine multiLine: Loop, %looptimes% { Click %startx%,%starty% Loop, %farmx% { Click %newx%,%newy% MouseClickDrag, L, newx, newy, startx, starty sleep 200 } Click %nextx%,%nexty% MouseClickDrag, L, nextx, nexty, startx, starty sleep 200 Loop, %farmx% { Click %oldx%,%oldy% MouseClickDrag, L, oldx, oldy, startx, starty sleep 200 } Click %nextx% %nexty% MouseClickDrag, L, nextx, nexty, startx, starty sleep 200 } if (checkmod = 0) msgbox, Done else if (checkmod = 1) { Loop, %farmx% { Click %newx%,%newy% MouseClickDrag, L, newx, newy, startx, starty sleep 200 } msgbox, Done } return singleLine: Click %startx%,%starty% Loop, %farmx% { Click %newx%,%newy% MouseClickDrag, L, newx, newy, startx, starty sleep 200 } msgbox, Done return GoSub Getfirstsq GetFarmsq: Inputbox, farmx, Hey There, Enter the number of squares in your top row, ,100,150 Inputbox, farmy, Hey There, Enter the number of squares in long, ,100,150 msgbox, you said your farm was %farmx% x %farmy% farmx-- return Getfirstsq: Msgbox, Click the middle of the top left square KeyWait, LButton, D KeyWait, LButton, D MouseGetPos, startx, starty return !^x::reload Return
start key got changed to CTRL ALT P (ctrl alt x to reload stayed)
Credits to Bearclaw for a nice base to start off.
(the phailsquares were done by me, cause i'm pro like that =^___^= .. it has nothing to do with the script)
JavaScript would do.
Just a tip to get you all started
Just create a program that calculates all the mouseClicks and that generates the .ahk file for you, according to a set of parameters (like screen resolution, fullscreen button coordinates, window name, farm size, etc).
JavaScript would do.
Just a tip to get you all started
You add this like we haven't' developed a couple scripts that do what we need... now granted more ideas are always good, but at this time, we've got scripts that work, I'd be happy to see your solution though.