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.

Magic combat methods

Featured Replies

EDIT: for an improved version of this by  go > here <.

 

 

Hi, have been working on some magic combat scripts, here are some "spell manager" methods I made. These only support strike spells and air staff but are easily expandable, I just haven't because I never needed anything else. Constructive feedback is appreciated, feel free to use these as you wish, credit appreciated tho biggrin.png

 

Variables:

ArrayList<Integer> spellmanagerRuneType = new ArrayList<Integer>(5);
String spellname = "Fire_strike";
String stafftype = "Air";
Boolean usestaff = true;
int spellspertrip = 100;

To find out which runes are required for your selected spell:

spellmanagerRuneType = magicRuneTypeManager(spellname, usestaff, stafftype);
public ArrayList<Integer> magicRuneTypeManager(String spell,
Boolean useStaff, String staff) {
ArrayList<Integer> runes = new ArrayList<Integer>();
int firerune = 554;
int waterrune = 555;
int airrune = 556;
int earthrune = 557;
int mindrune = 558;
if (useStaff = true) {
if (staff == "Air") {
if (spell == "Wind_strike") {
runes.add(mindrune);
}
if (spell == "Water_strike") {
runes.add(mindrune);
runes.add(waterrune);
}
if (spell == "Earth_strike") {
runes.add(mindrune);
runes.add(earthrune);
}
if (spell == "Fire_strike") {
runes.add(mindrune);
runes.add(firerune);
}
}
} else {
if (spell == "Wind_strike") {
runes.add(airrune);
runes.add(mindrune);
}
if (spell == "Water_strike") {
runes.add(airrune);
runes.add(mindrune);
runes.add(waterrune);
}
if (spell == "Earth_strike") {
runes.add(airrune);
runes.add(mindrune);
runes.add(earthrune);
}
if (spell == "Fire_strike") {
runes.add(airrune);
runes.add(mindrune);
runes.add(firerune);
}
}
return runes;
}

To check if you have the required amount of runes in your inventory for at least 1 cast, if not: initiate your banker method:

int j = 0;
while (spellmanagerRuneType.size() > j) {
int runesfor1spell = magicRuneAmountManager(spellname, spellmanagerRuneType.get(j)) * 1;
if (!(this.client.getInventory().getAmount(
spellmanagerRuneType.get(j)) >= runesfor1spell)) {
banker();
} else {
j++;
}
}
public Integer magicRuneAmountManager(String spell,
Integer runeID) {
int runesforspell = 0;
int firerune = 554;
int waterrune = 555;
int airrune = 556;
int earthrune = 557;
int mindrune = 558;
if (spell == "Wind_strike") {
if (runeID == mindrune ) {
runesforspell = 1;
}
if (runeID == airrune ) {
runesforspell = 1;
}
}
if (spell == "Water_strike") {
if (runeID == mindrune ) {
runesforspell = 1;
}
if (runeID == waterrune ) {
runesforspell = 1;
}
if (runeID == airrune ) {
runesforspell = 1;
}
}
if (spell == "Earth_strike") {
if (runeID == mindrune ) {
runesforspell = 1;
}
if (runeID == earthrune ) {
runesforspell = 2;
}
if (runeID == airrune ) {
runesforspell = 1;
}
}
if (spell == "Fire_strike") {
if (runeID == mindrune ) {
runesforspell = 1;
}
if (runeID == firerune ) {
runesforspell = 3;
}
if (runeID == airrune ) {
runesforspell = 2;
}
}
return runesforspell;
}

Add this to your banker method to withdraw runes your selected amount of casts:

int j = 0;
while (spellmanagerRuneType.size() > j) {
if (!this.client.getInventory().contains(
spellmanagerRuneType.get(j))) {
int withdrawamount = magicRuneAmountManager(spellname, spellmanagerRuneType.get(j)) * spellspertrip;
bank.withdrawX(spellmanagerRuneType.get(j), withdrawamount);
} else {
j++;
}}
 

 

 

Edited by Botrepreneur

For comparing two string literals use String.equals(otherString)

And if (useStaff == true)

Can be

if (useStaff)

there's also a lot of other stuff that can be better..I suggest that you read the java tutorials.

Edited by Erza

  • Author

For comparing two string literals use String.equals(otherString)

And if (useStaff == true)

Can be

if (useStaff)

there's also a lot of other stuff that can be better..I suggest that you read the java tutorials.

 

They could be but they are not.

Feel free to explain me why I should change them smile.png

Edited by Botrepreneur

rlly :/ ?

i didn't mean it in a harsh way, sorry if it sounded like that but there's definitely some stuff you should read up on

Couldn't most of this data be added to an enum? You could then iterate over it with enum.values() which would get rid of those nested if statements.

  • Author

Couldn't most of this data be added to an enum? You could then iterate over it with enum.values() which would get rid of those nested if statements.

 

Seems like that would be a nice improvement indeed old sport.

Seems like that would be a nice improvement indeed old sport.

are you going to do it? if not ill be able to do it :D

  • Author

are you going to do it? if not ill be able to do it biggrin.png

 

I'm working on some other stuff, this works for me as it is now.

However, if you have the time and will to do it please do :D

Will gladly replace my messy code with a neater enum version ;)

Guest
This topic is now closed to further replies.

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.