Results 1 to 10 of 10

Thread: adding breaks

  1. #1
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default adding breaks

    I want to add an option where the player fill in an amount of time to auto before taking a short break to reduce randoms, how would I do this
    At sea with the navy - not very active

  2. #2
    Join Date
    Sep 2008
    Posts
    155
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You could do something like this:

    SCAR Code:
    program TimerDemo;
    // This doesn't compile, but I think it conveys the point(?)
    var time : integer;

    procedure DoStuff;
    begin
      // do stuff
    end;

    begin
     MarkTime(time);
     repeat //main loop
     if (time > 60000) then
     begin
       LogOut;
       wait(randomrange(10000, 20000);
       LoginPlayer;
       MarkTime(time);
     end;
     DoStuff;
     until // whenever you want
    end.

    Might not be the most efficient way, but I'm pretty sure it will work just fine. In my example, the script logs you out every min, waits 10-20 secs, then logs you back in and repeats.

    NOTE: be careful doing this, if you log out too frequently, you will get banned... it does take care of randoms though.
    Current Project - Superheater :: Mithril Bars - Should be ready for Members application soon

  3. #3
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ty

    is marktime in ms?
    At sea with the navy - not very active

  4. #4
    Join Date
    Aug 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I agreee with....


    SCAR Code:
    program TimerDemo;
    // This doesn't compile, but I think it conveys the point(?)
    var time : integer;
     
    procedure DoStuff;
    begin
      // do stuff
    end;
     
    begin
     MarkTime(time);
     repeat //main loop
     if (time > 60000) then
     begin
       LogOut;
       wait(randomrange(10000, 20000);
       LoginPlayer;
       MarkTime(time);
     end;
     DoStuff;
     until // whenever you want
    end.

  5. #5
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by tazzin44 View Post
    ty

    is marktime in ms?
    Sort of. What you have to do is this instead:
    SCAR Code:
    program New;
    {.include srl/srl.scar}
    var
    time: Integer;

    begin
    MarkTime(time);
    repeat
    Writeln('Hi!');
    Wait(1000);
    until(TimeFromMark(time) >= 6000);
    end.

  6. #6
    Join Date
    Sep 2008
    Posts
    155
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh yea, forgot that TimeFromMark(); part, sorry. And, yes, it's in ms.
    Current Project - Superheater :: Mithril Bars - Should be ready for Members application soon

  7. #7
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    awesome, and do you need to reset the value for marktime or does it automatically revert to 0 when markTime is called?
    At sea with the navy - not very active

  8. #8
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    MarkTime doesn't reset it to 0, it copies in the current SystemTime. Which is why you have to use TimeFromMark.

    But as long as you call MarkTime each time a player would log in (or whenever you need it) it should be fine.

  9. #9
    Join Date
    Sep 2008
    Posts
    155
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    MarkTime(time); would store the current time in the "time" variable. That's why you need to use TimeFromMark(time); to get the difference, (TimeFromMark(time) would take the current time, and subtract the time at which you marked the time)... Thus getting you the total time elapsed.

    So, assuming I understand your question, no you don't need to reset marktime.
    Current Project - Superheater :: Mithril Bars - Should be ready for Members application soon

  10. #10
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ahh I see kewl thx guys
    At sea with the navy - not very active

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Prefix change breaks smart
    By man slaughter in forum RS has been updated.
    Replies: 22
    Last Post: 10-26-2008, 12:15 PM
  2. Cant figure out why it breaks my loop
    By Metagen in forum OSR Help
    Replies: 3
    Last Post: 04-24-2008, 04:14 PM
  3. Line breaks?
    By skullbr00d in forum OSR Help
    Replies: 4
    Last Post: 06-12-2007, 02:58 AM

Posting Permissions

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