Code Monkey home page Code Monkey logo

farmville-macros's Introduction

Farmville Macro Clicker

Clicking on lots of squares is rather tedious, and tedious repetitive things are what computers are good at… so why not script it?

Script Prerequisites

Install Ruby and xmacro on the same Ubuntu machine that is running Farmville in a browser

sudo apt-get install xmacro ruby

Basic Script Usage

Open Farmville on an a Linux computer (I tested with Ubuntu) and make Farmville full screen. Zoom out 3 times, and do not drag the farm to move it. This will ensure that it is in a consistent position.

Using a secure shell log in remotely to the machine being used to play Farmville. To execute the scripts and move the mouse pointer do the following:

ruby grid_click_3d.rb X_PIXEL_START Y_PIXEL_START NUMBER_OF_ROWS NUMBER_OF_COLS CLICK

The parameters are as follows:

  • X_PIXEL_START The starting x coordinate in pixels of the SW corner where clicking will start

  • Y_PIXEL_START The starting y coordinate in pixels of the SW corner where clicking will start

  • NUMBER_OF_ROWS The number of rows to click on

  • NUMBER_OF_COLS The number of cols to click on

  • CLICK 0 to move the mouse and not click, 1 to click

Turn off clicking when testing position of the clicking.

The above only creates the macro script, to execute it do the following:

ruby grid_click_3d.rb X_PIXEL_START Y_PIXEL_START NUMBER_OF_ROWS NUMBER_OF_COLS CLICK | xmacroplay -d MILLISECS  ":0.0"

where MILLISECS is the delay (I use 10)

Farm Preparation

By far the easiest way of arranging clicking is to arrange your farm in a grid of C columns by R rows, depending on how much space you have.

Harvesting / Plowing / Planting Procedure

Finding the start square

The first problem is to find the location of the first square. Provided the game is opened in a consistent manner then you should only have to do this once. Vary the values 200 and 400 in the following (the x,y screen pixel position) until you see the SW corner of the grid highlighted

$ ruby clicks.rb 200  400   1 1  0  | xmacroplay -d 10  ":0.0"

Run the same script over a bigger grid, to ensure that other grid squares are highlighted also. You should ensure the last grid is highlighted

$ ruby clicks.rb 200  400   12 12  0  | xmacroplay -d 10  ":0.0"

Move the Farmer Out of the Grid

Click on a square outside of the grid where harvesting is occuring, otherwise a dialog will appear asking you to change the look and or gender of your farmer. I normally click on the NE corner square, the last one in the grid.

Run the Script

Execute the script, clicking

$ ruby clicks.rb 200  400   12 12 1  | xmacroplay -d 10  ":0.0"

Wham bam, RSI free farming

Collecting The Pink Diamonds

A similar script this time clicks in a vertical sweep pattern. Full screen your Farmville browsers and zoom in sufficiently that the screen is covered in an area containing pink diamond like icons to collect. Execute something similar to the following:

ruby grid_click.rb 0 100 60 24 0  | xmacroplay -d 10  ":0.0"

The parameters are the same as for the grid click 3d script, except that X,Y is the NW corner of the screen. Vary the start coordinates and the number of rows and columns. When happy that you have a sweep of your collection area, change the final 0 parameter to a one to execute button clicks during the sweep.

Video

A video of the script in action can be found at www.youtube.com/watch?v=OGV1sVkGNMw

farmville-macros's People

Contributors

gordonbanderson avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.