Jump to content

saintpaul1

Members
  • Posts

    36
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by saintpaul1

  1. Ah okay yeah your right. i got it working now perfect, heres the code if anyone needs : if (getBank().isOpen()) { RS2Widget depositLootingBag = getWidgets().getWidgetContainingAction("View"); RS2Widget bagEmpty = getWidgets().getWidgetContainingText("The bag is empty."); RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot"); RS2Widget dismiss = getWidgets().getWidgetContainingAction("Dismiss"); if (depositLootingBag != null) { log("Deposit looting bag is not null"); depositLootingBag.interact(); } if (depositLootingBag == null) { log("Deposit looting bag is null"); } if (depositLootButton !=null && bagEmpty ==null) { log("Pressing deposit loot button"); depositLootButton.interact("Deposit loot"); } if (bagEmpty !=null) { log("Bag empty message onscreen"); dismiss.interact(); }
  2. Thanks gunman, this is what it logs : [INFO][Bot #1][04/22 11:00:45 PM]: RootId: 15 [INFO][Bot #1][04/22 11:00:45 PM]: ChildId: 8 [INFO][Bot #1][04/22 11:00:45 PM]: GrandChildId: -1 So i guess i should include -1? Also i got it to run by using .isvisible instead of nullchecking, i got a null exception error but it ran still, but id rather do it properly. This is my code now : RS2Widget depositLootingBag = getWidgets().get(15, 2, 0); RS2Widget bagEmpty = getWidgets().getWidgetContainingText("The bag is empty."); RS2Widget depositLootButton = getWidgets().get(15, 8 , -1); RS2Widget dismiss = getWidgets().getWidgetContainingAction("Dismiss"); if (getBank().isOpen()) { Item lootingBag = getInventory().getItem("Looting bag"); if (depositLootingBag != null) { log("Lets deposit looting bag items."); lootingBag.interact("View"); Util.Sleep.sleepUntil(() -> depositLootButton !=null, 10000); if (depositLootButton !=null) { log("Item in bag to deposit."); depositLootButton.interact("Deposit loot"); Util.Sleep.sleepUntil(() -> bagEmpty !=null, 5000); if (bagEmpty !=null) { log("Clicking dismiss."); dismiss.interact("Dismiss"); } } return 100; } }
  3. Trying to click "Deposit loot" in the looting bag. I have tried the following combinations: RS2Widget depositLootButton = getWidgets().get(15, 8); RS2Widget depositLootButton = getWidgets().get(15, 9); RS2Widget depositLootButton = getWidgets().get(548, 77); RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot"); depositLootButton.interact("Deposit loot"); depositLootButton.interact(); What am i doing wrong? first time using widgets. i assume the widget code is 15,8 because the text is green and the widget i want to click is highlighted in green, but i have tried all other combinations aswell. EDIT: i managed to get it to click it using RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot"); RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot"); But only if i didnt check if it was null first, and it threw a null exception error but it still clicked it. So i dont know what to do, if i only click it if its not null it wont click it.
  4. Mine is set to 12. GroundItem itemToPickUp = main.getGroundItems().closest(groundItem -> dt.itemsToPickUp.contains(groundItem.getName()) && groundItem.getPosition().distance(main.myPosition()) <= 12); This is what im using currently to loot items : InteractionEvent lootingEvent = new InteractionEvent(itemToPickUp, "Take"); lootingEvent.setWalkTo(true); lootingEvent.setOperateCamera(false); lootingEvent.setMaximumAttempts(1); if (main.execute(lootingEvent).hasFinished()) { Util.Sleep.sleepUntil(() -> !itemToPickUp.exists(), 1000);//Interact "Take" on item } Tried lots of different variations though. EDIT: i fixed it i tested the script in a new project and it was somehting else in my code causing the issue , as always :L Thanks for reply.
  5. Lets say my player is killing npcs, it kills one but attacks another one adn the loot from the first one drops on the ground, but the loot is off screen because my player has moved because its attacking another npc. My player will only attack other npcs if loot !=null so my player wont do anything unless i turn the screen to see the loot. I have tried to turn the camera to the loot, walk to the loot and nothing, its like it doesnt know it exists but it does know because my player wont attack another npc unless its picked up. Ive tried with and without interaction event, same issue. Thanks in advance if anyone can guide me in the right direction, peace
  6. The npc is turning up null for some reason, can u look at this pls ? It doesnt turn up as null when im fighting it without using interactionevent. edit: my bad i wasnt calling my task fml
  7. Thanks iv never done that ill read up on the api
  8. Basically what the title says, npc will be behind me for example, it will turn the camera towards the npc and also run towards it then attack it instead of just attacking it. The npc is nearby, just a few tiles. Anyone have a solution for this edit: i think what it is doing is turning the screen and attacking a the same time and misclicking because its moving the camera so it runs all over the plcae lmao.
  9. Thanks might come in useful! Not going to use webwalker though gonna use pathwalk
  10. Just wondering if anyone has anything that i can take some inspiration from for the anti pk portion of my script.
×
×
  • Create New...