Results 1 to 6 of 6
  1. #1
    Alienz is offline Member
    Join Date
    Apr 2011
    Posts
    13
    Rep Power
    0

    Exclamation Should be a quick fix :)

    First off let me say thanks to the moderators on this website.
    They directed me to a tutorial and showed me that my learning method was faulty (which is was).

    I have now cleaned up my script mostly, just one problem.
    I am getting this error

    Java Code:
    cannot find symbol
    symbol  : method setStroke(java.awt.BasicStroke)
    location:  class java.awt.Graphics
                g.setStroke(stroke1);
                ^
    Here is my code

    Java Code:
    import java.util.Map;
    import org.rsbot.script.wrappers.RSCharacter;
    import org.rsbot.script.wrappers.RSComponent;
    import org.rsbot.script.Script;
    import org.rsbot.script.ScriptManifest;
    import org.rsbot.script.wrappers.RSArea;
    import org.rsbot.script.wrappers.RSGroundItem;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSItem;
    import org.rsbot.script.wrappers.RSTile;
    import org.rsbot.event.listeners.PaintListener;
    import java.awt.*;
    import java.awt.BasicStroke;
    import java.awt.Graphics;
    
    	@ScriptManifest(authors = "Alienz",  name = "YakHidePickerOpenPaint", version = 1.0, description = "Picks up Yak hide and banks")
    	public class YakHidePickerOpenPaint extends Script implements PaintListener {
    	
    	int yakMeat = 10816;
    	int yakHair = 10814;
    	int GateID = 21507;
    	int DoorID = 21600;
    	int yakHideID = 10818;
    	int bankChestID = 21301;
    	public long startTime = System.currentTimeMillis();
    	
    	RSTile[] yakPenToBank = { new RSTile(2326, 3798), new RSTile(2326, 3801),
                new RSTile(2328, 3805), new RSTile(2334, 3804), new RSTile(2338, 3807) };
    	
    	public boolean onStart() {
    		log("Welcome to Alienz Yak-Hide Picker    Enjoy!");
    		return true;
    		startTime = System.currentTimeMillis();
    	}
    
    	public void openDoor() {
    		RSObject PenDoor = objects.getNearest(DoorID);
    		if (PenDoor != null) {
    			if (PenDoor.isOnScreen())
    				PenDoor.doAction("Open");
    		}
    	}
    		public void openGate() {
    			RSObject Gate = objects.getNearest(GateID);
    			if (Gate != null) {
    				if (Gate.isOnScreen())
    					Gate.doAction("Open");
    			}
    		}
    	private void takeYak() {
    		RSGroundItem hide = groundItems.getNearest(yakHideID);
    		if (hide != null ) {
    		hide.doAction("Take Yak-Hide");
    	}
    	}
    	
    	private boolean walkToBankFromyakPen() {
            RSTile[] randomizedPath = walking.randomizePath(yakPenToBank, 2, 2);
            return walking.walkPathMM(randomizedPath, 15);
     }
    	
    	 private boolean walkToyakPenFromBank() {
             RSTile[] reversedPath = walking.reversePath(yakPenToBank);
             RSTile[] randomizedPath = walking.randomizePath(reversedPath,
    			2, 2);
    	return walking.walkPathMM(randomizedPath);
    	 }
    	 
    	 private boolean isDoorOpen(final RSTile tile) {
    	        if(!walking.isLocal(tile)) return false;
    	        if(walking.getPath(tile).isValid()) return true;
    	        return false;
    	    }
    	 
    	private boolean atYak(){
    		RSArea area = new RSArea(new RSTile(2327, 3801), new RSTile(2317, 3788));
    		return (area.contains(getMyPlayer().getLocation()));
    	}
    	
    	private boolean atBank(){
    		RSArea area = new RSArea(new RSTile(2333, 3808), new RSTile(2340, 3805));
    		return (area.contains(getMyPlayer().getLocation()));
    	}
    	
    	private boolean atCenter(){
    		RSArea area = new RSArea(new RSTile(2332, 3808), new RSTile(2317, 3802));
    		return (area.contains(getMyPlayer().getLocation()));
    	}
    	
    	private boolean openBank() {
    		RSObject bankChest = objects.getNearest(bankChestID);
    		bankChest.doAction("Use");
    		return true;
    	}
    	
    	private void depositYak() {
    		if(bank.isOpen()){
    		mouse.move(398, 306);
    		mouse.click(true);
    	}
    	}
    	
    	private void closeBank() {
    		if(bank.isOpen()){
    		mouse.move(490, 36, 3, 3);
    		mouse.click(true);
    		}
    	}
    	
    	private void bank() {
    		openBank();
    		depositYak();
    		closeBank();
    	}
    	
    	public void onFinish() {
    		log("Thanks for using my script   please rate on forum");
    	}
    	
        //Alienz Paint :)
        private final Color color1 = new Color(0, 0, 0, 163);
        private final Color color2 = new Color(0, 0, 0);
        private final Color color3 = new Color(255, 255, 0);
    
        private final BasicStroke stroke1 = new BasicStroke(1);
    
        private final Font font1 = new Font("GrilledCheese BTN Wide Blk", 0, 15);
    
        public void onRepaint(Graphics g) {
                long millis = System.currentTimeMillis() - startTime;
                long hours = millis / (1000 * 60 * 60);
                millis -= hours * (1000 * 60 * 60);
                long minutes = millis / (1000 * 60);
                millis -= minutes * (1000 * 60);
                long seconds = millis / 1000;
                long minutes2 = minutes + (hours * 60);
                g.setColor(Color.red);
                g.drawString("Time running: " + hours + ":" + minutes + ":"
                        + seconds + "." , 9, 315);
            g.setColor(color1);
            g.fillRoundRect(547, 203, 192, 262, 16, 16);
            g.setColor(color2);
            g.setStroke(stroke1);
            g.drawRoundRect(547, 203, 192, 262, 16, 16);
            g.setFont(font1);
            g.setColor(color3);
            g.drawString("Alienz Yak Hide Picker", 530, 216);
            g.drawString("Time Running", 566, 266);
            g.drawString("Yak Hides Picked", 554, 320);
            g.drawString("Please tell me how this", 531, 383);
            g.drawString("script worked for you", 534, 400);
            g.drawString("on the script forum", 551, 416);
            g.drawString("~~Thanks~~", 579, 463);
        }
        //END: Code generated using Enfilade's Easel
    
    	public int loop() {
    		if (!game.isLoggedIn()) {
    			game.login();
    		}
    		openDoor();
    		openGate();
    		if(!atBank() && inventory.isFull()) {
    			walkToBankFromyakPen();
    		} else if(atBank() && inventory.isFull()) {
    			bank();
    		}else if (!atYak() && !inventory.isFull()) {
    			walkToyakPenFromBank();
    		} else if (atYak() && !inventory.isFull()) {
    			takeYak();
    		}
    		return (random(950, 1100));
    
    	}
    }
    Thanks in advance!!:D

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,807
    Rep Power
    10

    Default

    Go to the Java API. Navigate to the Graphics class. Find the setStroke method.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    28

    Default

    Quote Originally Posted by Junky View Post
    Go to the Java API. Navigate to the Graphics class. Find the setStroke method.

    I think that should be the Graphic2D class.

  4. #4
    Alienz is offline Member
    Join Date
    Apr 2011
    Posts
    13
    Rep Power
    0

    Unhappy

    sorry Junky but I can't find it.

  5. #5
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,807
    Rep Power
    10

    Default

    Exactly. It doesn't exist so you cannot call it. See Fubar's reply.

  6. #6
    Alienz is offline Member
    Join Date
    Apr 2011
    Posts
    13
    Rep Power
    0

Similar Threads

  1. quick q&a
    By aizen92 in forum New To Java
    Replies: 2
    Last Post: 12-28-2010, 12:55 PM
  2. Quick Help!!
    By MrA in forum New To Java
    Replies: 1
    Last Post: 11-10-2010, 08:38 PM
  3. Quick help
    By locazor in forum New To Java
    Replies: 15
    Last Post: 10-17-2010, 07:07 PM
  4. Quick help
    By Qwertypoiuy in forum New To Java
    Replies: 5
    Last Post: 01-06-2010, 11:49 PM
  5. Need help quick!
    By Manikyr in forum New To Java
    Replies: 11
    Last Post: 01-28-2009, 05:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •