Simple little break system I'll be using on my divination script for OGL. Use if you want
Simba Code:
const
ONE_MINUTE:=60000;
MIN_BREAK:=5; //edit this to your preference
MAX_BREAK:=10; //edit this to your preference
Simba Code:
var
timeForBreakCd: tCountDown;
Simba Code:
function isExitOpen: boolean;
var
exitScreenTexture: glTextureArray;
begin //eoc, legacy
exitScreenTexture:=ogl.getTextures([163024, 163200], [5912096, 6181698]);
if not exitScreenTexture.isEmpty() then
exit(true);
end;
function logToLobby(): boolean;
begin
if not isExitOpen() then
repeat
typeByte(VK_ESCAPE);
wait(random(300, 750));
until isExitOpen();
if isExitOpen() then
begin
mouse.click('Exit');
wait(random(1500, 3000));
exit(true);
end;
end;
function loginFromLobby(): boolean;
var
lobbyIndicator, ingameIndicator, loginButton: glTextureArray;
begin
lobbyIndicator:=ogl.getTextures(51329);
loginButton:=ogl.getTextures([1331318], [8806430]);
ingameIndicator:=ogl.getTextures([237147], [66823]);
if not lobbyIndicator.isEmpty() then
begin
mouse.click(loginButton[0].randomizePointEllipse(7), 1);
wait(random(15000, 20000));
if not ingameIndicator.isEmpty() then
begin
writeln('Successfully logged in.');
breakTaken:=false;
mouse.scroll(point(ogl.getClientMidPoint.x+random(20, 100), ogl.getClientMidPoint.y+random(20, 100)), 'down');
end;
end else
writeln('Failure to login');
terminateScript;
end;
function takeBreak(): boolean;
var
breakTimer: integer;
begin
if not timeForBreakCd.isFinished() then
begin
exit(false);
end;
if timeForBreakCd.isFinished() then
begin
breakTimer:=random(ONE_MINUTE, ONE_MINUTE+25000)*random(MIN_BREAK, MAX_BREAK);
case random(50) of
0..25: wait(random(ONE_MINUTE*5, ONE_MINUTE*6));
26..50: logToLobby;
end;
breakTaken:=true;
writeln('Taking break for '+toStr(round(breakTimer/ONE_MINUTE)));
wait(breakTimer);
loginFromLobby;
timeForBreakCd.setTime(ONE_MINUTE*random(123, 190) + random(20*ONE_MINUTE, 30*ONE_MINUTE));
writeln('Time til next break : '+toStr(round(timeForBreakCd.timeRemaining()/ONE_MINUTE)));
end;
end;
Edit :
Forgot, in your start up (before repeat mainloop until false put
Simba Code:
timeForBreakCd.setTime(ONE_MINUTE*random(123, 190) + random(20*ONE_MINUTE, 30*ONE_MINUTE));
and to call the breaks, in your mainloop add