1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved What's the difference between varps and varpbits?

Discussion in 'Client & Site Support' started by Hazard, Jun 12, 2015.

  1. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    Whats the difference between Varps and Varpbits? Both have different values too by the way. @Cloud

    [​IMG]
     
  2. Best Answer:
    Post #2 by Cloud, Jun 12, 2015
  3. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    This is the wrong section for this but I'll go ahead and answer it anyways.

    Varps stands for player varps. They are the raw integers that contain many pieces of player specific information. They can often be used by themselves, but often multiple pieces of information get packed into a single varp. This is where Varpbits come into play.

    When multiple pieces of information are packed into a single varp, you have two options. The way things have previously been done in the scene would require the bot author to manually unpack the values they want using shifts and masks, but that's not really convenient and leaves a lot of room for error. The solution to this is to use the game client's varpbits. Varpbits are used to isolate individual pieces of information from varps for access within the game's client scripts bots. A varpbit is like a 1 to 1 mapping to a specific value. It does this by specifying a most and least significant bit internally and then extracting it.

    TL;DR
    When a varp contains one piece of information, use the raw varps.
    When a varp has multiple pieces of information packed within it, use varpbits for easy extraction.
     
    Qosmiof2 likes this.
  4. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    Api wise what does this involve?
     
  5. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    What do you mean? There is both a Varps class and a Varpbits class. You use the index you see in the dev toolkit and call the respective api methods to get there values.
     
  6. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    tbh I never really noticed varpbits until now
     
  7. Philosobyte

    Joined:
    Dec 18, 2014
    Messages:
    398
    Likes Received:
    79
    I never saw the varpbits tab until now, too. It must have been a recent addition.
     
  8. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    It was added less than a week ago in response to me not wanting to extract all the bits from a varp after the resizable oldschool update. Internally we've had them for a while but I added them in the developer toolkit to make it easier for me to debug and it's useful for you guys too.
     
    dog_ likes this.
  9. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    I didn't notice the varpbits class apparently
     
  10. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    Varpbits seems so much easier to deal with xD
     
  11. Philosobyte

    Joined:
    Dec 18, 2014
    Messages:
    398
    Likes Received:
    79
    Maybe it would be wise to announce to developers the addition of a significant new feature so we can notice and make use of it quickly. ;)

    Varpbits would have solved ALL of my problems with runecrafting pouches... would have saved so much frustration and time caused by the inadequacy of varps... aargh.
     
  12. kristiaan

    Joined:
    Feb 24, 2015
    Messages:
    1,206
    Likes Received:
    203
    Nice :D i noticed it :p but also did not know the difference... geez i should really start coding again :D maybe when i get my new pc :D

    @Cloud @Hazard What IDE do you guys use to make a script bot? I heard alot about IntellJ or how is it called, but i always used eclipse :p ( i am refering to RSBot in 2009 xd )
     
  13. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    I manually found the shift and worked out a mask to deal with that xD also there was a pattern between the ordinal of the enum and the bit corresponding to if it contains essence :p

    Varpbits would have been even easier though xD
     
  14. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    Still using Eclipse over here ;)
     
  15. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    You didn't ask me but I use IntelliJ and have been for a long time. I highly recommend it :D
     
    Philosobyte likes this.
  16. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    @Cloud can the Varpbit class be added to the Jdocs as it's not there just yet ;)
    (That's kinda the reason I opened this topic too)
     
  17. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Done.
     
    Hazard likes this.
  18. kristiaan

    Joined:
    Feb 24, 2015
    Messages:
    1,206
    Likes Received:
    203
    Ill check it out :p sorry that i did not ask you while your one of my favorite bot authors on here haha :D
     

Share This Page

Loading...