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.

Stun + Alcher script

Featured Replies

This is a script that gets you 150k mage exp per hour.

 

It casts stun at an enemy, and then really quickly casts high alch afterwards.

 

We wear armour so that we will splash. This process is called Stun-Alching.

Here is a short video about it:

 

This script is very basic. I made it for a user named Anthony who is new here, but actually ended up using this myself.

 

Note: Babysitting advised. The script cannot logout when you are out of runes, because you cannot logout during combat. It also cannot take breaks, because again, you cannot logout during combat.

 

Usage:

Simply change the variable "targetEnemyName" to the name of the npc that you want to splash Stun onto. The current enemy is set to "Skeleton".


package scripts;

import java.awt.Color;
import java.awt.Graphics2D;
import java.text.NumberFormat;
import java.util.Locale;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.ui.Option;
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;


@ScriptManifest(name = "Stun Alcher", author = "MegaManAlpha", logo = "", version = 0.0, info = "")
public class StunAlcher extends Script {
    String targetEnemyName = "Skeleton";
    long scriptStartTime = 0;
    int startMagicLevel = 0;
    int startMagicExp = 0;
    int currentMagicExp = 0;
    int soulRunesStartAmount = 0;
    int soulRunesCurrentAmount = 0;
    int soulRunesUsed = 0;
    int natureRunesStartAmount = 0;
    int natureRunesCurrentAmount = 0;
    int natureRunesUsed = 0;
    boolean started = false;

    @Override
    public void onStart() throws InterruptedException {
        antiBan.unregisterAllBehaviors();
        scriptStartTime = System.currentTimeMillis();
        startMagicExp = skills.getExperience(Skill.MAGIC);
        startMagicLevel = skills.getStatic(Skill.MAGIC);
        soulRunesStartAmount = getNumberOfSoulRunes();
        natureRunesStartAmount = getNumberOfNatureRunes();

        log("MegaManAlpha's Stun-Alcher script has now started!");
        log("You will be splashing: " + targetEnemyName);
        started = true;
    }
    
    @Override
    public int onLoop() throws InterruptedException {
        if(started) getState();
        return random(100, 200);
    }
 
    private void getState() throws InterruptedException {
        if(!client.isLoggedIn()) {
            log("Not logged in.");
            log("You need to be logged in for this script to work.");
            return;
        }
        
        if(!tabs.getOpen().equals(Tab.MAGIC)) {
            if(tabs.open(Tab.MAGIC)) {
                sleepUntilMagicTabOpens();
            }
            return;
        }
        
        Entity enemy = npcs.closest(targetEnemyName);
        if(enemy == null) {
            log("Target enemy not found");
            return;
        }
        
        soulRunesCurrentAmount = getNumberOfSoulRunes();
        natureRunesCurrentAmount = getNumberOfNatureRunes();
        soulRunesUsed = soulRunesStartAmount - soulRunesCurrentAmount;
        natureRunesUsed = natureRunesStartAmount - natureRunesCurrentAmount;
        currentMagicExp = skills.getExperience(Skill.MAGIC);

        if(magic.castSpellOnEntity(Spells.NormalSpells.STUN, enemy) && sleepUntilStunIsCast(soulRunesCurrentAmount)) {
            sleep(random(25, 100));
            if(moveMouseToAlchArea()) {
                leftClick();
                if(sleepUntilInventoryTabActive() && isHighAlchOption()) {
                    sleep(random(25, 100));
                    leftClick();
                    sleepUntilMagicTabOpens();
                }
            }
        }
    }
    
    private int getNumberOfSoulRunes() throws InterruptedException {
        for(Item item : inventory.getItems()) {
            if(item != null && item.getDefinition() != null && item.getName() != null) {
                if(item.getName().equals("Soul rune")) {
                    return item.getAmount();
                }
            }
        }
        return 0;
    }
    
    private int getNumberOfNatureRunes() throws InterruptedException {
        for(Item item : inventory.getItems()) {
            if(item != null && item.getDefinition() != null && item.getName() != null) {
                if(item.getName().equals("Nature rune")) {
                    return item.getAmount();
                }
            }
        }
        return 0;
    }
    
    private boolean moveMouseToAlchArea() throws InterruptedException {
        //high alch area rectangle
        //709, 322
        //719, 336
        mouse.move(random(709, 719), random(322, 336));
        return isHighAlchOption();
    }
    
