Jump to content

[Beginner] How to withdraw an item from bank based on the condition that a skill is equal or above or/and under a certain level? :)


t0r3
 Share

Recommended Posts

Hey! :D

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 by t0r3
Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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. :o

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? 

Link to comment
Share on other sites

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? :)

  • Boge 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

3 hours ago, t0r3 said:

    if (getSkills().getStatic(Skill.MINING) {

    getBank().withdraw("Steel pickaxe", 1);
}

This is as far as I get. :o

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 by byliuinyint
  • Heart 1
Link to comment
Share on other sites

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! :D

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? :)

 

Link to comment
Share on other sites

6 hours ago, t0r3 said:

Awsome thanks! :D

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

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 by Xx pk xX
Link to comment
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.

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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...