Jump to content

Canidae

Members
  • Posts

    38
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Canidae's Achievements

Bronze Poster

Bronze Poster (2/10)

8

Reputation

  1. You forgot to check if the interaction actually was succesful, this way you can trigger the sleep without actually having opened the pack.
  2. This might mess up when trying to pause the script. I would also write it like this: for (Item item : getInventory().getItems()) { if (item != null && item.getName().equals("Feather pack") && item.interact("Open")) { //sleep } }
  3. I would say it depends on the situation. In case of feather packs, I can imagine you don't want to wait a tick everytime you open one since opening them as quick as possible is what you essentially want. You would probably need different code to prevent trying to interact with a non-existent item.
  4. Outside of your question, this is not how you should go on and write this code. What you are trying is to do one method call which results in buying items, without any kind of looping. That's not going to work properly and even if it will, it's unreliable. You can do multiple things. Create an Event class and execute it as an event, let your script loop through it (by using a task system for example) or write a recursive method (not sure if that's a good idea though). This is an example with an event. When you want to buy items, you will create a new event, pass through the list of items and execute the buying. If you are done buying, you set the event to finished and the script will start looping again. (Not sure if this code works and if it's 100% correct, long time ago for me). public class Main extends Script { @Override public int onLoop() throws InterruptedException { if (shouldbuyItems()) { BuyItemsEvent event = new BuyItemsEvent(buyItemList); event.exchangeContext(getBot()); execute(event); } return 300; } } public class BuyItemsEvent extends Event { private List<BuyItem> items; public BuyItemsEvent(List<BuyItem> items) { this.items = items; } @Override public int execute() throws InterruptedException { if (!getGrandExchange().isOpen()) { openGE(); } else if (boughtItems()) { setFinished(); } else { buyItems(); } return 300; } public void openGE() { RS2Object geBooth = getObjects().closest("Grand Exchange booth"); NPC exchangeWorker = getNpcs().closest("Grand Exchange Clerk"); int random = new Random().nextInt(2); if (geBooth != null && random == 0) { if (geBooth.interact("Exchange")) { new ConditionalSleep(2500, 3000) { @Override public boolean condition() { return getGrandExchange().isOpen(); } }.sleep(); } } else if (exchangeWorker != null) { if (exchangeWorker.interact("Exchange")) { new ConditionalSleep(2500, 3000) { @Override public boolean condition() { return getGrandExchange().isOpen(); } }.sleep(); } } } } I also recommend using this class for conditional sleeps:
  5. That's not a repeater, it's a powerline adapter. It will send the connection through the power lines in your house. Your ping won't be affected that much.
  6. This is exactly like dad's advice, which is useless obviously.
  7. If you looking for an alternative, take a look at Vultr. It basically offers the same service as DigitalOcean, but cheaper.
  8. So to make things clear, you fucked up. Shit happens and you probably forgot about it, or even worse did it intentional. Don't try to make things worse by trying to prevent them from finding you. Contact them through e-mail or give them a call and explain what happened. Don't try to run from it, they will eventually find you anyways and you don't want to battle things like this out in court. (Or however that goes in US). Just at least make sure you don't fuck up like this again and learn from it. A company like that is probably to not going to condone $500 just because you are whatever years old. If you need any help, send me a PM. I have (accidentally) fucked up some stuff in the past as well when I was young.
  9. An integer can never be null. The best way is to just do getInventory().getAmount().
  10. Since widget IDs tend to change, you should use something different instead. For example text color, position or something else.
  11. I can make you one for $150 using 2Captcha, source included of course.
  12. Exactly. You are first using methods on an object and are then nullchecking it for example.
  13. What do you mean with global variables then? They don't exist in Java and you also said your meaning of global variables aren't (public) static variables. What is it then? The only thing you can do in Java is having public classes with a public static variable in it to make it look like it's some sort of global variable.
×
×
  • Create New...