t0r3 Posted March 16, 2019 Share Posted March 16, 2019 (edited) Hey! Just began scripting a couple of days ago, and in need of some help. I want to withdraw an item from bank based on the condition that a skill is equal or/and above or under a certain level. How could I go about writing this? ex. if ( condition based on level is met) { getBank().withdraw("exampleItem", 1); } Snippets would be helpful Edited March 16, 2019 by t0r3 Quote Link to comment Share on other sites More sharing options...
HunterRS Posted March 16, 2019 Share Posted March 16, 2019 https://osbot.org/api/org/osbot/rs07/api/Skills.html Quote Link to comment Share on other sites More sharing options...
t0r3 Posted March 16, 2019 Author Share Posted March 16, 2019 4 minutes ago, HunterRS said: https://osbot.org/api/org/osbot/rs07/api/Skills.html Hey, sry I'm a complete beginner to java and scripting, so it is not apparently obvious to me which of these I should use and how, - could you give me any pointers? Quote Link to comment Share on other sites More sharing options...
HunterRS Posted March 16, 2019 Share Posted March 16, 2019 You want to get the current level of a specific skill, look at getDynamic or getStatic depending on your exact need. 2 minutes ago, t0r3 said: Hey, sry I'm a complete beginner to java and scripting, so it is not apparently obvious to me which of these I should use and how, - could you give me any pointers? Quote Link to comment Share on other sites More sharing options...
t0r3 Posted March 16, 2019 Author Share Posted March 16, 2019 4 minutes ago, HunterRS said: You want to get the current level of a specific skill, look at getDynamic or getStatic depending on your exact need. if (getSkills().getStatic(Skill.MINING) { getBank().withdraw("Steel pickaxe", 1); } This is as far as I get. What could I do after this to define that the mining level has to be over/equal to 6 and under 21 for it to withdraw the pickaxe? Quote Link to comment Share on other sites More sharing options...
Tom Posted March 16, 2019 Share Posted March 16, 2019 Just now, t0r3 said: if (getSkills().getStatic(Skill.MINING) { getBank().withdraw("Steel pickaxe", 1); } This is as far as I get. What could I do after this to define that the mining level has to be over/equal to 6 and under 21 for it to withdraw the pickaxe? learn java first please 1 Quote Link to comment Share on other sites More sharing options...
t0r3 Posted March 16, 2019 Author Share Posted March 16, 2019 2 minutes ago, Tom said: learn java first please Thank you for replying Yeah I know, - and I am going to! Just now, it's so fun scripting! I did manage to write a miner and a chopper that works very nicely though, only using tutorials It's probably obvious what I should do haha, but care to give me any pointers? 1 Quote Link to comment Share on other sites More sharing options...
Tom Posted March 16, 2019 Share Posted March 16, 2019 5 minutes ago, t0r3 said: Thank you for replying Yeah I know, - and I am going to! Just now, it's so fun scripting! I did manage to write a miner and a chopper that works very nicely though, only using tutorials It's probably obvious what I should do haha, but care to give me any pointers? a pointer would be to start at the beginning of java, learn the basics of how functions, conditionals, loops, variables work, then try to make a script. Your life will be 100000x easier Quote Link to comment Share on other sites More sharing options...
t0r3 Posted March 16, 2019 Author Share Posted March 16, 2019 2 minutes ago, Tom said: a pointer would be to start at the beginning of java, learn the basics of how functions, conditionals, loops, variables work, then try to make a script. Your life will be 100000x easier Yeah I know u'r right, - any good sites/articles you recommend for learning basic java, like you mentioned? Thanks. Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted March 16, 2019 Share Posted March 16, 2019 (edited) Study this over a bit: https://en.m.wikipedia.org/wiki/Java_syntax also go to @Explv's scripting tutorial here: Give that a good read and study that Java syntax and you'll be on you're way. Hope this helps! Edited March 16, 2019 by Imthabawse 1 Quote Link to comment Share on other sites More sharing options...
byliuinyint Posted March 16, 2019 Share Posted March 16, 2019 (edited) 3 hours ago, t0r3 said: if (getSkills().getStatic(Skill.MINING) { getBank().withdraw("Steel pickaxe", 1); } This is as far as I get. What could I do after this to define that the mining level has to be over/equal to 6 and under 21 for it to withdraw the pickaxe? if((getSkills().getDynamic(Skill.MINING)) >= 6 && (getSkills().getDynamic(Skill.MINING) < 21)) { getBank().withdraw("Steel pickaxe",1); } Didn't test but should be good Edited March 16, 2019 by byliuinyint 1 Quote Link to comment Share on other sites More sharing options...
t0r3 Posted March 20, 2019 Author Share Posted March 20, 2019 On 3/17/2019 at 4:02 AM, Malcolm said: You don’t want to just withdraw the item based on the condition. You also need to do checks to see if you’re at the bank, see if the bank is open and also see if the bank contains the item you’re looking for. Then you need to have an action for each possibility. Awsome thanks! How do I check if the bank is open? Also I am making a shrimp fishing script in lumby, but I have trouble interacting with the fishing spot as it is not and RS2Object which I am used to with wc and mining. Then i would just declare the RS2Object and .interact("object name") later. Is it a widget? When I use the entity hover debug it says Npc haha! Care to give me some pointers? Quote Link to comment Share on other sites More sharing options...
Naked Posted March 20, 2019 Share Posted March 20, 2019 6 hours ago, t0r3 said: Awsome thanks! How do I check if the bank is open? Also I am making a shrimp fishing script in lumby, but I have trouble interacting with the fishing spot as it is not and RS2Object which I am used to with wc and mining. Then i would just declare the RS2Object and .interact("object name") later. Is it a widget? When I use the entity hover debug it says Npc haha! Care to give me some pointers? if(bank.isOpen()){} Should be the same thing .interact(TREE_NAME, "Chop"); for example Widgets are just the overlay in the game. You won't use widgets when interacting with the actual world, just things in your inventory/bank/menus, etc Java doesn't support pointers. Seriously tho just read a lot of snippets Quote Link to comment Share on other sites More sharing options...
t0r3 Posted March 21, 2019 Author Share Posted March 21, 2019 15 hours ago, Naked said: if(bank.isOpen()){} Should be the same thing .interact(TREE_NAME, "Chop"); for example Widgets are just the overlay in the game. You won't use widgets when interacting with the actual world, just things in your inventory/bank/menus, etc Java doesn't support pointers. Seriously tho just read a lot of snippets ahok What about when I am depositing items into bank? I use getBank.deposit for this. Does getBank have anything to do with widgets? and also, the fishing version of this would be using NPC instead of RS2Object - and getNPC instead of getObject aaand, got any idea s to how I would make my fishingscript interact based on the condition that a message like leveling up is deployed on the screen? Just so that it wont wait till going idle before interacting with the fishing spot again --> getMessages? Thanks! Quote Link to comment Share on other sites More sharing options...
Xx pk xX Posted March 21, 2019 Share Posted March 21, 2019 (edited) 24 minutes ago, t0r3 said: ahok What about when I am depositing items into bank? I use getBank.deposit for this. Does getBank have anything to do with widgets? and also, the fishing version of this would be using NPC instead of RS2Object - and getNPC instead of getObject aaand, got any idea s to how I would make my fishingscript interact based on the condition that a message like leveling up is deployed on the screen? Just so that it wont wait till going idle before interacting with the fishing spot again --> getMessages? Thanks! while (getDialogues().isPendingContinuation() || getDialogues().isPendingOption()) { getDialogues().clickContinue(); getDialogues().completeDialogue("Option you want to click if there are more options", "another options to click", "another option..."); } If you want to just click continue (e.g. you don't have to choose an option while talking to a NPC), and you are expecting only "Click here to continue" then: while (getDialogues().isPendingContinuation()) { if (getDialogues().clickContinue()) { //click fishing spot again } } Put above code somewhere where you are using sleep condition while your player is fishing (e.g. after/before checking your player.isAnimating() method) For bank depositing just use getBank.deposit methods. I believe widgets are used in banking methods like deposit, withdraw, etc, but you don't need to worry about that. Just use OSBot banking API, and you should be fine (unless you need something really special that's not covered in API). Edited March 21, 2019 by Xx pk xX Quote Link to comment Share on other sites More sharing options...