Hopewelljnj 46 Share Posted June 28, 2016 Tho in actuality there is an enum of Skills named Skill. To access the prayer skill you just use Skill.Prayer Link to comment Share on other sites More sharing options...
slasso 27 Share Posted June 28, 2016 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 More sharing options...
Cardozz 46 Share Posted June 28, 2016 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: open skill tab if it's not open chose a random skill or a skill you want to check on hover it (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 More sharing options...
Mad 86 Share Posted June 28, 2016 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: open skill tab if it's not open chose a random skill or a skill you want to check on hover it (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 More sharing options...
Hopewelljnj 46 Share Posted June 28, 2016 You called getTabs like 4 times, pls save it to a variable Or... don't Link to comment Share on other sites More sharing options...
Volta 183 Share Posted June 29, 2016 Or... don't and hog all teh computer resources >.< Link to comment Share on other sites More sharing options...
Encore 0 Author Share Posted June 29, 2016 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: open skill tab if it's not open chose a random skill or a skill you want to check on hover it (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 More sharing options...
Cardozz 46 Share Posted June 29, 2016 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 More sharing options...
Mad 86 Share Posted June 29, 2016 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 More sharing options...
Cardozz 46 Share Posted June 29, 2016 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.