Jump to content

Items in bank


Jammer

Recommended Posts

I'm making a task based script which includes buying gear from grand exchange. I have one task for banking and one for buying.

The buytask should execute when the required arrmor is not in my Inventory, bank or equiped. When the bank is open it works fine and it goes to GE. However when the bank isn't open and I already have the required items in the bank it still thinks it should buy things. I assume this is due to it not knowing what's in the bank when the bank isn't open.

 

It basically boils down to this: Is it possible to store the items in the bank in an arraylist and update it every time i withdraw or deposit something or are there better ways of implementing buying?

 

 

 

Link to comment
Share on other sites

4 minutes ago, Jammer said:

I'm making a task based script which includes buying gear from grand exchange. I have one task for banking and one for buying.

The buytask should execute when the required arrmor is not in my Inventory, bank or equiped. When the bank is open it works fine and it goes to GE. However when the bank isn't open and I already have the required items in the bank it still thinks it should buy things. I assume this is due to it not knowing what's in the bank when the bank isn't open.

 

It basically boils down to this: Is it possible to store the items in the bank in an arraylist and update it every time i withdraw or deposit something or are there better ways of implementing buying?

 

 

 

 

Why don't you just check if the player already has the items in their inventory / equipment?

If they don't then check the bank

If they still don't then go to GE.

 

Sounds like the structure of your code is borked ("Task" pattern sucks)

  • Like 2
Link to comment
Share on other sites

2 minutes ago, Explv said:

 

Why don't you just check if the player already has the items in their inventory / equipment?

If they don't then check the bank

If they still don't then go to GE.

 

Sounds like the structure of your code is borked ("Task" pattern sucks)

Wow, I can't believe I didn't think of that.

Yeah, task based was actually messier than I anticipated but it might just have to do with my lack of skills. 

After I finish this script I'm gonna have a look at your tutorial island script and try to use that kind of framework.

Link to comment
Share on other sites

24 minutes ago, Jammer said:

It basically boils down to this: Is it possible to store the items in the bank in an arraylist and update it every time i withdraw or deposit something or are there better ways of implementing buying

 

12 minutes ago, HeyImJamie said:

Bank Caches :boge: 

Yea pretty much anytime you close the bank, update arraylist of items in the bank before you close (or finished with bank).

That way you don't need to go and check every time.

Make sure the items are updated before you check them tho, so like depending on where you start your script, the bank cache might not be initialized.  

  • Like 1
Link to comment
Share on other sites

I'd personally use a HashMap or something similar rather than an arraylist so you can store the string/item and the amount rather than just one or the other. I'd put an initialisation check in regards to size and save it if it's not been saved, eg if size is 0 - load the cache, else set the cache everytime you open bank or w/e

Edited by HeyImJamie
  • Like 1
Link to comment
Share on other sites

11 minutes ago, HeyImJamie said:

I'd personally use a HashMap or something similar rather than an arraylist so you can store the string/item and the amount rather than just one or the other. I'd put an initialisation check in regards to size and save it if it's not been saved, eg if size is 0 - load the cache, else set the cache everytime you open bank or w/e

Well, he's looking for equipment. So in this case, the list contains it or not, the quantity is implied. 

Link to comment
Share on other sites

21 minutes ago, dreameo said:

 

Yea pretty much anytime you close the bank, update arraylist of items in the bank before you close (or finished with bank).

That way you don't need to go and check every time.

Make sure the items are updated before you check them tho, so like depending on where you start your script, the bank cache might not be initialized.  

 

16 minutes ago, HeyImJamie said:

I'd personally use a HashMap or something similar rather than an arraylist so you can store the string/item and the amount rather than just one or the other. I'd put an initialisation check in regards to size and save it if it's not been saved, eg if size is 0 - load the cache, else set the cache everytime you open bank or w/e

 

Except he doesn't need to cache anything..

The structure of his code is the problem.

Link to comment
Share on other sites

2 minutes ago, Explv said:

Except he doesn't need to cache anything..

The structure of his code is the problem.

Your suggesting to just check in this order: equipment --> bank --> go buy from ge

Caching it would just eliminate the step of having to check the bank since you'd already know what you don't have. 

Link to comment
Share on other sites

Just now, dreameo said:

Your suggesting to just check in this order: equipment --> bank --> go buy from ge

Caching it would just eliminate the step of having to check the bank since you'd already know what you don't have. 

That depends on whether he plans on losing his equipment during the script.

If he only needs to check once, why cache?

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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

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