Results 1 to 7 of 7

Thread: After X ammount of time, break and logout?

  1. #1
    Join Date
    Jan 2012
    Posts
    100
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default After X ammount of time, break and logout?

    Is there a little snippet for this somewhere??

    So after for instance 1Hour+random(~30mins)
    It will log out, and then back in because i can tell it to after maybe 30 minutes of being logged out?

  2. #2
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    http://villavu.com/forum/showthread.php?t=74999

    Not exactly what you're looking for, but the MiniBreaker is similar, could pretty easily be edited to only activate ever 1hr or so

  3. #3
    Join Date
    Jan 2012
    Posts
    100
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by Itankbots View Post
    http://villavu.com/forum/showthread.php?t=74999

    Not exactly what you're looking for, but the MiniBreaker is similar, could pretty easily be edited to only activate ever 1hr or so
    Thank you for this i'll look into it ASAP

  4. #4
    Join Date
    Apr 2013
    Location
    England
    Posts
    223
    Mentioned
    2 Post(s)
    Quoted
    106 Post(s)

    Default

    heres one that i used a while back. playRange is just what the user enters, for example between 200 and 300 minutes ... same with breakRange, eg 10 to 15 minutes.

    this bit goes in my main bit, inside the repeat loop ...
    Simba Code:
    nextBreak := GetTimeRunning + RandomRange(playRange[0], playRange[1]);
      breakLength := RandomRange(breakRange[0], breakRange[1]);                

      repeat

        if (nextbreak < GetTimeRunning) and (playRange[1] > 0) then         // playerRange[1] >0 is just to check it has a value
        begin
          MyDebug('starting to break');
          breakLoop(breakLength);
          nextBreak := GetTimeRunning + RandomRange(playRange[0], playRange[1]);   // get a new time for nextBreak and breakLength
          breakLength := RandomRange(breakRange[0], breakRange[1]);                // so it changes every break.
        end;

        if not LoggedIn then
        begin
          if attempts >3 then
          begin
            terminatescript;
          end;
          LogInPlayer;
          inc(attempts);
        end;

        attempts := 0;
        MainLoop;
      until(false)

    and then the actual breakLoop procedure:

    Simba Code:
    procedure breakLoop(length: Integer);
    var
      timeLeft: integer;
    begin
      timeLeft := length;
      MyDebug('starting break for: ' + inttostr(timeLeft));

      while(Incombat) do         // made for a combat script so what this does is ensure that it is able to logout before trying
      begin                      // to log out, there are other ways that you could do this,
        while(Incombat) do       // but for some reason i chose this way :)
        begin
          eat;
          ProduceProgressReport;
          wait(500);
        end;

        wait(13000);
      end;

      Logout;      
      SMART_DrawTextEx(false, 50, 50, 'UpChars07', 'Breaking For:', 62207);             // when logged out i had a little countdown
      SMART_DrawTextEx(false, 50, 75, 'UpChars07', MyGetTimeRunning(timeLeft), 62207);  // timer thing on the go so if you user looks
      SMART_DrawTextEx(false, 50, 125, 'UpChars07', 'Break Time Left:', 62207);         // they can see how long is left

      while (timeLeft > 0) do
      begin
        SMART_ClearCanvasArea(IntToBox(45,145,250,175));                                  
        SMART_DrawTextEx(false, 50, 150, 'UpChars07', MyGetTimeRunning(timeLeft) , 62207);
        timeLeft := timeLeft - 1000;
        wait(1000);
      end;
    end;

    well thats how i implemented a break function into a script of mine before, if i came at it again i might go a slightly different way, but this still works pretty well

  5. #5
    Join Date
    Jan 2012
    Posts
    100
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by EngageTheRage View Post
    heres one that i used a while back. playRange is just what the user enters, for example between 200 and 300 minutes ... same with breakRange, eg 10 to 15 minutes.

    this bit goes in my main bit, inside the repeat loop ...
    Simba Code:
    nextBreak := GetTimeRunning + RandomRange(playRange[0], playRange[1]);
      breakLength := RandomRange(breakRange[0], breakRange[1]);                

      repeat

        if (nextbreak < GetTimeRunning) and (playRange[1] > 0) then         // playerRange[1] >0 is just to check it has a value
        begin
          MyDebug('starting to break');
          breakLoop(breakLength);
          nextBreak := GetTimeRunning + RandomRange(playRange[0], playRange[1]);   // get a new time for nextBreak and breakLength
          breakLength := RandomRange(breakRange[0], breakRange[1]);                // so it changes every break.
        end;

        if not LoggedIn then
        begin
          if attempts >3 then
          begin
            terminatescript;
          end;
          LogInPlayer;
          inc(attempts);
        end;

        attempts := 0;
        MainLoop;
      until(false)

    and then the actual breakLoop procedure:

    Simba Code:
    procedure breakLoop(length: Integer);
    var
      timeLeft: integer;
    begin
      timeLeft := length;
      MyDebug('starting break for: ' + inttostr(timeLeft));

      while(Incombat) do         // made for a combat script so what this does is ensure that it is able to logout before trying
      begin                      // to log out, there are other ways that you could do this,
        while(Incombat) do       // but for some reason i chose this way :)
        begin
          eat;
          ProduceProgressReport;
          wait(500);
        end;

        wait(13000);
      end;

      Logout;      
      SMART_DrawTextEx(false, 50, 50, 'UpChars07', 'Breaking For:', 62207);             // when logged out i had a little countdown
      SMART_DrawTextEx(false, 50, 75, 'UpChars07', MyGetTimeRunning(timeLeft), 62207);  // timer thing on the go so if you user looks
      SMART_DrawTextEx(false, 50, 125, 'UpChars07', 'Break Time Left:', 62207);         // they can see how long is left

      while (timeLeft > 0) do
      begin
        SMART_ClearCanvasArea(IntToBox(45,145,250,175));                                  
        SMART_DrawTextEx(false, 50, 150, 'UpChars07', MyGetTimeRunning(timeLeft) , 62207);
        timeLeft := timeLeft - 1000;
        wait(1000);
      end;
    end;

    well thats how i implemented a break function into a script of mine before, if i came at it again i might go a slightly different way, but this still works pretty well
    Thanks for the HQ post!
    But this I can't seem to find anything making the other Procedures stopping while this starts.
    Because when I breaks and logs, I don't want the other procedures to keep on going

  6. #6
    Join Date
    Apr 2013
    Location
    England
    Posts
    223
    Mentioned
    2 Post(s)
    Quoted
    106 Post(s)

    Default

    Quote Originally Posted by humeruzz View Post
    Thanks for the HQ post!
    But this I can't seem to find anything making the other Procedures stopping while this starts.
    Because when I breaks and logs, I don't want the other procedures to keep on going
    this will make the others stop ... you see in the procedure breakLoop there is a while loop at the bottom ... it will stay in that until it has counted down from breaktime to zero, so no other methods will be called during that time, just the on screen text updated

  7. #7
    Join Date
    Jan 2012
    Posts
    100
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by EngageTheRage View Post
    this will make the others stop ... you see in the procedure breakLoop there is a while loop at the bottom ... it will stay in that until it has counted down from breaktime to zero, so no other methods will be called during that time, just the on screen text updated
    Oh thanks!
    Didn't catch that part

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
  •