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

    Exclamation Can anybody help me with this?

    I am getting the "(" expected problem.

    However, I know that the error comes in the line it shows with the problem. But I cant find the problem, so heres the problem with the line, then the code.

    Java Code:
    Scripts\Sources\YakPicker.java:17: '(' expected
            public void onStart{;
    That was the problem with the line.


    Heres the first part of the code.

    Java Code:
    import java.util.Map;
    import org.rsbot.script.Script;
    import org.rsbot.script.ScriptManifest;
    import org.rsbot.script.wrappers.RSArea;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSTile;
    
    	@ScriptManifest(authors = "Alienz",  name = "YakPicker", version = 1.0, description = "Picks up Yak hide and banks")
    	public class YakPicker extends Script {;
    	
    	int yakHideID = {10818};
    	int bankChestID = {21301};
    	
    	RSTile[] yaksToBank = { new RSTile(2326, 3798), new RSTile(2326, 3801), new RSTile(2328, 3805), newRSTile(2334, 3804),
    	new RSTile(2338, 3807)};
    	
    	public void onStart{;
    	log(Welcome to Aliensfears Yak Hide Picker Upper Thingy);

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    the method is very incorrect, I believe you meant to have something like this
    Java Code:
    public void onStart(){
      //code
    }
    Also when you declare an int you don't need to wrap the assignment in {}
    Java Code:
    int x = 10;
    is fine.

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

    Default

    That is no where near valid Java code, and there are too many errors including your semicolon on the class signature line. I suggest you scrap the code, check some tutorials and restart.

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

    Exclamation

    @Fubarable
    I am scripting a bot for runescape (RSBot), i followed a tutorial exactly and hundreds of other users have also.



    Thanks!

    but that sent me from 27 errors to 54 :/

    Heres the error now.

    Java Code:
    Scripts\Sources\YakPicker.java:18: invalid method declaration; return type required
                      log(Welcome to Aliensfears Yak Hide Picker Upper Thingy);
    	         ^

  5. #5
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    as Fubar said, there is a LOT wrong with this code, it may be helpful to read up some tutorials. Classes take the form of this

    Java Code:
    public class XYZ{
      int x;
      int[] y;
      String z;
      
      public void someMethod(){
        //do stuff 
      }
      public String someOtherMethod(){
        //do other stuff
      }
    }

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

    Default

    Thanks Sunde!

    I think I fixed it, here is the code now that it is fixed. (problem under code)

    Java Code:
    import java.util.Map;
    import org.rsbot.script.Script;
    import org.rsbot.script.ScriptManifest;
    import org.rsbot.script.wrappers.RSArea;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSTile;
    
    	@ScriptManifest(authors = "Alienz",  name = "YakPicker", version = 1.0, description = "Picks up Yak hide and banks")
    	public class YakPicker extends Script {;
    	
    	int yakHideID = 10818;
    	int bankChestID = 21301;
    	
    	RSTile[] yaksToBank = { new RSTile(2326, 3798), new RSTile(2326, 3801), new RSTile(2328, 3805), newRSTile(2334, 3804),
    	new RSTile(2338, 3807)};
    	
    	public boolean onStart(){
    	log("Welcome to Aliensfears Yak Hide Picker Upper Thingy");
    	
    	}
    	
    	private void takeYak(){
    		RSObject hair = objects.getNearest(yakHideID);
    		hair.doAction(Take);
    	}
    	
    	private boolean walkToyaksToBank(){
            RSTile[] randomizedPath = walking.randomizePath(yaksToBank, 2, 2);
            return walking.walkPathMM(randomizedPath, 15);
    
    	}
    	
    	private boolean walkToyaksToBank(){
            RSTile[] reversedPath = walking.reversePath(rimmingtonMineToBank);
    		RSTile[] randomizedPath = walking.randomizePath(yaksToBank, 2, 2);
            return walking.walkPathMM(randomizedPath, 15);
            
    	}
            
    	private void openBank(){
    		RSObject bankChest = objects.getNearest(bankChestID);
    		bankChest.doAction(use);
    		
    	}
    	
    	private void openBank(){
    		RSObject bankChest = objects.getNearest(bankChestID);
    		if (bankBooth != null && !bank.isOpen()) {;
    			bankBooth.doAction(use);
    		
    	}
    	
    	public void onFinish(){   [B][I][U]*****this is where the error is (on the "p" in "public")******[/U][/I][/B]
    		log("Thanks for using my script!");
    	
    	}
    	
    	private void depositYak(){
    		if (bank.isOpen()) {;
    			bank.deposit(yakHideID, 0);
    			sleep(200, 500);
    		}
    		
    	}
    	
    	private void closeBank(){
    		if (bank.isOpen()) {;
    			mouse.move(490, 36, 3, 3);
    			sleep(200,500);
    			mouse.click(true);
    		}
    		
    	}
    	
    	private void bank(){
    		openBank();
    		depositYak();
    		closeBank();
    
    	}
    	
    	private boolean atYak(){
    		RSArea area = new RSArea(new RSTile(2319, 3799), new RSTile(2328, 3789));
    		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()));
    	
    	}
    	
    	@Override
    	public int loop; {
    		if (atYak() && inventory.isFull()){;
    			walkToyaksToBank();
    		} else if (atYak(!inventory.isFull())){;
    		takeYak();
    		}else if (atBank() && inventory.isFull()){;
    			bank();
    		
    		}
    		return (random(650, 950));
    
    	}
    }
    I am now getting "illegal start of expression"
    I marked the spot in the script for you :)

  7. #7
    santeron is offline Member
    Join Date
    Apr 2011
    Location
    Athens, Greece
    Posts
    52
    Rep Power
    0

    Default

    You miss a "}" above for you if to close properly.

    PS. Don't use bots on games :P

  8. #8
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Java Code:
    if (bankBooth != null && !bank.isOpen()) {;
    			bankBooth.doAction(use);
    You have an opening bracket but no closing bracket. Where did you learn to put a semi-colon after each opening bracket?

  9. #9
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Java Code:
    public int loop; {
    More compiler errors.

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

    Default

    I am sorry, I didn't quite understand what you just said santeron. Can you show me the part of the code your tlakinga bout?

  11. #11
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Read my reply

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

    Default

    Junky, I used this guide. Scripting for dummies. New API.
    I am learning to script for a bot.

    Also under the part where you said there was a missing bracket is a bracket, not sure if you saw that.

  13. #13
    santeron is offline Member
    Join Date
    Apr 2011
    Location
    Athens, Greece
    Posts
    52
    Rep Power
    0

    Default

    Save him jebus as he have sinned. Dude that code is a massacre...

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

    Default

    :( can anyone help me clean it up?

  15. #15
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    We have been helping you. Get rid of the unnecesary semi-colons. Make sure that your brackets match. We are not going to go through your code line by line and point out each mistake. That is your job.

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

    Default

    Thank you Junky :) you guys have helped a ton :D

  17. #17
    Solarsonic is offline Senior Member
    Join Date
    Mar 2011
    Posts
    261
    Rep Power
    4

    Default

    Here's what you have to do: Trail: Getting Started (The Java™ Tutorials)

    You need to learn the very basics of Java.

  18. #18
    Mr.abe90 is offline Member
    Join Date
    May 2011
    Posts
    18
    Rep Power
    0

    Default

    Do you have the completed (working) code?

  19. #19
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,023
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Alienz View Post
    Junky, I used this guide. Scripting for dummies. New API.
    I am learning to script for a bot.
    Maybe you need glasses because I checked the code in that link and nowhere in the code was a character pair '{;' to be found.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Posting Permissions

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