New GUI here
Simple autoclicker script, needs xdotool installed
Download here
For default settings (12x12) use: sh farmville_click.sh
Or custom mode: sh farmville_click.sh num_rows num_columns click_interval_time wait_interval_before_pointing
If give this error(Syntax error: Bad for loop variable), use bash (bash farmville_click.sh)
Download old script here (bash script for *nix based)
Hi... Your script is awesome!!! It works great!! I made a few fixes... but nothing from the other world... I fixed the "for" that has problems in ubuntu 9.10 (or has problems in my case)... and I added some variables to manage the for iteration and the mod function. Here is the correction, I hope it be useful. See you soon!!!
ReplyDelete#!/bin/bash
# optional ##########################################
#MOZWIN=$(xdotool search --title "Mozilla Firefox")
#MOZDESKTOP=$(xdotool get_desktop_for_window $MOZWIN)
#xdotool set_desktop $MOZDESKTOP
#xdotool windowactivate $MOZWIN
#####################################################
FARMROWS=12
FARMCOLS=12
CLICK_INTERVAL=0.2
X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
if [ $1 ]; then
FARMROWS=$1
fi
if [ $2 ]; then
FARMCOLS=$2
fi
if [ $3 ]; then
CLICK_INTERVAL=$3
fi
# square jump distance
XDIS=25
YDIS=12
#for((i=0;$i<=$(($FARMROWS-1));i=$(($i+1))));do
VAL1=$((FARMROWS - 1))
for I in $(seq 0 $VAL1); do
VAL=$(($I % 2))
if [ $VAL -eq 0 ];then
#for((j=0;$j<=$(($FARMCOLS-1));j=$(($j+1))));do
VAL2=$((FARMCOLS - 1))
for J in $(seq 0 $VAL2); do
if [ $J -ne 0 ]; then
X=$(($X+$XDIS))
Y=$(($Y-$YDIS))
fi
xdotool mousemove $X $Y && xdotool click 1
echo "$X $Y i=$I j=$J"
sleep $CLICK_INTERVAL;
done
X=$(($X+$XDIS))
Y=$(($Y+$YDIS))
else
#for((j=0;$j<=$(($FARMCOLS-1));j=$(($j+1))));do
VAL2=$((FARMCOLS - 1))
for J in $(seq 0 $VAL2); do
if [ $J -ne 0 ];then
X=$(($X-$XDIS))
Y=$(($Y+$YDIS))
fi
xdotool mousemove $X $Y && xdotool click 1
echo "$X $Y i=$I j=$J"
sleep $CLICK_INTERVAL;
done
X=$(($X+$XDIS))
Y=$(($Y+$YDIS))
fi
done
hehe, thanks, i updated the script with your fix =)
ReplyDeleteVery nice thanks a lot
ReplyDeletewow nice script , that exactly what I was looking for especially for linux
ReplyDeleteits work great , save me lots time of clicking , no need to buy any vehicles XD
even if the GUI doesn't work for me , but I liked the script more .
thank you .
HEY I CaNT INStALL it i need a deB FILE PLZ HELP Me!
ReplyDeleteGood job guy...only one thing..set click interval to 0.01 to be faster because if you found "fuell" or "ribbon" the operation failed :)
ReplyDeletefound a fix for Ubuntu users. Use (sudo apt-get install xdotool) command before running the script.
ReplyDeletefarmville get resized...how to resize the values of this script?
ReplyDeletehi, resized in the number of rows and columns or in square size?
ReplyDeletehere you can change the rows and cols geometry
FARMROWS=12
FARMCOLS=12
here you can set the distance from each click to another
# square jump distance
XDIS=25
YDIS=12
resized in square size...now i set xdis=20 ydis=10
ReplyDeletethe correct distance is xdis=19,20 ydis=9,25 but xdotool not support decimal numbers... :(
#!/bin/bash
ReplyDelete# optional ##########################################
#MOZWIN=$(xdotool search --title "Mozilla Firefox")
#MOZDESKTOP=$(xdotool get_desktop_for_window $MOZWIN)
#xdotool set_desktop $MOZDESKTOP
#xdotool windowactivate $MOZWIN
#####################################################
FARMROWS=12
FARMCOLS=12
CLICK_INTERVAL=0.2
if [ $1 ]; then
FARMROWS=$1
fi
if [ $2 ]; then
FARMCOLS=$2
fi
if [ $3 ]; then
CLICK_INTERVAL=$3
fi
if [ $4 ]; then
sleep $4;
fi
if [ $6 ]; then
DELX=$5
DELY=$6
fi
# get mouse location
X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
# square jump distance
XDIS="19.09090909090909090909"
YDIS="9.09090909090909090909"
VAL1=$((FARMROWS - 1))
for I in $(seq 0 $VAL1); do
VAL=$(($I % 2))
if [ $VAL -eq 0 ];then
VAL2=$((FARMCOLS - 1))
for J in $(seq 0 $VAL2); do
if [ $J -ne 0 ]; then
X=$(echo "$X+$XDIS"|bc)
Y=$(echo "$Y-$YDIS"|bc)
fi
xdotool mousemove $X $Y && xdotool click 1
echo "$X $Y i=$I j=$J"
sleep $CLICK_INTERVAL;
if [ $6 ]; then
xdotool mousemove $DELX $DELY && xdotool click 1 && sleep 1
fi
done
X=$(echo "$X+$XDIS"|bc)
Y=$(echo "$Y+$YDIS"|bc)
else
VAL2=$((FARMCOLS - 1))
for J in $(seq 0 $VAL2); do
if [ $J -ne 0 ];then
X=$(echo "$X-$XDIS"|bc)
Y=$(echo "$Y+$YDIS"|bc)
fi
xdotool mousemove $X $Y && xdotool click 1
echo "$X $Y i=$I j=$J"
sleep $CLICK_INTERVAL;
done
X=$(echo "$X+$XDIS"|bc)
Y=$(echo "$Y+$YDIS"|bc)
fi
done
in above, script with float support, make sure you have installed basic calculator tool (bc)
ReplyDeleteCheers
one2one :)
ReplyDeletejust change xdis=20.00000000000000000000
ydis=9.50505050505050505050
now i tested your new script, I change only the values in prewiuos post...work good...regard
ReplyDeleteWel I used numbers 20 and 10 for new zoom,and it works perfectly... thx to creaters!
ReplyDeleteHi (boas pt :) )
ReplyDeleteAlthough 20 - 10 works, just visited the site to check the correct values, thanks.
I just wont to post also the way I use the script in Ubuntu.
I use the super+1 to run the script with a default 12*12 squares and super+2 for tractor and super+3 for 3*3 tractor. and super+q to stop if necessary with killall sh. :)
Also have super+4 and 5 for harvesting trees and animals with normal zoom with the code:
xdotool click 1
xdotool mousemove_relative -25 -12
or
xdotool click 1
xdotool mousemove_relative 25 -12
With the new way of harvesting, probably would be best to make it go down instead on up, just change the numbers.
feel free to share ;), i didnt use mousemove_relative because if you move the mouse while the script is running, all subsequent clicks are compromised. But it can be very useful, i dont play FV anymore but i can test yours scripts or modifications =). And a script for harvesting trees and animals seems interesting.
ReplyDeleteThis is an awesome alternative for linux! I am having some problems getting it work. I am using the new gui so i can use it in full screen, which for me i have to use the non qt as the other one does not show up, but when in clicks it goes for 3 squares then skips one then does another 3, rinse & repeat. is this because of the new size change due to the zoom changes? I would like to use just the script but i am not sure how to get the command line to pull up as displayed in the videos for the script? Any help would be appreciated. i am running Fedora 13 if that helps any. Thanks in advance.
ReplyDeletepaxile2k 1st you need to have xdotool and bc (basic calculator) installed.
ReplyDeleteCopy the code in this post http://linux-utils.blogspot.com/2009/11/farmville-auto-clicker.html?showComment=1273578190690#c5165403702806013490 to farmvile_clicker.sh
To run the script "sh farmvile_clicker.sh rows colums click_interval"
This script is optimized for less zoom in farmville, for exemple, if you want to click in 10x10 squares with click interval of 1 second
sh farmvile_clicker.sh 10 10 1
About the qt gui, letme check
http://one2one.no.sapo.pt/qtfarm-v1-changing-1275517130.tar.gz
ReplyDeleteQT GUI version (binaries+source)
Latest version here (supports float xdis and ydis distances)
Edit ~/.config/qtfarm/qtfarm.conf to change application settings
Thanks for the info, just out of curiousity, how do you get the xxx@genbox? so i can have the command line open so i can use the script? another questions is how is the starting point determined by the script, if i do a 10x10 grid and i have a much larger farm, does it go to the next available grid or do i have set a starting point?
ReplyDeleteinstall a terminal (xterm, aterm, gmome-terminal, konsole), most probably you already have one of these installed
ReplyDeletethe starting point is where you have the mouse pointer at the time you run the script, so make sure you have it over the first square
if you have a much bigger farm change arguments, for example "sh farmvile_clicker.sh 24 24 0" for 24x24 farm
I do have a terminal, but when i run the script, it does not work. The script itself works, but it does not interact with farmville. The gui is also giving me some issues where it will skip rows and columns, which could be due to changes in zoom for FV. I am not sure on what i need to add or modify in the gtfarm.conf file to readjust for the new size settings. Anyhelp would be appreciated, thanx in advnace.
ReplyDeleteHi there, one question.
ReplyDeleteHow do you get the exact figure for xdis and ydis?
run "xdotool getmouselocation" with mouse pointer in first cell and the last one from a row. Subtract x value and divide by the number of cells in that row.
ReplyDeleteBasically is to get the X distance between two cells and divide by the number of cells.Same process for Y.
now they changed again the layout, could you please update the coordinates?
ReplyDeleteI test this one and it works for me
ReplyDelete# square jump distance
XDIS="15.0000000000"
YDIS="7.12878787879"
It should be
ReplyDelete15.(18) and 7.(18)
XDIS="15.18181818"
YDIS="7.18181818"
sh farmville_click.sh 15.18181818 7.1818
ReplyDeletefarmville_click.sh: line 39: 15.18181818: syntax error: invalid arithmetic operator (error token is ".18181818")
Why is this error coming
sh farmville_click.sh rows columns
ReplyDeletethe number of rows and columns are integers
(15.18 rows do not make sense)
right thanks for quick reply ..
ReplyDeleteabout qtfarm application...
what are the dependencies???
XDIS="15.18181818"
ReplyDeleteYDIS="7.18181818"
????
what is this all about
this to be edited farmville.sh or qtfarm
in farmville.sh there is datatype of XDIS and YDIS but on changing the script is not working
you need to have xdotool and bc installed
ReplyDeletethat XDIS and YDIS is the distance for moving from one square to another
Copy the code in this post http://linux-utils.blogspot.com/2009/11/farmville-auto-clicker.html?showComment=1273578190690#c5165403702806013490 to farmvile_clicker.sh
XDIS="15.18181818"
ReplyDeleteYDIS="7.18181818"
didn't work, has to be integer.
XDIS=15
YDIS=7
this works but since it's not very accurate number so it only works within 15x15. if you try anything over 15 plots the mouse will move to wrong location.
There should be a fixer inside the script that offset the number by x when it go over 15 plots.
don't know if this was already mentoined. but i put the script to my bin directory and added shortcuts such as CTRL+ALT+4 to activate the script.
ReplyDeleteAWESOME!
so will this only work for farmville?
ReplyDeleteIt is a clicker script and it will work with or without farmville. The script tells the computer to click at specific locations according to the formula inside the script. If you know how to modify Linux script, you can change the script so it works the way you want.
ReplyDeleteI changed the script so it only clicks at 2 locations back and foward. It opens mails and click ok for me in restaurant city.
gr8 work dude.. perfect for farmville with bc
ReplyDeleteHey great script.
ReplyDeleteI made a similar one based on the same idea though it aims to be more user friendly :)
It is in its early stages but you already can try it here:
http://gamescheatfacebook.blogspot.com/2011/02/farmville-autoclick-for-linux-script.html
any one know of a way to terminate the script once it starts running?? Another question, i have, is for the XDIS/YDIS, the 15/7 are getting a little offset to where is starts skipping plots, i used the "xdotool getmouselocation" to get the information as recommended by a previous post, and the numbers i am getting are 14.22 and 6.82, with was calculated on a 18x17 farm size. Since the numbers are not whole integers, i was of course round them to the nearest number, but 14x7 does not work well either.
ReplyDelete"any one know of a way to terminate the script once it starts running?? Another question, i have, is for the XDIS/YDIS, the 15/7 are getting a little..."
ReplyDeleteIt only accepts interger. The only way I found to compensate the offset was to fill a smaller area at a time (like 10x10). Since the script allow you to decide the filling area, you enter sh script_name.sh 10 10 to fill 10x10 area. After that you move your mouse to next starting location, scroll up and run the script to fill another 10x10.
I can't find a way to terminate the script in the middle. So filling a smaller area at a time and speeding up the click time will avoid the need to terminate when something happen in the middle. To do so, just enter the 3rd parameter when you run the script:
sh script_name.sh 10 10 0.1
so now not only can you fill a smaller area to avoid clicking offset, it can also speed up the process 2x than the default .
You have to kill the process, I for instance, made a shortcut to "killall sh" i think it was like this.
ReplyDeletehow to use says can not be opened im new so pls help thanks there a 5 dollar farmville gift card in it
ReplyDelete"how to use says can not be opened im new so pls help thanks there a 5 dollar farmville gift card in it "
ReplyDeletenot sure what happen. but make sure:
1. you are using linux
2. when you run, open a terminal (press Alt+F2 and enter gnome-terminal
3. type sh follow by the script file name (make sure it's the same, capital letter and extension should be entered the same way)
for example you save the script file as /media/Game/fv.txt
in terminal, you have to type following to run this script:
sh /media/Game/fv.txt
most people block the farmer in middle with bales. It's very annoying to plant half and half using this script (for lazy people like me)
ReplyDeletehere is a way I found to solve this problem:
first put all the script above into a function
plant()
{
FARMROWS=12
FARMCOLS=12
CLICK_INTERVAL=0.2
......
fi
done
}
and then add a function that let you skip the farmer in the middle (there are many ways to do it, this is how I did)
skiprow()
{
#get current location
X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
SX=$((X + 30))
SY=$((Y - 14))
xdotool mousemove $SX $SY
}
this function will move up and skip the next slot. (to move down, just change the + or - sign)
at last, below the 2 functions will be the main script:
if [ "$2" = "" ]; then
if [ $1 -eq 1 ]; then
plant 1 14 && sleep 0.3
skiprow
plant 1 13
fi
else
plant $1 $2 $3 $4 $5 $6
I have 28x28 farm so It will plant 14 slots up, skip the farmer and then plant another 13 slots. You have to change the number according to your farm.
If you do it correctly, you can use the script as normal but you can also activate this special ability by typing
sh script_name 1
enjoy :)
forgot a fi at the last line from last post, the whole script will look something like:
ReplyDeleteplant()
{
FARMROWS=12
FARMCOLS=12
CLICK_INTERVAL=0.2
......
fi
done
}
skiprow()
{
#get current location
X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
SX=$((X + 30))
SY=$((Y - 14))
xdotool mousemove $SX $SY
}
if [ "$2" = "" ]; then
if [ $1 -eq 1 ]; then
plant 1 14 && sleep 0.3
skiprow
plant 1 13
fi
else
plant $1 $2 $3 $4 $5 $6
fi
just fill the plant() with the full script provided by the one2one
Personally I love better the text script than the gui version. I have some problem with QT and the gui version x.x
fv1@pg1.ca
another Linux auto clicker at http://www.murguu.com/ which can be of help in any gui automation scenario
ReplyDelete