Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

2007 Jewel enhancer working unfinished settings

Featured Replies

Just a private script i made today. I do not need it anymore It goes pretty fast.

NO i am not a fulltime coder just like this little tasks with allot of thinking.

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.MagicSpell;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Spells;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

import javax.imageio.ImageIO;
 
@ScriptManifest(author = "THC", info = "You need Cosmic runes in your inventory, and hold a Staff of ..", name = "THC Super Enchanter", version = 1, logo = "")
public class main extends Script {
 
	private long timeBegan;
    private long timeRan;
    
	private int justCast = 0;
	
	
	//unfinished selector just the variables
	private int selectedEnchantIndex = 2;
	//you need to add your jewels
	private String[] rawJewel = {"Sapphire ring","Sapphire necklace","Emerald ring"};
	private String[] EnchantedJewel = {"Ring of recoil","Games necklace(8)","Ring of dueling(8)"};
	
	//unfinished selector just the variables
	private int selectedEnchantlevel = 1;
    private MagicSpell[] spellArray = {
    		Spells.NormalSpells.LVL_1_ENCHANT,
    		Spells.NormalSpells.LVL_2_ENCHANT,
    		Spells.NormalSpells.LVL_3_ENCHANT,
    		Spells.NormalSpells.LVL_4_ENCHANT,
    		Spells.NormalSpells.LVL_5_ENCHANT,
    		Spells.NormalSpells.LVL_6_ENCHANT}; 
    
    private int mouseTail = 10;
    private ArrayList<Point> mouseHistory = new ArrayList<Point>(); 
    private Color tailColor = Color.CYAN; 
    
    public static int mX;
    public static int mY;
    private static Image image;
    
    int counter = -1;
    int lastXP = 0;
    private final Image bg = getImage("http://s22.postimg.org/bcnf5ddy5/Untitled.png");
    
    private Image getImage(String url)
	  {
	    try
	    {
	      return ImageIO.read(new URL(url));
	    }
	    catch (IOException e) {
	    	this.log("Couldn't retrieve bg image");
	    }
	    return null;
	  }
    
    @Override
    public void onStart() {
    	 try {
             URL url = new URL("http://s30.postimg.org/f0n58m83h/Rune_dart_detail_1.gif");
             image = ImageIO.read(url);
         }
         catch (IOException e) {
             this.log("Couldn't retrieve cursor image");
         }
    	timeBegan = System.currentTimeMillis();
    	log("Welcome to THCSuperEnchanter");
		log("Enjoy the script, gain some magic XP!");
    }
    
    private enum State {
    	IDLE,DO_BANK,TAKE_BANK,CLOSE_BANK,OPEN_BANK,ENCHANT
	};
	

	private State getState() {
		
			if (inventory.contains("Cosmic rune"))
			{
				if(bank.isOpen())
				{
					if(inventory.contains(EnchantedJewel[selectedEnchantIndex])){
						return State.DO_BANK;
					}
					if(!inventory.contains(rawJewel [selectedEnchantIndex])){
						return State.TAKE_BANK;
					}else{
						return State.CLOSE_BANK;
					}
				}else{
					if(inventory.contains(rawJewel [selectedEnchantIndex])){
						return State.ENCHANT;	
					}else{
						return State.OPEN_BANK;
					}
				}
			}else{
				log("No Cosmic Runes where found in inventory!");
			}
		
		return State.IDLE;
	}


