Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Buy OSRS Gold

Sell OSRS Gold
erickho123

[Scripting tutorial] What RSVarBits are and examples of use.

Recommended Posts

What is the RSVarBit class?

Since settings can contain multiple data (I.E: Abyss obstacle rotations, F Keys, Runecrafting pouches, etc), scriptwriters would have to manually unpack this information with bitwise operations. With the newly introduced RSVarBit class on TRiBot, you don't have to do that anymore. The information provided by VarBit is way easier for a human to read compared to raw values.

 

 

RSVarBit Explorer

You can use this modified verison of Starfox's settings listener to detect the changes. It is very similiar to a settings listener. 99% credits to Starfox for the source.

https://tribot.org/repository/script/id/1480-varbit-explorer/

 

 

When to use the RSVarBit class?

You should use it when the setting holds multiple values. Some examples: Customizable f keys, runecrafting pouches, abyss obstacle rotations, farming, detect if achievement/quest/minigame tab is open, how much ores in the blast furnance, how many bars are in the BF storage, ingame world hopper favorite worlds, etc. There are many uses for varbits/settings to be used in scripts.

 

Examples of use:

Detecting my customizable F Keys:

Using RSVarBit Explorer, I change one of my F keys to a key so the explorer can detect a change. In this case, I changed the "Open Inventory" tab keybind to F5 key. Before I changed it to F5 key, the key was on F9. You can see that in this gif here: https://imgrush.com/UXeEJ-an3E5i

Looking at RSVarBit Explorer, there should be a change:

DLAmiwz.png

[18:20:51] 4680: 5 -> 0

[18:20:51] 4678: 9 -> 5 

The first print means that the "F5" key from the prayer tab got keybinded to "None". (Value for that is "0").

The second print means that the inventory tab got rekeybinded from F9 to F5.

 

So I could do the code below to check if the F5 Key is keybinded to inventory

private boolean isOnF5() {RSVarBit varBit = RSVarBit.get(4678); // index is determined from explorer, RED in prints above.return varBit != null && varBit.getValue() == 5;}

Let's try to do it with an settings explorer.

VjGSI9H.png

As you could see above, the data returned isn't quite readable without shifting and masking the values. This could be very confusing and complicated for a novice programmer. Using the varbits class helps tremendously and saves you a lot of time.

Edited by erickho123
  • Like 12

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Our picks

    • Hello everyone,

      Last week we tried to roll out Auth0 Login, but we lost that battle. Now it's time to win the war!

      Important changes

      When logging into the client, you'll now have to enter your Auth0 account credentials instead of your forums credentials

      Note: 2FA is still handled through your forums account (for the time being)



      Changes for existing users

      You'll have to link your Auth0 account to your forums account here: https://tribot.org/forums/settings/login/?service=11


      Auth0 accounts have been created for most existing users. Please use your forums email address and password to login.



      Important notes

      Make sure to verify your email address upon creating a new Auth0 account


      When we mention your Auth0 account, we mean your account used for auth.tribot.org as displayed below
      • 41 replies
    • To better support the upcoming changes (TRiBot X, new repository), we're switching our login handler to Auth0. Instead of logging in with the standard form, you'll now be required to login through our Auth0 application.

      All existing accounts which have been used within approximately the past year have been imported into Auth0 using the same email and password combination which has been stored on the forums.

      What does this mean for users?

      Your account credentials are now even more securely stored


      You'll be able to login via Facebook, Google, and others in the future


      Is there anything users have to do differently now?

      Existing users: You'll have to login with the standard login, open your Account Settings, then link your Auth0 account


      New users: You'll be redirected to our Auth0 app (auth.tribot.org) where you'll be able to create an account


      Why was this change made?

      The new apps we are creating (such as the new repository) aren't able to use the forums to handle user logins


      To centralize all user accounts in one area


      To ensure that the client login doesn't go down when the forums are having problems


      To speed up our development


      Other considerations

      There's no documentation or official support for using Invision Community combined with Auth0, so there are still a few kinks we're working out


      We're in the works of creating an account management panel specifically for Auth0 accounts (ETA August)


      It's not possible to change email addresses for the time being (this will be resolved this August)


      Changing passwords is a weird process for the time being. To change your password, you'll have to use the "Don't remember your password" tool on the Auth0 login page
      • 10 replies
    • Over the past month, we've been working hard on TRiBot's new repository - a much needed update. This change has been deemed necessary for TRiBot X, and will allow us to really speed up development of all aspects of TRiBot.

      Today we are going to share what we've been working on!


      Now you must be wondering what kind of features the new repository will have.... well, you'll have to be patient for a little while longer. We're still figuring out various technical aspects so we can't provide answers to all possible questions. We're also focusing on development rather than writing about it so that everyone can get access to our latest developments at lightning speed. I will however answer a few users' questions.

      We're planning on a release of this early to mid August, giving users some goodies before TRiBot X's release.

      Thank you all for being patient. I hope everyone is excited as much as I am!
      • 17 replies
    • Over the past few months, I’ve been working diligently on a new project - TRiBot X. Everything has been written from the ground up, with all of the best practices of software engineering. Every aspect of TRiBot has been re-imagined to support three main goals: flexibility, useability, and reliability.
      • 50 replies
    • Come give us feedback on the next version of TRiBot!
      • 86 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...