    private boolean isHighAlchOption() {
        for(Option option : menu.getMenu()) {
            if(option != null) {
                if(option.action.equals("Cast")) {
                    if(option.name.contains("High Level Alchemy")) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
    
    private void leftClick() {
        mouse.click(false);
    }
    
    private void rightClick() {
        mouse.click(true);
    }
    
    private void sleepUntilMagicTabOpens() throws InterruptedException {
        long startTime = System.currentTimeMillis();
        long timeout = 4000;
        
        while(!tabs.getOpen().equals(Tab.MAGIC)) {
            long timeNow = System.currentTimeMillis();
            if(timeNow > startTime + timeout) {
                break;
            }
            sleep(100);
        }
    }
    
    private boolean sleepUntilStunIsCast(int startNumOfSoulRunes) throws InterruptedException {
        long startTime = System.currentTimeMillis();
        long timeout = 4000;
        
        while(getNumberOfSoulRunes() == startNumOfSoulRunes) {
            long timeNow = System.currentTimeMillis();
            if(timeNow > startTime + timeout) {
                return false;
            }
            sleep(100);
        }
        
        return true;
    }
    
    private boolean sleepUntilInventoryTabActive() throws InterruptedException {
        long startTime = System.currentTimeMillis();
        long timeout = 4000;
        
        while(!tabs.getOpen().equals(Tab.INVENTORY)) {
            long timeNow = System.currentTimeMillis();
            if(timeNow > startTime + timeout) {
                return false;
            }
            sleep(100);
        }
        
        return true;
    }
    
    @Override
    public void onPaint(Graphics2D g) {
        int baseY = 10;
        int baseX = 275;
        int gapYAfterHeading = 20;
        g.setColor(Color.LIGHT_GRAY);
        g.fillRect(baseX, baseY, 290, 151);
        g.setColor(Color.BLACK);
        g.drawString("---: STUN-ALCHER :---", baseX+30, baseY+20);
        
        long totalRunTime = System.currentTimeMillis() - scriptStartTime;
        long secondsRunTime = totalRunTime / 1000;
        long minutesRunTime = 0;
        if(secondsRunTime >= 60) {
            minutesRunTime = secondsRunTime / 60;
            secondsRunTime = secondsRunTime - (minutesRunTime * 60);
        }
        String strRunTime = "";
        if(minutesRunTime > 0)
            strRunTime += minutesRunTime + "min ";
        strRunTime += secondsRunTime + "s";
        g.drawString("Run Time: " + strRunTime, baseX+10, baseY+gapYAfterHeading+35);
        
        g.drawString("Total Stuns: " + soulRunesUsed, baseX+10, baseY+gapYAfterHeading+50);

        g.drawString("Total High Alchs: " + natureRunesUsed, baseX+10, baseY+gapYAfterHeading+65);
        
        g.drawString("Exp to next level: " + NumberFormat.getNumberInstance(Locale.ENGLISH).format(skills.experienceToLevel(Skill.MAGIC)), baseX+10, baseY+gapYAfterHeading+80);
        
        int totalMagicExp = currentMagicExp - startMagicExp;
        String strMagicExp = NumberFormat.getNumberInstance(Locale.ENGLISH).format(totalMagicExp);
        g.drawString("Total Exp gained: " + strMagicExp, baseX+10, baseY+gapYAfterHeading+95);
        
        int magicLevel = skills.getStatic(Skill.MAGIC);
        g.drawString("Current level: " + magicLevel, baseX+10, baseY+gapYAfterHeading+110);
        
        g.drawString("Levels gained: " + (magicLevel - startMagicLevel), baseX+10, baseY+gapYAfterHeading+125);
    }
}

Edited by MegaManAlpha

Looks really good, is this a very expensive method? Tempted to go for 90 magic or so.

  • Author

Looks really good, is this a very expensive method? Tempted to go for 90 magic or so.

 

I only just started doing it today. So I don't know if it's expensive.

 

So far I've paid about 500k for a mud staff (mud gives me infinite earth and water runes).

 

So it means I can cast the Stun spell easily, Stun requires: 12 water, 12 earth and 1 soul rune.

 

The downside is you need to use fire runes for the high alching, since you will be wielding a mud staff.

 

I have only trialed this script with 2k soul runes, 2k natures, and 2k maple longbows (and 10k fire runes), i have been very impressed with the mega exp rates.

Hi there, I watched the video you posted and am really interested to try this method to train magic.

 

May I know how can I add the script into the client? I do not see a jar file that I can download and place into the Scripts folder.

 

Thanks :)

looks like a promising script, in future editing it would be great to add on a way to run from combat then take breaks

looks like a promising script, in future editing it would be great to add on a way to run from combat then take breaks

What do you mean run away from combat?

Why dont you just safespot while using the script?

  • 4 weeks later...
  • 7 months later...

Just curious how do I get a cursor that has the black ring after I click?

Create an account or sign in to comment

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.