Articron 738 Author Share Posted September 3, 2016 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 More sharing options...
RS Rhino 0 Share Posted January 13, 2019 Amazing thank you Link to comment Share on other sites More sharing options...
RS Rhino 0 Share Posted January 13, 2019 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 More sharing options...
m4rr3co 67 Share Posted April 19, 2020 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 More sharing options...
wettofu 109 Share Posted April 20, 2020 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? In this situation, x would be 179, look for it in the Debug Tool -> Player Settings Link to comment Share on other sites More sharing options...
m4rr3co 67 Share Posted April 20, 2020 8 hours ago, wettofu said: 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.