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
  • Al Kharid Amulets (u)


    alludus

    Recommended Posts

    First script still pretty terrible. Should add antiban and camera movement + improve a lot of parts.

     

    Walks to Al Kharid bank if not there then deposits all items except Amulet mould.

    Withdraws Amulet mould if it is not in inventory.

    Withdraws Gold bars, walks to furnace and starts crafting Gold amulets (u).

    Walks back to bank after done and repeats process.

     

    Not sure if posting .jar is allowed.

     

    Nezz's tutorial is good!

     

    AlkharidAmulets.java

    package alkharidAmuletU;
    
    import java.awt.Graphics;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.MethodProvider;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.tabs.Tabs;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.widgets.WidgetChild;
    
    
    @ScriptManifest(author = "alludus", category = Category.CRAFTING, name = "alkAU", version = 0.2)
    public class AlkharidAmulets extends AbstractScript {
    
    	
    	private Area BANK_AREA = new Area(3269,3164,3272,3170);
    	private Area FURNACE_AREA = new Area(3274,3184,3279,3188);
    	
    	private Tile BANK_TILE = new Tile(3270,3167,0);
    	private Tile FURNACE_TILE = new Tile(3276,3186,0);
    	
    	WidgetChild child1 = null;
    	
    	private State state;
    	
    	private enum State{
    		BANKDEPOSIT ,BANKWITHDRAW, WALK_TO_BANK, WALK_TO_FURNACE, CRAFT_AMULETS;
    	}
    	
    	private State getState(){
    		
    		if(BANK_AREA.contains(getLocalPlayer()) && !getInventory().contains("Gold Bar") && !getInventory().contains("Amulet mould") ||
    				BANK_AREA.contains(getLocalPlayer()) && !getInventory().contains("Gold Bar") && getInventory().contains("Amulet mould") && getInventory().emptySlotCount() < 27	
    				){
    			return State.BANKDEPOSIT;
    		}
    
    		if(BANK_AREA.contains(getLocalPlayer()) && getInventory().onlyContains("Amulet mould") && getInventory().emptySlotCount() == 27 ){
    			return State.BANKWITHDRAW;
    			
    		}
    		
    		if( getInventory().contains("Amulet mould") && (getInventory().count("Gold bar") == 27) && !FURNACE_AREA.contains(getLocalPlayer()) ){
    			return State.WALK_TO_FURNACE;
    			
    		}
    		
    		if(FURNACE_AREA.contains(getLocalPlayer()) && getInventory().contains("Amulet mould") && getInventory().contains("Gold bar")){
    			return State.CRAFT_AMULETS;
    		}
    		
    
    		else{
    			return State.WALK_TO_BANK;
    		}
    			
    		
    		
    	}
    	
    	public void onStart(){
    		
    		
    		
    	}
    	
    	
    	
    	@Override
    	public int onLoop() {
    		
    		state = getState();
    		switch(state){
    		
    		case BANKDEPOSIT:
    			if(getBank().isOpen()){
    				getBank().depositAllExcept("Amulet mould");
    				
    				//sleep until inv only contains mould
    				sleepUntil(new Condition() {
    					public boolean verify(){
    						return getInventory().onlyContains(i -> i.getName().equals("Amulet mould") || getInventory().isEmpty());
    					}
    					
    				}, Calculations.random(900, 1200));
    				if(getBank().isOpen() && !getInventory().contains("Amulet mould")){
    					getBank().withdraw("Amulet mould");
    
    					sleepUntil(new Condition() {
    						public boolean verify(){
    							return getInventory().onlyContains("Amulet mould");
    						}
    						
    					}, Calculations.random(900, 1200));		
    				}
    			}
    			else{
    				getBank().open();
    				
    				sleepUntil(new Condition(){
    					public boolean verify(){
    						return getBank().isOpen();
    					}
    				},Calculations.random(900,1200));
    				
    				
    			}
    			break;
    		
    		
    		case BANKWITHDRAW: 
    			//look if bank is open, and inv contains Gold amulets
    			//deposit all except mould
    			
    				if(getBank().isOpen()&& !getInventory().contains("Gold Bar")){
    				//withdraw goldbars
    				MethodProvider.log("Searching for goldbars");
    				if(getBank().contains("Gold Bar")){
    				getBank().withdrawAll("Gold Bar");
    				
    				sleepUntil(new Condition() {
    					public boolean verify(){
    						return getInventory().contains("Gold Bar");
    					}
    					
    				}, Calculations.random(900, 1200));
    				
    				}else{
    					MethodProvider.log("no goldbars found, logging off and stopping script");
    					getTabs().logout();
    					MethodProvider.log("none");
    					stop();
    				}
    					
    			}
    			else{
    				getBank().open();
    				
    				sleepUntil(new Condition(){
    					public boolean verify(){
    						return getBank().isOpen();
    					}
    				},Calculations.random(900,1200));
    				
    				
    			}
    			
    			
    			break;
    			
    		case WALK_TO_FURNACE:
    				getWalking().walk(FURNACE_TILE);
    				
    				sleepUntil(new Condition() {
    					
    					public boolean verify() {
    						
    						return getLocalPlayer().distance(FURNACE_TILE) < 4;
    					}
    				}, Calculations.random(3000, 6000));
    			
    			break;
    			
    			
    		case CRAFT_AMULETS:
    			
    			
    			if(!getInventory().isItemSelected() && !getLocalPlayer().isAnimating()){
        			
        			getInventory().interact("Gold bar", "Use");
        			sleepUntil(() -> getInventory().isItemSelected(),Calculations.random(1200, 2000));
        			getGameObjects().closest("Furnace").interactForceRight("Use");
        			sleep(2000,3000);
        			child1 = getWidgets().getWidgetChild(446,34);
        			
        			
        			sleepWhile(() -> !child1.isVisible(), Calculations.random(4000, 6000));
                
                }
    			
                if (child1.isVisible()) {
                	log("ennen makex");
                    child1.interact("Make-X");
                    log("makex jälkeen");
                    WidgetChild child3 = getWidgets().getWidgetChild(162,32);
                    sleepUntil(() -> child3.isVisible(), Calculations.random(3000, 6000));
                    if(child3.isVisible()){
                    String number = Integer.toString(Calculations.random(31,525));
                    sleep(Calculations.random(100, 300));
    				getKeyboard().type(number, true);
                    }
    
    
                }
                
                
                
    			// ~~ need to rewrite
    			sleepUntil(() -> !getInventory().contains("Gold bar") || getDialogues().canContinue() , 
    					Calculations.random(30000, 60000)); 
    			
    			
    			
    			break;
    		case WALK_TO_BANK:
    			getWalking().walk(BANK_TILE);
    			
    			sleepUntil(new Condition() {
    				
    				public boolean verify() {
    					
    					return getLocalPlayer().distance(BANK_TILE) < 4;
    				}
    			}, Calculations.random(3000, 6000));
    			
    			break;
    		
    		
    		default:
    			break;
    		}
    	
    			
    		return Calculations.random(200,400);
    	}
    	
    
    
    	public void onPaint(Graphics g){
    		
    	}
    
    }
    
    
    
    

    Versions:

    0.1 first release.

    0.2 Fixed checks for widgets (no more type spam, fixed Gold bar selection and using on furnace as forced right) .

    Link to comment
    Share on other sites

    • 1 year later...

    Yeah, you're allowed to post .jars

     

    Throw a virustotal in there on it if you want to make people feel more comfortable downloading them.

    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.