Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to make a String[] List..?

Featured Replies

So what I want to do is I have a GUI made up that and the user can choose to loot 6 different items. So, if they want to loot items 1-4 they choose those items, but how would I generate a list in String format so the getItems.closest(lootItem); can read it.. I currently am using an ArrayList to get a list of items but the method can't read it unsure.png

If you make a jlist fast it with an object type, allow multiple selection, you could get an array of selected indexes or object you're if you casted it

  • Author

String[] arrayLoot = list.toArray(new String[list.size()]);

I have this but it still won't pick up any loot at all..

If you make a jlist fast it with an object type, allow multiple selection, you could get an array of selected indexes or object you're if you casted it

I have made my own GUI (interactable paint) so can I still use this mehthod?

I have this but it still won't pick up any loot at all..

I have made my own GUI (interactable paint) so can I still use this mehthod?

Then there's another issue besides creating the array. Most likely you haven't configured the GUI correctly to configure the users loot selections.
  • Author

Then there's another issue besides creating the array. Most likely you haven't configured the GUI correctly to configure the users loot selections.

 

This is what I've got:

 

Var:

ArrayList<String> itemLoot = new ArrayList<String>();

String[] lootItem = new String[itemLoot.size()];

 

Method:

GroundItem loot = groundItems.closest(lootItem);

 

GUI:

 if(law) {

                    g.drawImage(img5, 48, 201, null);

                        String l1 = "Law rune";

                        itemLoot.add(l1);

                    } if(death) {

                        g.drawImage(img5, 48, 221, null);

                        String l2 = "Death rune";

                        itemLoot.add(l2);

                    } if(nature) {

                        g.drawImage(img5, 48, 242, null);

                        String l3 = "Nature rune";

                        itemLoot.add(l3);

                    } if(chaos) {

                        g.drawImage(img5, 48, 262, null);

                        String l4 = "Chaos rune";

                        itemLoot.add(l4);

                    } if(bones){

                        g.drawImage(img5, 48, 281, null);

                        String l5 = "Big bones";

                        itemLoot.add(l5);

                    }

 

This is what I've got:

 

Var:

ArrayList<String> itemLoot = new ArrayList<String>();

String[] lootItem = new String[itemLoot.size()];

 

Method:

GroundItem loot = groundItems.closest(lootItem);

 

GUI:

 if(law) {

                    g.drawImage(img5, 48, 201, null);

                        String l1 = "Law rune";

                        itemLoot.add(l1);

                    } if(death) {

                        g.drawImage(img5, 48, 221, null);

                        String l2 = "Death rune";

                        itemLoot.add(l2);

                    } if(nature) {

                        g.drawImage(img5, 48, 242, null);

                        String l3 = "Nature rune";

                        itemLoot.add(l3);

                    } if(chaos) {

                        g.drawImage(img5, 48, 262, null);

                        String l4 = "Chaos rune";

                        itemLoot.add(l4);

                    } if(bones){

                        g.drawImage(img5, 48, 281, null);

                        String l5 = "Big bones";

                        itemLoot.add(l5);

                    }

 

alright is there anything wrong with it? seems good

This is what I've got:

 

Var:

ArrayList<String> itemLoot = new ArrayList<String>();

String[] lootItem = new String[itemLoot.size()];

 

Method:

GroundItem loot = groundItems.closest(lootItem);

 

GUI:

 if(law) {

                    g.drawImage(img5, 48, 201, null);

                        String l1 = "Law rune";

                        itemLoot.add(l1);

                    } if(death) {

                        g.drawImage(img5, 48, 221, null);

                        String l2 = "Death rune";

                        itemLoot.add(l2);

                    } if(nature) {

                        g.drawImage(img5, 48, 242, null);

                        String l3 = "Nature rune";

                        itemLoot.add(l3);

                    } if(chaos) {

                        g.drawImage(img5, 48, 262, null);

                        String l4 = "Chaos rune";

                        itemLoot.add(l4);

                    } if(bones){

                        g.drawImage(img5, 48, 281, null);

                        String l5 = "Big bones";

                        itemLoot.add(l5);

                    }

 

Things not pertaining to your question:

  1. Program to the interface (ArrayList -> List)
  2. Your variable naming is terrible plus they're singular when they're representing a multitude of items
  3. Those if statements are disgusting and impossible to maintain. Create an enum of whatever your checking for (loot, runes, idk), assign the constants their corresponding properties, iterate over all the enum values in a clean for-each loop and execute your handler code

On topic:

Log whether your ground item instance is null, make sure the item name is correct, confirm whatever code your using to interact with the item is being executed, etc. There are lots of factors at play here that you're not telling us about.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.