DragonAlpha Posted April 20, 2015 Share Posted April 20, 2015 (edited) 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 April 20, 2015 by MegaManAlpha 1 Quote Link to comment Share on other sites More sharing options...
Okabe Posted April 20, 2015 Share Posted April 20, 2015 (edited) Code is safe! pastebin clone for comparison http://pastebin.com/xhz8vrJ5 (so the user can't edit the post after the check) Edited April 20, 2015 by Okabe Quote Link to comment Share on other sites More sharing options...
DragonAlpha Posted April 20, 2015 Author Share Posted April 20, 2015 Thanks for confirming the code. Nice guy Quote Link to comment Share on other sites More sharing options...
Epsilon Posted April 20, 2015 Share Posted April 20, 2015 Looks really good, is this a very expensive method? Tempted to go for 90 magic or so. Quote Link to comment Share on other sites More sharing options...
DragonAlpha Posted April 20, 2015 Author Share Posted April 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
Blobby7 Posted April 21, 2015 Share Posted April 21, 2015 Whats the ban rate for this? Is it safe? Quote Link to comment Share on other sites More sharing options...
doublewinftw Posted April 26, 2015 Share Posted April 26, 2015 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 Quote Link to comment Share on other sites More sharing options...
Master Oha Posted April 29, 2015 Share Posted April 29, 2015 looks like a promising script, in future editing it would be great to add on a way to run from combat then take breaks Quote Link to comment Share on other sites More sharing options...
maxitaxi Posted May 1, 2015 Share Posted May 1, 2015 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? Quote Link to comment Share on other sites More sharing options...
magerz Posted May 8, 2015 Share Posted May 8, 2015 Can anyone tell me how to get this on my scripts please? Quote Link to comment Share on other sites More sharing options...
rumplestumple Posted May 10, 2015 Share Posted May 10, 2015 outdated Quote Link to comment Share on other sites More sharing options...
Mad Jew Posted June 7, 2015 Share Posted June 7, 2015 im gna try this after a couple more mage levels, hope it works :p Quote Link to comment Share on other sites More sharing options...
yadude Posted January 12, 2016 Share Posted January 12, 2016 Just curious how do I get a cursor that has the black ring after I click? Quote Link to comment Share on other sites More sharing options...