Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • So lost on these errors


    Bonnie

    Recommended Posts

    public class main extends AbstractScript {
    
    	Area generalArea = new Area(3327, 4751, 3327, 4752, 0);
    	Area PortalArea = new Area(3326, 4768, 3334, 4761, 0);
    
    	
    	public void onStart() {
    		log("Welcome");
    	}
    
    	private enum State {
    		PRAY, ENTER, GOIN
    	};
    
    	private State getState() {
    		GameObject stall = getGameObjects().closest("Free-for-all portal");
    		if(getSkills().getBoostedLevels(Skill.HITPOINTS) > 1){
    			return State.PRAY;
    		if (stall != null)
    			return State.ENTER;
    		if(generalArea.contains(getPlayers().localPlayer().getTile())) 
    			return State.GOIN; 
    		}
    		
    	
    
    	public void onExit() 
    	
    	
    			}
    
    
    	@Override
    	public int onLoop() {
    		switch (getState()) {
    		case PRAY:
    			
    			sleep(922,4219);
    			getPrayer().toggleQuickPrayer(true);	
    		
    		break;
    			
    		case ENTER:
    		
    		sleep(722,3219);
    		GameObject stall = getGameObjects().closest("Free-for-all portal");
    		if (stall != null) {
    			stall.interact("Enter");
    		
    		break;
    		
    		case GOIN:
    			sleep(5867,8720);
    			
    				log("Walking to the middle");
    				Tile[] tiles = PortalArea.getTiles();
    			    Tile randomTile = tiles[Calculations.random(0, tiles.length - 1)];
    			    if (randomTile != null) {
    				getWalking().walk(randomTile);
    				sleepUntil(new Condition() {
    				    public boolean verify() {
    					return PortalArea.contains(getPlayers().localPlayer()
    							.getTile());
    					
    				    }
    				}, Calculations.random(1600, 1800));
    		
    		
    				    
    	}
    			    }
    				
    					
    				    
    		    
    		
    		
    	}
    
    

    Really confused on getting rid of these syntax errors, been messing around 15minutes and everything i try just causes more problems

     

    db28aec4f94528c53f2d5ead5335aa59.png

     

    If anyone could help that would be awesome.

    Link to comment
    Share on other sites

    First error:

    public void onExit() {
    	
    	
    			}
    
    

    Actually, You forgot a bracelet at your getState() again.

    Basically, you keep forgetting to close your methods.

    Link to comment
    Share on other sites

    First error:

    public void onExit() {
    	
    	
    			}
    
    

    Actually, You forgot a bracelet at your getState() again.

    Basically, you keep forgetting to close your methods.

     

    Thanks, i got that part sorted but i cant figure out the last error, i feel so retarded lol

    First day ever trying to mess with scripts, just want to move on to the paint tutorial but cant get past this

    703f2d0ed03e908bf4ccac5fa6717b5b.png

    public class main extends AbstractScript {
    
    	Area GeneralArea = new Area(3327, 4751, 3327, 4752, 0);
    	Area PortalArea = new Area(3326, 4768, 3334, 4761, 0);
    
    	
    	public void onStart() {
    		log("Welcome");
    	}
    
    	private enum State {
    		PRAY, ENTER, GOIN
    	};
    
    	private State getState() {
    		GameObject stall = getGameObjects().closest("Free-for-all portal");
    		if(getSkills().getBoostedLevels(Skill.HITPOINTS) > 1){
    			return State.PRAY;
    		if (stall != null)
    			return State.ENTER;
    		if(GeneralArea.contains(getPlayers().localPlayer().getTile())) 
    			return State.GOIN; 
    		}
    		
    	}
    
    		public void onExit() {
    			
    			
    		}
    
    
    
    	@Override
    	public int onLoop() {
    		switch (getState()) {
    		case PRAY:
    			
    			sleep(922,4219);
    			getPrayer().toggleQuickPrayer(true);	
    		
    		break;
    			
    		case ENTER:
    		
    		sleep(722,3219);
    		GameObject stall = getGameObjects().closest("Free-for-all portal");
    		if (stall != null) {
    			stall.interact("Enter");
    		}
    		break;
    		
    		case GOIN:
    			sleep(5867,8720);
    		
    				log("Walking to the middle");
    				Tile[] tiles = PortalArea.getTiles();
    			    Tile randomTile = tiles[Calculations.random(0, tiles.length - 1)];
    			    if (randomTile != null) {
    				getWalking().walk(randomTile);
    				sleepUntil(new Condition() {
    				    public boolean verify() {
    					return PortalArea.contains(getPlayers().localPlayer()
    							.getTile());
    				    
    				    }
    				}, Calculations.random(1600, 1800));
    		
    		
    				    
    			    }
    		
    			    }
    			    
    		}
    	
    			
    
    Link to comment
    Share on other sites

     

    Thanks, i got that part sorted but i cant figure out the last error, i feel so retarded lol

    First day ever trying to mess with scripts, just want to move on to the paint tutorial but cant get past this

    703f2d0ed03e908bf4ccac5fa6717b5b.png

    public class main extends AbstractScript {
    
    	Area GeneralArea = new Area(3327, 4751, 3327, 4752, 0);
    	Area PortalArea = new Area(3326, 4768, 3334, 4761, 0);
    
    	
    	public void onStart() {
    		log("Welcome");
    	}
    
    	private enum State {
    		PRAY, ENTER, GOIN
    	};
    
    	private State getState() {
    		GameObject stall = getGameObjects().closest("Free-for-all portal");
    		if(getSkills().getBoostedLevels(Skill.HITPOINTS) > 1){
    			return State.PRAY;
    		if (stall != null)
    			return State.ENTER;
    		if(GeneralArea.contains(getPlayers().localPlayer().getTile())) 
    			return State.GOIN; 
    		}
    		
    	}
    
    		public void onExit() {
    			
    			
    		}
    
    
    
    	@Override
    	public int onLoop() {
    		switch (getState()) {
    		case PRAY:
    			
    			sleep(922,4219);
    			getPrayer().toggleQuickPrayer(true);	
    		
    		break;
    			
    		case ENTER:
    		
    		sleep(722,3219);
    		GameObject stall = getGameObjects().closest("Free-for-all portal");
    		if (stall != null) {
    			stall.interact("Enter");
    		}
    		break;
    		
    		case GOIN:
    			sleep(5867,8720);
    		
    				log("Walking to the middle");
    				Tile[] tiles = PortalArea.getTiles();
    			    Tile randomTile = tiles[Calculations.random(0, tiles.length - 1)];
    			    if (randomTile != null) {
    				getWalking().walk(randomTile);
    				sleepUntil(new Condition() {
    				    public boolean verify() {
    					return PortalArea.contains(getPlayers().localPlayer()
    							.getTile());
    				    
    				    }
    				}, Calculations.random(1600, 1800));
    		
    		
    				    
    			    }
    		
    			    }
    			    
    		}
    	
    			
    

    Add another bracelet at the end to close your loop.

    Link to comment
    Share on other sites

    Add another bracelet at the end to close your loop.

    When i tried that i ended up with more errors so i thought it was wrong, so confused

    this is what happens when i add another bracket

    38a806f02a0dcca46f54755e83fce04e.png

    Link to comment
    Share on other sites

    When i tried that i ended up with more errors so i thought it was wrong, so confused

    this is what happens when i add another bracket

    38a806f02a0dcca46f54755e83fce04e.png

    I suggest taking some Java courses. You can't make a script if you don't know what you're doing.

    Link to comment
    Share on other sites

    I suggest taking some Java courses. You can't make a script if you don't know what you're doing.

    I would if i was getting super into it, just need to add a few more things to this and i probly wont ever do it again.

    ended up remaking it without states since i cant figure it out

    Link to comment
    Share on other sites

    You really should at least know the basics of java before trying to script. I don't think many people will want to hold you hand through the absolute basics.

    Ye i understand, finally figured it out and finished the NS bot

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.