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
  • How to hover over skillpane to check xp?


    Encore

    Recommended Posts

    ur field that you declared "Skill prayer" is null, as it it has no value assigned to it. 

     

    You have to set a value to it by using the = operator.

     

    How is java to know you want the prayer tab if you don't set a value? All it sees is you created a field with the type Skill and named it prayer.

     

     

    Tho in actuality there is an enum of Skills named Skill. To access the prayer skill you just use Skill.Prayer

     

     

    His problem is that he's trying understand when he can use certain methods. Player does not have a hoverSkill() method.

    Link to comment
    Share on other sites

    I began at your level. Just do things step by step and eventually there will be a point where some puzzle pieces fall together and you understand why certain things work and don't work.

     

    Just keep playing around with codes and ask the things you don't understand. The most important part is try to think which steps you manually take to do things, that's how you also command the computer.

     

    In your case: to hover a skill you need to do the following things in order:

    1. open skill tab if it's not open
    2. chose a random skill or a skill you want to check on
    3. hover it
    4. (optional) go back to inventory tab

     

    That being said, your code will be something like this:

    if(getTabs().isOpen(Tab.STATS)){
       if(getSkills().hoverSkill(Skill.PRAYER)){  //will return TRUE if it successfully hovered skill, else FALSE
          getTabs.open(Tab.INVENTORY);  //can also put an if-statement to make sure it opens tab even when missclicked
       }
    } else {
       getTabs().open(Tab.STATS);  //if the tab stats is not open, open it. The if statement on top will return false if its not open, so it skips the following code after the "{" bracket.
    

    Something like that :).

    Link to comment
    Share on other sites

    I began at your level. Just do things step by step and eventually there will be a point where some puzzle pieces fall together and you understand why certain things work and don't work.

     

    Just keep playing around with codes and ask the things you don't understand. The most important part is try to think which steps you manually take to do things, that's how you also command the computer.

     

    In your case: to hover a skill you need to do the following things in order:

    1. open skill tab if it's not open
    2. chose a random skill or a skill you want to check on
    3. hover it
    4. (optional) go back to inventory tab

     

    That being said, your code will be something like this:

    if(getTabs().isOpen(Tab.STATS)){
       if(getSkills().hoverSkill(Skill.PRAYER)){  //will return TRUE if it successfully hovered skill, else FALSE
          getTabs.open(Tab.INVENTORY);  //can also put an if-statement to make sure it opens tab even when missclicked
       }
    } else {
       getTabs().open(Tab.STATS);  //if the tab stats is not open, open it. The if statement on top will return false if its not open, so it skips the following code after the "{" bracket.
    

    Something like that :).

     

    You called getTabs like 4 times, pls save it to a variable

    Link to comment
    Share on other sites

    I began at your level. Just do things step by step and eventually there will be a point where some puzzle pieces fall together and you understand why certain things work and don't work.

     

    Just keep playing around with codes and ask the things you don't understand. The most important part is try to think which steps you manually take to do things, that's how you also command the computer.

     

    In your case: to hover a skill you need to do the following things in order:

    1. open skill tab if it's not open
    2. chose a random skill or a skill you want to check on
    3. hover it
    4. (optional) go back to inventory tab

     

    That being said, your code will be something like this:

    if(getTabs().isOpen(Tab.STATS)){
       if(getSkills().hoverSkill(Skill.PRAYER)){  //will return TRUE if it successfully hovered skill, else FALSE
          getTabs.open(Tab.INVENTORY);  //can also put an if-statement to make sure it opens tab even when missclicked
       }
    } else {
       getTabs().open(Tab.STATS);  //if the tab stats is not open, open it. The if statement on top will return false if its not open, so it skips the following code after the "{" bracket.
    

    Something like that :).

    sexy! thanks

    Link to comment
    Share on other sites

    You called getTabs like 4 times, pls save it to a variable

    and hog all teh computer resources >.<

     

    Errrr.. Yeah.. You can save it to a variable, but does that really make a difference? If i call the variable, i also call the method unless i create the variable on startup? I mean, calling a method won't store any data permanently does it?

     

     

    sexy! thanks

    No problem dude. I still make many mistakes and learn from them, it's just the progress of your Java skill :).

    Link to comment
    Share on other sites

    Errrr.. Yeah.. You can save it to a variable, but does that really make a difference? If i call the variable, i also call the method unless i create the variable on startup? I mean, calling a method won't store any data permanently does it?

     

     

    No problem dude. I still make many mistakes and learn from them, it's just the progress of your Java skill :).

     

    I don't mean in terms of memory, it wouldn't make any difference what so ever. I'm talking about cleanliness, the line would be shorter and less verbose 

    Link to comment
    Share on other sites

    I don't mean in terms of memory, it wouldn't make any difference what so ever. I'm talking about cleanliness, the line would be shorter and less verbose 

    Well first of all i think using a variable for just "getTabs()" is more confusing than just typing the method. But thanks for the tip!

     

    Second of all i tried to keep it as simple as i could for OP :P

    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.