    @Override
    public int onLoop() throws InterruptedException {
    	if(!client.isLoggedIn() || bot.getScriptExecutor().isPaused()){
    		return random(200, 600);
    	}
    	switch (getState()) {
    	
	

			case OPEN_BANK:

				if(getMagic().isSpellSelected())
				{
						getMagic().deselectSpell();
						//getInventory().getItem(EnchantedJewel[selectedEnchantIndex]).interact("Cast");
						sleep(random(100, 800));
				}else{	
					if(!myPlayer().isAnimating() && !myPlayer().isMoving())
					{
						NPC banker = npcs.closest("Banker");
				        if(banker != null && map.canReach(banker)){
				        	banker.interact("Bank");
				        	sleep(random(2600, 2900));
				        }
					}
				}
			break;
			
			case DO_BANK:
				bank.depositAllExcept("Cosmic rune");
				sleep(random(100, 600));
			break;
			
			case TAKE_BANK:
				bank.withdrawAll(rawJewel[selectedEnchantIndex]);
				sleep(random(100, 600));
			break;
			
			case CLOSE_BANK:
				bank.close();
				sleep(random(100, 800));
			break;
			
			case ENCHANT:
					if(getMagic().isSpellSelected()){
						if(getMagic().getSelectedSpellName().replace("-", "_").replace(" ", "_").toUpperCase()
								.equals((spellArray[selectedEnchantlevel]).toString().toUpperCase()))
						{
							if(!getTabs().getOpen().equals(Tab.MAGIC) ){
								getInventory().getItem(rawJewel[selectedEnchantIndex]).interact("Cast");
								justCast = 3;
								//sleep(random(250, 800));
							}
						}else{
							getMagic().deselectSpell();
						}
					}else{
						if(getTabs().getOpen().equals(Tab.MAGIC))
						{
							getMagic().castSpell(spellArray[selectedEnchantlevel]);
							return random(250, 800);
						}
						if(justCast >=1){
							justCast--;
							 return random(150, 200);
						}
						getMagic().castSpell(spellArray[selectedEnchantlevel]);
					}
			break;
			
			case IDLE:
				sleep(random(10, 30));
			break;
		}
        return random(250, 400);
    }
 
       
    @Override
    public void onExit() {
        log("Thanks for running the THC Super Enchanter script!");
    }

    @Override
    public void onPaint(Graphics2D g) {
    	
    	Font font = new Font(Font.SANS_SERIF, Font.BOLD, 12);
    	g.setColor(Color.GREEN);
    	g.setFont(font);

		if(skills.getExperience(Skill.MAGIC) != lastXP) 
		{
			counter++;
		}
		lastXP = skills.getExperience(Skill.MAGIC);
		timeRan = System.currentTimeMillis() - this.timeBegan;
		
		g.drawImage(bg, 350, 346, null);
		g.drawString("Items Enchanted: " + counter, 360, 362);
		g.drawString(ft(timeRan), 365, 375);
		
		mX = this.mouse.getPosition().x;
		mY = this.mouse.getPosition().y;
		  
		g.drawImage(image, mX - 3, mY - 7, null);
		  
		mouseHistory.add(new Point(mX, mY)); 
		  
		((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		for (int i = 0; i < mouseHistory.size() - 1; i++) { 
		    g.setColor(new Color(tailColor.getRed(), tailColor.getGreen(), tailColor.getBlue(), 255 / mouseHistory.size() * i));      Point currentPoint = mouseHistory.get(i);
		    Point nextPoint = mouseHistory.get(i + 1);
		    g.drawLine(currentPoint.x, currentPoint.y, nextPoint.x, nextPoint.y);
		}
		  
		if (mouseHistory.size() > mouseTail)       {
			mouseHistory.remove(0); 
		}
          
        }
         
      private String ft(long ms) 
      {
    	long sec = ms / 1000L;
    	return String.format("%02d:%02d:%02d",
	new Object[] { Long.valueOf(sec / 3600L),
	Long.valueOf((sec % 3600L) / 60L),
	Long.valueOf(sec % 60L) });
     } 
}

Edited by thcpsycho

Looks very good! You should make some more scripts biggrin.png

 

some small tips:

If you got a variable that will never change you should use uppercase name with the "final" modifier: (java conventions)

private final String[] RAW_JEWEL = {"Sapphire ring","Sapphire necklace","Emerald ring"};

Another small tip is to clean your brackets, no need to use "{ }" if only 1 command folows:

if(skills.getExperience(Skill.MAGIC) != lastXP)
   counter++;

Format time to hours:minutes:seconds can be done a lot cleaner smile.png (You can add days in if you want ^.^)

public static String formatTime(long ms) {
   long sec = ms / 1000L;
   return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(sec / 3600L), Long.valueOf((sec % 3600L) / 60L), Long.valueOf(sec % 60L) });
} 

 

Kind regards

Khaleesi

Edited by Khaleesi Scripts

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.