Results 1 to 4 of 4

Thread: OGL simple break system

  1. #1
    Join Date
    Jun 2014
    Posts
    463
    Mentioned
    27 Post(s)
    Quoted
    229 Post(s)

    Default OGL simple break system

    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
      breakTaken: boolean;

    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
    Simba Code:
    takeBreak;
    Last edited by Lucidity; 07-04-2015 at 04:31 PM. Reason: improvements
    Tsunami

  2. #2
    Join Date
    Jun 2012
    Posts
    586
    Mentioned
    112 Post(s)
    Quoted
    296 Post(s)

    Default

    If your script requires going to lobby or any loading while logging in or teleporting etc, sometimes minimap functions will fail due to an invalid floatpoint operation. I've fixed this and updated the Git. .

    Awesome job on the OGL snippets, mate!




    Skype: obscuritySRL@outlook.com

  3. #3
    Join Date
    Jun 2014
    Posts
    463
    Mentioned
    27 Post(s)
    Quoted
    229 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    If your script requires going to lobby or any loading while logging in or teleporting etc, sometimes minimap functions will fail due to an invalid floatpoint operation. I've fixed this and updated the Git. .

    Awesome job on the OGL snippets, mate!
    The break system will wait until it sees the minimap after logging in. When it logs to lobby it'll look for the star as an indicator. The issue shouldn't affect this at all unless I'm misunderstanding what you're implying

    Edit : Just updated my include to the latest version, thanks. My Div script does use minimap for majority of it
    Tsunami

  4. #4
    Join Date
    Jun 2014
    Posts
    463
    Mentioned
    27 Post(s)
    Quoted
    229 Post(s)

    Default

    Updated the break system, added a fail safe in case it fails to login.
    Tsunami

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •