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


Recommended Posts

Posted (edited)

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
Posted
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? 

Posted
Just now, 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? 

learn java first please

  • Like 1
Posted
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
Posted
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

Posted
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.

Posted (edited)
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
Posted
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? :)

 

Posted
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

 

Posted
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!

Posted (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 by Xx pk xX

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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