maferosrs 2 Share Posted June 18, 2017 i Guys, I'm reading the API documentation, is there a method for picking up the floor items? What class do you belong to?Hi Guys, I'm reading the API documentation, is there a method for picking up the floor items? What class do you belon Link to comment Share on other sites More sharing options...
Nex 2542 Share Posted June 18, 2017 there's a ground item section Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted June 18, 2017 lOoK iNtO GrOuNdItEmS Link to comment Share on other sites More sharing options...
maferosrs 2 Author Share Posted June 18, 2017 ty ty ty this is correct ? public class Main extends AbstractScript { public GroundItem pickThisItems[] = {"Bones" , "Coins"}; @Override public int onLoop() { getGroundItems(pickThisItems); return 100; } } Link to comment Share on other sites More sharing options...
Nex 2542 Share Posted June 18, 2017 ty ty ty this is correct ? public class Main extends AbstractScript { public GroundItem pickThisItems[] = {"Bones" , "Coins"}; @Override public int onLoop() { getGroundItems(pickThisItems); return 100; } } no. Link to comment Share on other sites More sharing options...
Genius 49 Share Posted June 18, 2017 ty ty ty this is correct ? public class Main extends AbstractScript { public GroundItem pickThisItems[] = {"Bones" , "Coins"}; @Override public int onLoop() { getGroundItems(pickThisItems); return 100; } } Try this: public class Main extends AbstractScript { GroundItem coins = getGroundItems().closest(c -> c != null && c.getName().equals("Coins")); //this filter will look for ground items that are not null and have the name "Coins" @Override public int onLoop() { if (coins != null) coins.interact("Pick up"); //I'm not sure if that text is right, make sure the text matches the in-game text for hovering over a ground item. Also, you might want to make sure the coins are on-screen. return 100; } } Link to comment Share on other sites More sharing options...
maferosrs 2 Author Share Posted June 18, 2017 Try this: public class Main extends AbstractScript { GroundItem coins = getGroundItems().closest(c -> c != null && c.getName().equals("Coins")); //this filter will look for ground items that are not null and have the name "Coins" @Override public int onLoop() { if (coins != null) coins.interact("Pick up"); //I'm not sure if that text is right, make sure the text matches the in-game text for hovering over a ground item. Also, you might want to make sure the coins are on-screen. return 100; } } ty ty package Main; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.items.GroundItem; import java.awt.*; @SuppressWarnings("ALL") @ScriptManifest( author = "Mafer", name = "My First Script Pick", version = 1.0, description = "Pick Items", category = Category.MONEYMAKING) public class Main extends AbstractScript { int c1 = 0; GroundItem itemBones = getGroundItems().closest("Bones"); @Override public int onLoop() { if (itemBones.isOnScreen() && itemBones != null ){ itemBones.interact("Take"); c1++; } return 100; } @Override public void onPaint(Graphics g) { g.setFont(new Font("Arial", Font.PLAIN,14)); // Text In Screeen g.drawString("Bones Takes: " + c1, 20, 60); } } What about now? But does not start the script because? Link to comment Share on other sites More sharing options...
Soldtodie 76 Share Posted June 18, 2017 ty ty package Main; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.items.GroundItem; import java.awt.*; @SuppressWarnings("ALL") @ScriptManifest( author = "Mafer", name = "My First Script Pick", version = 1.0, description = "Pick Items", category = Category.MONEYMAKING) public class Main extends AbstractScript { int c1 = 0; GroundItem itemBones = getGroundItems().closest("Bones"); @Override public int onLoop() { if (itemBones.isOnScreen() && itemBones != null ){ itemBones.interact("Take"); c1++; } return 100; } @Override public void onPaint(Graphics g) { g.setFont(new Font("Arial", Font.PLAIN,14)); // Text In Screeen g.drawString("Bones Takes: " + c1, 20, 60); } } What about now? But does not start the script because? GroundItem itemBones = getGroundItems().closest("Bones"); Not possible. Use: GroundItem itemBones; @Override public int onLoop() { itemBones = getGroundItems().closest("Bones"); if (itemBones.isOnScreen() && itemBones != null ){ itemBones.interact("Take"); c1++; } return 100; } Link to comment Share on other sites More sharing options...
Hashtag 8691 Share Posted June 18, 2017 GroundItem itemBones = getGroundItems().closest("Bones"); Not possible. Use: GroundItem itemBones; @Override public int onLoop() { itemBones = getGroundItems().closest("Bones"); if (itemBones.isOnScreen() && itemBones != null ){ itemBones.interact("Take"); c1++; } return 100; } You should null check the item before checking if it's on the screen . Link to comment Share on other sites More sharing options...
Soldtodie 76 Share Posted June 18, 2017 You should null check the item before checking if it's on the screen . I didn't wrote this I just wrote the answer to the question. = But does not start the script because? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.