Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • PlayerSettings : Bitwise operations and bitmasks


    Articron

    Recommended Posts

    Gonna make an addition since it's been a while and there has been some talk in chat about how to apply this to player settings.

     

    Let's take runecrafting pouches for an example, and how to make methods for checking if said pouch is full. The player setting 720 refers to the ingame data that is stored regarding the players pouches.

     

    When only the small pouch is full, the setting reads 2, only med pouch is 8, and only full is 32;

    Binary counterparts:

    0b00000000000000000000000000000010 <- 2 aka small

    0b00000000000000000000000000001000 <- 8 aka medium

    0b00000000000000000000000000100000 <- 32 aka large

     

    Now lets say the setting returns 34, so the binary is:

    0b00000000000000000000000000100010

     

    By this we can tell that both the large and small pouches are full. Whenever the small pouch is full, the 2nd bit is set to 1, and whenever the large pouch is full, the 6th bit is set to 1.

     

    So how do we use the bitwise ops?

     

    Lets take a look at isMediumPouchFull:

    private boolean isMediumPouchFull() {
    	return ((Settings.get(720) >> 3) & 1) == 1;
    }
    

    >> 3 means we are shifting by 3, so instead of reading

    0b00000000000000000000000000001000

    we are only reading 

    0b00000000000000000000000000001

     

    and then the mask ( & 1) means we are only reading the first bit, which in the case of the pouch being full, would be 1, and if it isn't, 0.

     

    Thanks for the addition, I always forgot to add a simple demonstration myself.

    Added to the original post, thx Otter

    Link to comment
    Share on other sites

    • 2 years later...
    On 9/3/2016 at 10:31 AM, Articron said:

    Let's take runecrafting pouches for an example, and how to make methods for checking if said pouch is full. The player setting 720 refers to the ingame data that is stored regarding the players pouches.

    Articron how do I check which player setting I need to review? In this example you have used 720 but say if I want to check quest progress how do I know which player setting I will need?

    Link to comment
    Share on other sites

    • 1 year later...

    Sorry for reviving this topic, but how do you usually search for the pertinents settings? How do you find them?

    In java, i would like to know this:

    getPlayersetting.getconfig(x);

    what x would be or how do you usually look for them?

    Link to comment
    Share on other sites

     

    13 hours ago, m4rr3co said:

    Sorry for reviving this topic, but how do you usually search for the pertinents settings? How do you find them?

    In java, i would like to know this:

    
    getPlayersetting.getconfig(x);

    what x would be or how do you usually look for them?

     

    image.png.30c09d2361935d49ddf718df8e089276.png

    In this situation, x would be 179, look for it in the Debug Tool -> Player Settings

    Link to comment
    Share on other sites

    8 hours ago, wettofu said:

     

     

    image.png.30c09d2361935d49ddf718df8e089276.png

    In this situation, x would be 179, look for it in the Debug Tool -> Player Settings

    i'm feeling so dumb now

    thanks a lot man

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.