Jump to content

Stinji

Members
  • Posts

    5
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Stinji

  1. This works! Thanks @HeyImJamie and @Eagle Scripts!
  2. Something like this? @Override public void onMessage(Message m) throws InterruptedException { if (m.getMessage().contains("The shop has run out of stock.")) { outOfStock = true; } } ... if (outOfStock.equals(true)) { insert hop here; outOfStock = false; //to reset the boolean }
  3. Hey guys, I'm writing a bot that buys items from a shop and banks them when inventory is full. The thing is that the restock rate is pretty fast and the bot will repeatedly buy items until the inventory is full (the line that says hop worlds when getAmount() == 0; doesn't even get activated because of how fast it is). That's why I decided to hop worlds whenever the message "The shop has run out of stock." appears. My code looks like this: public void onMessage(Message m) throws InterruptedException { if (m.getMessage().contains("The shop has run out of stock.")) { log("Shop ran out of stock, hopping worlds"); currentWorld = getWorlds().getCurrentWorld(); getWorlds().hopToP2PWorld(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getWorlds().getCurrentWorld() != currentWorld && getWorlds().isOpen(); } }.sleep(); } } However, it doesn't get overridden long enough for all of the code to be executed. I know this because I tested the following code: public void onMessage(Message m) throws InterruptedException { if (m.getMessage().contains("The shop has run out of stock.")) { sleep(10000); } } The logger gives an error message after about 5 seconds, so I'm thinking the onMessage doesn't store the message until the end of the code. Is there a way to change the length it stores the value or is there another way of achieving the same result? Thanks guys! PS. Can anyone please let me know if the 'currentWorld' line is necessary. In other words: will the hopToP2PWorld() recognize the current world and consider not hopping to this world on its own?
  4. Hey guys, I'm writing a bot that buys out a shop and banks the inventory when full. When the inventory is not full and the shop is empty I want the bot to hop worlds, however it's not working as it should (I think).  I've tried the following options: getWorlds().hopToP2PWorld(); getWorlds().hopToF2PWorld(); getWorlds().hop(example); However whenever it's supposed to execute this code, all three just open the worlds interface and stops there. I'm using OSBot stealth mode, tried adding a conditional sleep, tried singling out this code to see if it was because other code was interfering but none of these worked. It's the exact same issue as this guy had, but his solution doesn't work for me: Worth noting maybe is that I have a GUI that starts at the beginning of the script (and I didn't comment this code out for a test) to ask which item I would like to buy, but it doesn't repeat in the onLoop() so once you chose an item, it could not possibly interfere with other code. Thanks for your input! 
  5. Hey guys, I'm writing a bot that buys out a shop and banks the inventory when full. When the inventory is not full and the shop is empty I want the bot to hop worlds, however it's not working as it should (I think). I've tried the following options: getWorlds().hopToP2PWorld(); getWorlds().hopToF2PWorld(); getWorlds().hop(example); However whenever it's supposed to execute this code, all three just open the worlds interface and stops there. I'm using OSBot stealth mode, tried adding a conditional sleep, tried singling out this code to see if it was because other code was interfering but none of these worked. It's the exact same issue as this guy had, but his solution doesn't work for me: Worth noting maybe is that I have a GUI that starts at the beginning of the script (and I didn't comment this code out for a test) to ask which item I would like to buy, but it doesn't repeat in the onLoop() so once you chose an item, it could not possibly interfere with other code. Thanks for your input! SORRY, this is the wrong thread to post this in, I don't know how to remove this. I also posted this in 'Scripting Help'.
×
×
  • Create New...