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.

Varbits VarPlayers and Configs

Featured Replies

I've been wanting to create a questing script recently so I spent some time looking at the Configs class from the api to understand how I can  get access to quest state and such. This led me down a rabbit hole of Varbits and Varplayers and I can't seem to understand how we can access a Varbit from the API. 

If I use configs.get(29) then this should return an int with the state of the quest cook's assistant because 29 is the Varplayer for cook's assistant's current state. But some quests use a Varbit instead of Varplayer, for example if I look at runelite's github or the wiki they both list Varbit 217 as the state of the quest Ghosts Ahoy. So does that mean that using configs.get(217) should return the state of Ghosts Ahoy or it just won't work because the get method only works for Varplayer IDs?(I haven't tested this) If none of the Varplayer and Varbit had the same ID I wouldn't be confused but it turns out Varbit 29 stores the type of rune in the rune pouch and some other IDs overlap as well. 

 

So I guess my question is, how do i access Varbit?

Also I didn't post link to the github or the wiki because I wasn't sure if it was against forum rules. But i can add them if it helps. 

 

Thanks for the help 

 

Edited by Teamwork

  • Developer

Varbits are just a bitmask over the config in the end, so if you get hold of the config, most- and least significant bit, you can get the varbit value via something like this

EQUIPPED_WEAPON_TYPE(843, 5, 0);

private final int configId;
private final int msb;
private final int lsb;

Varbits(int configId, int msb, int lsb) {
    this.configId = configId;
    this.msb = msb;
    this.lsb = lsb;
}

public int getValue(Configs configs) {
    int mask = (1 << ((msb - lsb) + 1)) - 1;
    return (configs.get(configId) >> lsb) & mask;
}

 

15 hours ago, Patrick said:

Varbits are just a bitmask over the config in the end, so if you get hold of the config, most- and least significant bit, you can get the varbit value via something like this

EQUIPPED_WEAPON_TYPE(843, 5, 0)
private final int configId;
private final int msb;
private final int lsb;
Varbitsint , int , int thisconfigId ;
    thismsb ;
    thislsb ;
public int getValueint 1 msb lsb11;
    return configIdlsb;

 

imagine not using the keyword "this" in #getValue.

Demoted to S1

  • Author
16 hours ago, Patrick said:

Varbits are just a bitmask over the config in the end, so if you get hold of the config, most- and least significant bit, you can get the varbit value via something like this

 

Wow that's very good stuff thanks for the info, it took me quite a while to understand it all but it makes a whole lot of sense. I didn't know that the Config instance we retrieved with method provider contained both Varplayer and Varbits.

I was looking at this post 

 and the last answer talked about how he got his info from the cache so I'll try to get the lsb, msb and config id from there. 

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.