Jump to content

Getting Equipment/Inventory


Neanel

Recommended Posts

Hey there,

I was wondering what the best method was for grabbing gear from the bank & equipping it + filling the inventory with the necessary items.
How would you ignore items that are already in the equipment/inventory, or deposit the items that aren't part of the necessary inventory/equipment?
I've found multiple solutions but they all seem a bit overly difficult for something like this.

Let me know what you think & thanks in advance,

Neanel

Link to comment
Share on other sites

Umm I am not gonna spoon feed it all to you but try this building the logic of the codes with the steps it would take to make this happen. Example.
If I was going to check if I had a iron scim equipped for a basic suicide combat script for like 10/10/10 melee stats.
1. Check if the iron scim is equipped. If so go to location and kill for 10/10/10
2. if not equip. equip it. (For some reason I feel I am spelling it equip wrong after looking at it so much...)
3. if not in inventory walk to nearest bank.
4.open bank. withdraw item. Then equip.Then walk and slay for 10/10/10 (and if not in the bank then logout)

If you were asking for the api commands since I know the api list thing isn't very friendly to beginners.

Remove the **** and insert what it tells you to and what you need.

getEquipment().isWearingItem(EquipmentSlot.****the slot Weapon or Legs*****)

getInventory().contains(****Item you wish. can use "" and put item name in between or the item id*****)

getInventory().getItem(****same as contains****).interact(*****action like "Wear" or "Wield" also used for "Use" when using an item on something)

// You will be using a lot of of differnt getBank() variations like getBank().open and getBank().contains() also don't forget to check to see if the item exists before withrdrawing it (getBank().Withdraw is the start pick which one you want).

Hope this helped but I am not gonna give you the fully coded method for doing this. 1 I am lazy  2 probably better not to so it can help you learn

Also I think you are over thinking it just deposit inventory and all equipment if it's not empty Or if a certain about of inventory slots isn't open. Then check for items and withdraw them and equip them if needed.

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

  1. Figure out what you want. When the script starts, take note of what your stats are and create a list of items you can use and prioritise them by usefulness.
  2. Figure out what you need. You might not get what you want, but you'll get what you need. A dragon axe is better than an rune one, but if you don't have a dragon axe or if your woodcutting level isn't 61, then that rune axe is your best friend.

 

Once your bot knows what it's got, what it's not got, and where it's at, you can plan for the bot to progress. Depending on the complexity, you may need to look into using a data-structure. It'll be a lot less code than having 20+ IF's for each axe, pick axe, etc.

  • Like 1
  • Heart 1
Link to comment
Share on other sites

Both very helpful, thanks a lot!

I am a beginner in the whole OSBot API so I should probably start by going through that.

i was thinking of creating an array of Strings (or is Items better?) & then just using getBank.contains(item) in a for loop to withdraw, then another for-loop to interact with those items if they are equipment. Does that seem about right or am I forgetting something?

Link to comment
Share on other sites

7 hours ago, Gunman said:

Umm I am not gonna spoon feed it all to you
 

Then proceeds to spoon feed:feels:🐎
:???:             :???:                :???:

  • make a method to check if the bank isOpen() by using widgets
  • Check if Bank is closed and items are in getInventory()

You can use the API to find 


api.getInventory().contains("Iron Penis"))
api.getInventory().interact("Equip", "Iron Penis");

 

Edited by Elixar
  • Boge 1
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...