Teamwork Posted May 13, 2022 Share Posted May 13, 2022 (edited) 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 May 13, 2022 by Teamwork Quote Link to comment Share on other sites More sharing options...
Gunman Posted May 13, 2022 Share Posted May 13, 2022 @Teamwork OSBot doesn't hook var bits. So you can't access var bits with OSBot API. There was talk about adding them a while back, but they decided not to for some reason 1 Quote Link to comment Share on other sites More sharing options...
Developer Patrick Posted May 13, 2022 Developer Share Posted May 13, 2022 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; } 3 Quote Link to comment Share on other sites More sharing options...
Malcolm Posted May 14, 2022 Share Posted May 14, 2022 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 Quote Link to comment Share on other sites More sharing options...
Teamwork Posted May 14, 2022 Author Share Posted May 14, 2022 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. Quote Link to comment Share on other sites More sharing options...