Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved What's the difference between varps and varpbits?

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

Ofk3ECp.png
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
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. 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.
 
Joined
Apr 18, 2015
Messages
408
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. 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.
Api wise what does this involve?
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Api wise what does this involve?
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.
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
I never saw the varpbits tab until now, too. It must have been a recent addition.
tbh I never really noticed varpbits until now
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.
 
Joined
Apr 18, 2015
Messages
408
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.
I didn't notice the varpbits class apparently
 
Joined
Dec 18, 2014
Messages
398
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.
 
Joined
Feb 24, 2015
Messages
1,206
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? I heard alot about IntellJ or how is it called, but i always used eclipse :p ( i am refering to RSBot in 2009 xd )
 
Joined
Dec 10, 2014
Messages
3,255
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.
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
 
Joined
Apr 18, 2015
Messages
408
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? I heard alot about IntellJ or how is it called, but i always used eclipse :p ( i am refering to RSBot in 2009 xd )
Still using Eclipse over here ;)
 
Joined
Dec 10, 2014
Messages
3,255
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? I heard alot about IntellJ or how is it called, but i always used eclipse :p ( i am refering to RSBot in 2009 xd )
You didn't ask me but I use IntelliJ and have been for a long time. I highly recommend it :D
 
Joined
Apr 18, 2015
Messages
408
@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)
 
Top