Hello. First I want to say that im not any lua master or something and I am sorry for what you are about to see :P this is more of an idea that some1 who can code well could improve, but I found it working preety well like it is now and maybe it can help some people
Many people got problem with standard reconnecter and the main point of persistents here is to ensure that char will succesfully relog after masskick. I can't guarantee it will work 100% of time but it should be more reliable than the usual reconnect, USING IT WITH NOPING WILL CRASH THE CLIENT AND CAUSE BIG CPU AND RAM USSAGE
whole script contain 2 persistents that need to run at the same time, I hope it will help you guys
init start
local ConnectionIdletime = 4500
local FullRelog = true -- true/false , enter the passwords on relog
local HidePopup = true -- true/false , hide pop-up window msg
local WindowStucktime = 500
local ReconnectLifetime = 5000
local Windows = {'Error','Connection failed','Warning'} -- if windbot doesn't close the window, add it here
init end
auto(500)
::CloseConnection::
if $idlerecvtime >= ConnectionIdletime and $connectionstate == 11 and $worldvisible then
if FullRelog then
xlog(HidePopup)
pauseinput(10)
for i = 1,3 do
keyevent(0x1B)
wait(10)
end
else
xlog(HidePopup)
pauseinput(10)
end
end
::CloseWindows::
if $openmenutime > WindowStucktime then
for i = 1,#Windows do
if $openmenuname == Windows[i] then
keyevent(0x0D) -- ENTER
keyevent(0x20) -- SPACE
keyevent(0x1B) -- ESC
wait(100)
end
end
end
::Reconnect::
if not $connected then
if $connectionstate ~= 11 then
reconnect($worldvisible)
if $connected then
if windowcount() ~= 0 then
closewindows()
wait(150,335)
end
end
end
end
init start
local Priority = 82
local OverridePriority = 83
local Expiretime = 5000
local Lifetime = 5000
local Urgent = 1
local Stucktime = 3000
init end
auto(100)
::KillEvent::
if $connectionstate ~= 0 and $connectionstate ~= 11 then
local storedtime = $timems
wait(100)
while $connectionstate ~= 11 and $cureventtype == 16 do
if $timems-storedtime < Stucktime then
wait(100)
else
if $cureventtype == 16 and $connectionstate ~= 11 then
setpriority(Priority,OverridePriority,Expiretime,Lifetime,Urgent)
terminateevent($cureventid)
for i = 1,2 do
keyevent(0x1B) -- ESC
end
goto KillEvent
end
end
end
end