Insert in bot.lua line 27 after '__RPL = nil; -- Return Point List'
Code: Select all
__RPL = nil; -- Return Point List
hf_bot_start = os.time(); -- start time of the bot
Code: Select all
end
player:logout_check(); -- automatic logout check <<< INSTERT THAT LINE
end
end
startMacro(main);
Code: Select all
<hotkey description="LOGOUT" key="VK_C" modifier="" />
Code: Select all
/script Logout();
Assign that macro to your before defined logout key.
Insert the new function 'function CPlayer:logout_check(hf_logout)' in player.lua:
Code: Select all
-- function for automatic logout checking
-- you can also use it with logout_check(true) for logout whitout timer
function CPlayer:logout_check(hf_logout)
if( settings.profile.options.LOGOUT_TIME == nil ) then settings.profile.options.LOGOUT_TIME = 0; end;
if( settings.profile.options.LOGOUT_SHUTDOWN == nil ) then settings.profile.options.LOGOUT_SHUTDOWN = false; end;
if( self.Battling == true or - -- no logout if aggro
settings.profile.options.LOGOUT_TIME == 0 ) then -- no logout if timer = 0
return; -- go back
end;
if( (os.difftime(os.time(), hf_bot_start)/60) > settings.profile.options.LOGOUT_TIME ) then
hf_logout = true;
end;
if( hf_logout == true ) then
printf("automatic logout after %s min playtime\n", (os.difftime(os.time(), hf_bot_start)/60) );
keyboardPress(settings.hotkeys.LOGOUT.key);
yrest(12000);
if( settings.profile.options.LOGOUT_SHUTDOWN == true ) then
printf("automatic shutdown in 30 sec\n" );
os.execute("\"%windir%\\system32\\shutdown.exe -s -t 30\" "); -- shutdown after 30 sec
end;
stopPE();
end;
end
Code: Select all
<option name="LOGOUT_TIME" value="120" />
<option name="LOGOUT_SHUTDOWN" value="true" />
EDIT: add an option for shutdown.