Johnxtrem Posted June 9, 2017 Posted June 9, 2017 (edited) Hey, I made a post about this before, but here's another question. When I run 4-8 clients on one pc, scripts (generally) behave correctly. I tested then 35 clients on a pc and scripts start being stuck, etc. To see what's up, I did a little test and noticed that the usual response time of methods is greatly increased, example: 1. Trade player 2. sleep 200ms. 2. loop -> log trade.isCurrentlyTrading(); => FALSE 3. After 1.8 secs => TRUE. This applies to almost all methods. So my question again is, how do you handle such inconsistency except by adding longer sleeps? P.S. I use conditional sleeps, but that can't be applied everywhere. Thanks! Edited June 9, 2017 by Johnxtrem
Charlotte Posted June 9, 2017 Posted June 9, 2017 1. If you think your scripts are starting to get stuck somewhere, since it's a private script, you can add longer sleeps to fit your needs. That's where trial and error comes into play for making a possibly flawless scripts. 2. Especially for mule trades, it's advisable to make use of conditional sleeps. 3. If you lag is an issue, just add a longer sleep time, i don't see any harm to it. It's better than a stucked script.
d0zza Posted June 10, 2017 Posted June 10, 2017 You can definitely use conditional sleeps here. if (trade.isCurrentlyTrading()) { //do trade stuff } else { if (trade player) {//if we successfully try to trade with the player new ConditionalSleep(10000) {//sleep for 10 seconds or until condition is met @Override public boolean condition() throws InterruptedException { return trade.isCurrentlyTrading(); } } } } 2
Alek Posted June 10, 2017 Posted June 10, 2017 As d0zza stated, conditional sleeps, conditional loops, checking the results of those sleeps and loops, checking the results of actions, etc. 1