而朱熹机器人采取了另外一种方式,看上去更复杂一点,但貌似也有bug。
function login()
{
var player=world.getVariable("player"),passwd=world.getVariable("passwd");
world.DeleteTemporaryTimers();
world.DoAfterSpeedWalk (10,"("+player+") ("+passwd+") (yes)");
}
function check_login()
{
var t=new Date(),k=parseInt(world.getVariable("k")),time,m,s;
time=parseInt((t.valueOf()-parseInt(world.getVariable("time")))/1000);
m=parseInt(time/60);
s=time-m*60;
if(world.IsConnected()==0)
{
if(m>1) ti();
world.Connect();
}
else if(m>1)
{
ti();
world.Disconnect();
}
} |