The Wiki for Tale 4 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

Difference between revisions of "User:Esther/Macros"

From A Tale in the Desert
Jump to navigationJump to search
(New page: = <span style="font-family:Monotype Corsiva; font-size: 20pt">List of Different Macros I wrote or adapted</span> = {| style="background-color:#EFDFBD" |[[User:Asnath/Timer | Simple Click ...)
 
Line 9: Line 9:
 
|-
 
|-
 
|}
 
|}
 +
 +
 +
 +
/**
 +
* This is used for gathering Clay or grass.
 +
* Find some clay or grass, choose "New Clay", place your mouse over a red area of the clay icon, and hit enter.
 +
*
 +
* @McArine
 +
* @23/02-2008
 +
*/
 +
import java.awt.Robot;
 +
import java.awt.MouseInfo;
 +
import java.awt.AWTException;
 +
 +
public class Grass
 +
{   
 +
    private int xClay;
 +
    private int yClay;
 +
    private int xPos;
 +
    private int yPos;
 +
    private int loop;
 +
    private int nbloop;
 +
    private int north;
 +
    private int south;
 +
    private int west;
 +
    private int east;
 +
    private int colorClay;
 +
    private int i;
 +
    private Robot robot;
 +
    private Functions functions;
 +
   
 +
    public Grass()
 +
    {
 +
        try {
 +
            robot = new Robot();
 +
        }
 +
        catch (AWTException awte) {
 +
            System.out.println("The Robot was not initialized "+awte + "\n");
 +
        }
 +
        functions = new Functions(robot);
 +
        xClay = MouseInfo.getPointerInfo().getLocation().x;
 +
        yClay = MouseInfo.getPointerInfo().getLocation().y;
 +
        xPos = 960;
 +
        yPos = 540;
 +
        loop = 1;
 +
        nbloop = 100;
 +
 +
        i = 1;
 +
        colorClay = robot.getPixelColor(xClay, yClay).getRGB();
 +
       
 +
        while (loop < nbloop) {
 +
/** Going North
 +
*
 +
*/
 +
            i = 1;
 +
            while (i < 10 ) {
 +
                if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
 +
                    functions.PressButton(xClay, yClay);
 +
                    robot.delay(20);
 +
                 
 +
                    functions.PressButton(xPos,yPos -70);
 +
                    robot.delay(500);
 +
                    loop = loop + 1;
 +
                }
 +
                else {
 +
                    functions.PressButton(xPos,yPos -70);
 +
                    robot.delay(500);
 +
                robot.delay(50);
 +
                }
 +
                i=i+1;
 +
            }
 +
/** Going west
 +
  *
 +
  */
 +
            i = 1;
 +
            while (i <10 ) {
 +
                if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
 +
                    functions.PressButton(xClay, yClay);
 +
                    robot.delay(20);
 +
                 
 +
                    functions.PressButton(xPos-70,yPos);
 +
                    robot.delay(500);
 +
                    loop = loop + 1;
 +
                }
 +
                else {
 +
                    functions.PressButton(xPos-70,yPos);
 +
                    robot.delay(500);
 +
                robot.delay(50);
 +
                }
 +
                i=i+1;
 +
            }
 +
/** Going south
 +
  *
 +
  */
 +
            i = 1;
 +
            while (i <10 ) {
 +
                if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
 +
                    functions.PressButton(xClay, yClay);
 +
                    robot.delay(20);
 +
       
 +
                    functions.PressButton(xPos,yPos+70);
 +
                    robot.delay(500);
 +
                    loop = loop + 1;
 +
                }
 +
                else {
 +
                    functions.PressButton(xPos,yPos+70);
 +
                    robot.delay(500);
 +
                robot.delay(50);
 +
                }
 +
                i=i+1;
 +
            }
 +
  /** Going east
 +
  *
 +
  */
 +
            i = 1;
 +
            while (i < 10 ) {
 +
                if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
 +
                    functions.PressButton(xClay, yClay);
 +
                    robot.delay(20);
 +
       
 +
                    functions.PressButton(xPos+70,yPos);
 +
                    robot.delay(500);
 +
                    loop = loop + 1;
 +
                }
 +
                else {
 +
                    functions.PressButton(xPos+70,yPos);
 +
                    robot.delay(500);
 +
                robot.delay(50);
 +
                }
 +
                i=i+1;
 +
            }                   
 +
        }
 +
         
 +
    }
 +
}

Revision as of 15:42, 28 February 2010

List of Different Macros I wrote or adapted

Simple Click Timer Macro
Carpentry Blades
Make boards


/**

* This is used for gathering Clay or grass.
* Find some clay or grass, choose "New Clay", place your mouse over a red area of the clay icon, and hit enter.
* 
* @McArine
* @23/02-2008
*/

import java.awt.Robot; import java.awt.MouseInfo; import java.awt.AWTException;

public class Grass {

   private int xClay;
   private int yClay;
   private int xPos;
   private int yPos;
   private int loop;
   private int nbloop;
   private int north;
   private int south;
   private int west;
   private int east;
   private int colorClay;
   private int i;
   private Robot robot;
   private Functions functions;
   
   public Grass()
   {
       try {
           robot = new Robot();
       }
       catch (AWTException awte) {
           System.out.println("The Robot was not initialized "+awte + "\n");
       }
       functions = new Functions(robot);
       xClay = MouseInfo.getPointerInfo().getLocation().x;
       yClay = MouseInfo.getPointerInfo().getLocation().y;
       xPos = 960;
       yPos = 540;
       loop = 1;
       nbloop = 100;

       i = 1;
       colorClay = robot.getPixelColor(xClay, yClay).getRGB();
       
       while (loop < nbloop) {

/** Going North

* 
*/
           i = 1;
           while (i < 10 ) {
               if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
                   functions.PressButton(xClay, yClay);
                   robot.delay(20);
                  
                   functions.PressButton(xPos,yPos -70);
                   robot.delay(500);
                   loop = loop + 1;
               }
               else {
                   functions.PressButton(xPos,yPos -70);
                   robot.delay(500);
               robot.delay(50);
               }
               i=i+1;
           }
/** Going west
 * 
 */
           i = 1;
           while (i <10 ) {
               if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
                   functions.PressButton(xClay, yClay);
                   robot.delay(20);
                  
                   functions.PressButton(xPos-70,yPos);
                   robot.delay(500);
                   loop = loop + 1;
               }
               else {
                   functions.PressButton(xPos-70,yPos);
                   robot.delay(500);
               robot.delay(50);
               }
               i=i+1;
           } 
/** Going south
 * 
 */
           i = 1;
           while (i <10 ) {
               if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
                   functions.PressButton(xClay, yClay);
                   robot.delay(20);
        
                   functions.PressButton(xPos,yPos+70);
                   robot.delay(500);
                   loop = loop + 1;
               }
               else {
                   functions.PressButton(xPos,yPos+70);
                   robot.delay(500);
               robot.delay(50);
               }
               i=i+1;
           }
 /** Going east
  * 
  */
           i = 1;
           while (i < 10 ) {
               if (colorClay == robot.getPixelColor(xClay, yClay).getRGB()) {
                   functions.PressButton(xClay, yClay);
                   robot.delay(20);
       
                   functions.PressButton(xPos+70,yPos);
                   robot.delay(500);
                   loop = loop + 1;
               }
               else {
                   functions.PressButton(xPos+70,yPos);
                   robot.delay(500);
               robot.delay(50);
               }
               i=i+1;
           }                    
       }
          
    }

}