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.

Get the total lvl

Featured Replies

Dear community!

 

I got another question about getting my bot look at the total lvl

we all know we can get static/dynamic skills like this:

(getSkills().getDynamic(Skill.MINING) 

But I not found out yet how to get the bot look a total lvl

Maybe a widget or is there a code for it?

 

Thanks for the help!

 

Not sure if there is a method in the Skills API, I can't seem to find one, but you could do something like this... 

int totalLevel = 0;

for( Skill skill : Skill.values() ){
	totalLevel += getSkills().getStatic(skill);
}

log("My total level is " + totalLevel); 

 

Edited by jca

  • Author
5 minutes ago, jca said:

Not sure if there is a method in the Skills API, I can't seem to find one, but you could do something like this... 


int totalLevel = -1;

for( Skill skill : Skill.values() ){
	totalLevel += getSkills().getStatic(skill);
}

log("My total level is " + totalLevel); 

 

Thanks! I will try this! <3

2 hours ago, jca said:

Not sure if there is a method in the Skills API, I can't seem to find one, but you could do something like this... 


int totalLevel = -1;

for( Skill skill : Skill.values() ){
	totalLevel += getSkills().getStatic(skill);
}

log("My total level is " + totalLevel); 

 

 

That's going to be off by 1, totalLevel should be initialised to 0

Alternative using streams:
 

int totalLevel = Arrays.stream(Skill.values())
                       .mapToInt(skill -> getSkills().getStatic(skill))
                       .sum();



 

Edited by Explv

2 minutes ago, Explv said:

 

That's going to be off by 1

Of course, my bad. I'll correct!

On 12/9/2018 at 11:30 AM, Explv said:

 

That's going to be off by 1, totalLevel should be initialised to 0

Alternative using streams:
 


int totalLevel = Arrays.stream(Skill.values())
                       .mapToInt(skill -> getSkills().getStatic(skill))
                       .sum();



 

*ahem* getSkills()::getStatic

2 hours ago, liverare said:

*ahem* getSkills()::getStatic

*drops mic*

 

Now for the true s3 way to do it

private final static int MAX_TOTAL_LEVEL = 2277;

public int getTotalLevel(){

  int totalLevel = MAX_TOTAL_LEVEL;
  for(int i = 0; i < Skill.values().length; i++){
      totalLevel -= 99 - getSkills().getStatic(Skill.values()[i]);  
  }
  
  return totalLevel;
}

I'll see myself out, selling private scripts

Edited by Tom

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.