Everything posted by zorxon
-
Is there a better way to use keyboard.typeString?
Okay, I should improve my search skills Thanks mate!
-
Is there a better way to use keyboard.typeString?
Hi guys, I'm currently in the state where the general code for my script is done and now I need to work out the bugs and optimize it a bit. In my script I'm using keyboard.typeString to send text to the chatbox but I noticed that it can take a while before a long sentence is fully typed out. Is there a better/faster way for this?
-
Why does acceptTrade not work?
Haven't thought of that. Will try to get that working. Thank you
-
Why does acceptTrade not work?
The trade gets declined. Other than the timer it is basically what I have now. I've set the timer to 10 just for testing purposes. I'm asking why acceptTrade is not working. When I put 10 coins in the trade and do not accept, the trade gets declined, but when I put 10 coins in the trade and accept, it will not accept and instead be stuck in an enless loop.
-
Why does acceptTrade not work?
It listens if the other player accepted but never accepts the trade. What's the problem? @Override public int onLoop() throws InterruptedException { if (trade.isFirstInterfaceOpen()) { new ConditionalSleep(10000) { @Override public boolean condition() { return trade.getTheirOffers().getAmount("Coins") >= 10; } }.sleep(); log("slept untill coins are more than 10"); if (trade.getTheirOffers().getAmount("Coins") < 10) { log("checking coins if less than 10"); trade.declineTrade(); } else { new ConditionalSleep(10000) { @Override public boolean condition() { return trade.didOtherAcceptTrade(); } }.sleep(); log("checked if other player accepts"); if (!trade.didOtherAcceptTrade()) { trade.declineTrade(); } else { trade.acceptTrade(); } } } return random(700, 900); }
-
Who can fix my code?
Hello guys. Been working hard on an automatic trading script and after alot of figgeling I'm currently hitting a wall. The idea of the code below is that I want to check what a player is offering, and specifically if he's offering coins. This can be the only thing he's allowed to offer and has to be over a certain value. What I tried to do is wait until the player is offering coins by using a conditional sleep. The first problem is that if the condition is false, it will exit the loop and start over again while it actually needs to decline the trade after nothing has happened for X amount of seconds. Second problem is that I need to check the amount of coins and if it is more than 9. In the current code it will first check for coins and only then it will check for value (which probably isn't properly executes and have no idea how to). So their offer should be placed twice in order for it to register and the code needs to be able to do it on the first check. Here my code: public int onLoop() throws InterruptedException { if (trade.isFirstInterfaceOpen()) { if (!trade.getTheirOffers().contains("Coins")) { new ConditionalSleep(10000) { @Override public boolean condition() { return trade.getTheirOffers().contains("Coins"); } }.sleep(); Item item = trade.getTheirOffers().getItem("Coins"); int amountcoins = item.getAmount(); log(amountcoins); } else { } if (trade.getTheirOffers().contains("Coins") && amountcoins > 9) { new ConditionalSleep(10000) { public boolean condition() { return trade.didOtherAcceptTrade(); } }.sleep(); if (trade.didOtherAcceptTrade()) { trade.acceptTrade(); } else { trade.declineTrade(); } } As always, help will be much appreciated!
-
Need help with TradeListener and random execution of code
Ok so I'm trying to accept an incoming trade now and the closest thing I can find is getTrade().acceptTrade(); but don't think that's quite it. Code atm: public void onMessage(Message message) { if (message.getMessage().contains("wishes to trade with you.")) { getTrade().acceptTrade(); } } Though about getting the players name with message.getUserName(); and then interacting with that player using "trade" but in the API I can't find a way to do this.
-
Need help with TradeListener and random execution of code
Hey guys, back with another question. I was messing around with my script and trying to get listen in the chat for incoming trades. I've tried the following code and I'm obviously using it wrong: if (trade.getRequestListener() == null) { keyboard.typeString("Test"); } Also I want to type in the chat at random times. I know I need keyboard.typeString("");, but how do I make it random? Same with random execution of code. I need to have a method that contains a few items, and randomly selects one of those items. Any help will be much appreciated!
-
Beginner in RS scripting, Need some help
This was indeed the problem, thanks alot! I didn't make any adjustments to your code and saved it as the same name as my previous script (the one with the attack potions). I think that it didn't transferr the new code at all since I just saved it as a new script and it executes your code correctly. Still weird though. Anyway thanks, learned a bunch!
-
Beginner in RS scripting, Need some help
Mostly just for testing. I've tried your code but weird things are happening with the OSbot client and I'm not sure where the problem lies. For starters, new scripts that I put in the scripts folder don't show up in the client script selector anymore. There is just one local script I made and I have to overwrite it every time I make a new script or need to test something. Furthermore, I tried to paste your code into a new project and then save it as the previous script I made which actually works in-game. Only thing is it actually takes out the potions instead of the items that you've defined in your script. Why does this happen?
-
Beginner in RS scripting, Need some help
Hello all, I have integrated the things above into my script but unfortunately I'm unable to test if these recommendations work. Im currently hitting the following problems with these pieces of code: @Override public int onLoop() throws InterruptedException { if (inventory.isEmpty()) { if (bank.isOpen()) { bank.withdraw(2428, 14); bank.withdraw(229, 14); bank.close(); } else { bank.open(); } } else { if (bank.isOpen()) { if (getInventory().onlyContains(123)) { bank.depositAll(); } else { bank.close(); getInventory().getItem("Vial").interact("Use"); getInventory().getItem("Attack potion(4)").interact("Use"); } } else { if (getInventory().onlyContains(123)) { bank.open(); } else { getInventory().getItem("Vial").interact("Use"); getInventory().getItem("Attack potion(4)").interact("Use"); } } } return random(200, 300); } What I'm trying to do with the code above: Get 14 potions and 14 vials from the bank, devide them, put the results back in the bank. What happens is that it opens the bank, withdraw 14 of each item, closes the bank and then it does nothing. What am I doing wrong? Then I tried to adjust this code to the tutorial code on the forums: private enum State { DEVIDE_OUTSIDE, DEVIDE_INSIDE, BANK_POTS_INSIDE, BANK_POTS_OUTSIDE, GET_POTS_OUTSIDE, GET_POTS_INSIDE, WAIT }; private State getState() { if (!inventory.isEmpty() && !bank.isOpen() && !getInventory().onlyContains(123)) return State.DEVIDE_OUTSIDE; if (!inventory.isEmpty() && bank.isOpen() && !getInventory().onlyContains(123)) return State.DEVIDE_INSIDE; if (!inventory.isEmpty() && bank.isOpen() && getInventory().onlyContains(123)) return State.BANK_POTS_INSIDE; if (!inventory.isEmpty() && !bank.isOpen() && getInventory().onlyContains(123)) return State.BANK_POTS_OUTSIDE; if (inventory.isEmpty() && !bank.isOpen()) return State.GET_POTS_OUTSIDE; if (inventory.isEmpty() && bank.isOpen()) return State.GET_POTS_INSIDE; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case DEVIDE_OUTSIDE: getInventory().getItem("Vial").interact("Use"); getInventory().getItem("Attack potion(4)").interact("Use"); break; case DEVIDE_INSIDE: bank.close(); getInventory().getItem("Vial").interact("Use"); getInventory().getItem("Attack potion(4)").interact("Use"); break; case BANK_POTS_OUTSIDE: bank.open(); bank.depositAll(); break; case BANK_POTS_INSIDE: bank.depositAll(); break; case GET_POTS_OUTSIDE: bank.open(); bank.withdraw(2428, 14); bank.withdraw(229, 14); bank.close(); break; case GET_POTS_INSIDE: bank.withdraw(2428, 14); bank.withdraw(229, 14); bank.close(); break; case WAIT: sleep(random(500, 700)); break; } return random(2000, 3000); } Now it only withdraw 14 attack potions and then it freezes the entire client and overloading my RAM memory. Would love to hear some opinions.
-
Beginner in RS scripting, Need some help
Thanks for all the responds, I think I will be able to make it work now. Will test all this good stuff out as soon as I get home!
-
Beginner in RS scripting, Need some help
Hi all, I've discovered OSbot recently and was intrigued about how these bots come together. So I started watching java programming videos and eventually came across a great tutorial here on the forums. I'm still having difficulties with the API so that's why I came to you guys. If anyone would like to help me out with the following questions, that would be amazing! Here it goes: if (bank.isOpen()) { if (all item_IDs in inventory are the same) { bank.depositAll(); } else { bank.close(); } Is there a way to check if all item id's in the inventory are the same, or all the items for that matter, and how would I go about doing this? Also, I have 14 of X item and 14 of Y item in my inventory. I need to select item X and put it on item Y. How would I make this happen? I would love to hear your feedback!
-
👑 Perfect Czar Free Trials & Demos 👑 MOST POPULAR 👑 HIGHEST QUALITY 👑 MOST TOTAL USERS 👑 LOWEST BAN-RATES 👑 24/7 SUPPORT 👑 SINCE 2015 👑 MANY SKILLS 👑 MOST VIEWS 👑 MOST REPLIES 👑
Hi Czar, I would like to try out perfect motherload and perfect fisher if possible. Thanks in advance!