Jump to content

Handling lag?


Johnxtrem

Recommended Posts

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 by Johnxtrem
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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();
			}
		}
	}
}

 

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...