Results 1 to 24 of 24

Thread: Get time running not working properly?

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default Get time running not working properly?

    In my script in the main loop function i declare the "t" varible is equel to:
    Simba Code:
    t := GetTimeRunning div 1000+1;

    and each of my procedures displays:

    Simba Code:
    Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));

    But it only goes to 1 even if its been running more then 1 seconds..

  2. #2
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    1- You might want to create one consolidated thread for all your questions.

    2- I suggest you to use TimeRunning include.

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    1- You might want to create one consolidated thread for all your questions.

    2- I suggest you to use TimeRunning include.
    Not for rs

  4. #4
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    Doesn't matter if it's for rs or not. It returns the time since the script was started.

    EDIT: I strongly suggest you to read the includes and try to understand them before posting. You'll learn a lot more this way. There usually is a description of what the procedure or function does.
    Last edited by Wardancer; 12-11-2012 at 09:42 PM.

  5. #5
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    Doesn't matter if it's for rs or not. It returns the time since the script was started.
    so how would i include that?
    If it requires any addional downloads I would rather do it a different way so other people can use the script

  6. #6
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    so how would i include that?
    If it requires any addional downloads I would rather do it a different way so other people can use the script
    Please read the edit of my previous post. I believe you have all the necessary information to solve your problem.

  7. #7
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    GetTimeRunning automatically puts it into Hours Minutes Seconds i thought

  8. #8
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    I see "thetime" and "timerunning" in the includes.And it appears that I am currently using "timerunning" and it's not working.. so..

  9. #9
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    GetTimeRunning automatically puts it into Hours Minutes Seconds i thought
    I doubt it as TimeRunning uses GetTimeRunning as its ms variable.

    EDIT:

    Quote Originally Posted by rjj95 View Post
    I see "thetime" and "timerunning" in the includes.And it appears that I am currently using "timerunning" and it's not working.. so..
    Read the actual function and its description. Also read the functions that are called by it. Try to understand what you're working with. You won't learn much otherwise.
    Last edited by Wardancer; 12-11-2012 at 09:48 PM.

  10. #10
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    I doubt it as TimeRunning uses GetTimeRunning as its ms variable.

    EDIT:



    Read the actual function and its description. Also read the functions that are called by it. Try to understand what you're working with. You won't learn much otherwise.
    Get an error when i include it...
    Simba Code:
    {$i timing/timing.simba}

  11. #11
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    Get an error when i include it...
    Simba Code:
    {$i timing/timing.simba}
    It is already included by {$i srl/srl.simba}. You only have to add an extra line for the includes that aren't in the core folder of srl. An easy way to know if you have access to a function in an include is to search it from your script. If you can find it, there is no need to add any line.

  12. #12
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    I'm still not understanding the concept of why the time isnt working if i delcared it.

  13. #13
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    Your t will only equal GetTimeRunning div 1000+1 when you call it. It won't, by itself, adjusts over the course of time. I don't see your full script, but I assume that's the issue.

  14. #14
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Heres my script:

    Simba Code:
    {
    -------------------------------VALID MONSTERS---------------------------------
    -skeleton,ghost,warewolf,dwarf,bat,druid
    If you want more added ask me on thread. some are not reliable such as guards.
    DO NOT WEAR A FIGHTER TORSO IF YOU ARE FIGHTING SKELETONS
    }

    Program autofight;
    {$i srl/srl.simba}
    const
      time = 2; // in seconds
      monsterkill = ('ghost');
      breaking = ('Yes');
      minbreaktime = 4;
      maxbreaktime = 9;
      breakrate = 200;
      hpbarx = 213;
      hpbary = 90;
      hpbarx2 = 335;
      hpbary2 = 201;

      //status1 = ('waiting to get out of combat')
      //status2 = ('Attacking ')
    var
    hpbar,skelet,ghost,dwarf,druid,bat,warewolf,kills,t,outcome,bitch: Integer;
    resulte,qtab,invtab:Integer;
    status:string;
    procedure breakin;
    var
      X, Y: Integer;
        begin
        outcome := Random(breakrate);
        bitch := (maxbreaktime*60000)-(minbreaktime*60000);
        resulte := Random(bitch)
        if outcome = 1 then
          begin
          TypeSend('brb afk');
          Wait(1100 + Random(500));
          if FindDTM(qtab, x, y, 536, 194, 755, 225) then
            begin
            mmouse(x, y,1,1);
            Wait(1450 + Random(50));
            ClickMouse(x, y, mouse_Left);
            if FindColorTolerance(X,Y,3424328,563,247,639,257,15) then
              begin
              mmouse(x, y,1,1);
              Wait(350 + Random(50));
              ClickMouse(x, y, mouse_Left);
              if FindDTM(qtab, x, y, 536, 194, 755, 225) then
                begin
                mmouse(x, y,1,1);
                Wait(350 + Random(50));
                ClickMouse(x, y, mouse_Left);
                begin
                wait(minbreaktime+resulte)
              end;
            end;
          end;
        end;
      end;
    end;
    procedure CheckCombat;
    var
      X, Y: Integer;
        begin
        ClearDebug;
        status := ('Waiting to get out of combat.');
        writeln('Status:' + status + monsterkill + '.');
        Writeln('Kills:' + Tostr(kills));
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
        Wait((time * 500) + Random(1000));
          begin
          repeat
          until  (FindDTM(hpbar, x, y, hpbarx, hpbary, hpbarx2, hpbary2)=false);
      end;
      IncEx(kills, 1);
      breakin;
    end;
    procedure ClickWarewolf;
    var
      X, Y: Integer;
    begin
      if FindDTM(warewolf, x, y, 4, 6, 512, 333) then
      begin
        ClearDebug;
        status := ('Attacking ');
        writeln('Status:' + status + monsterkill + '.');
        Writeln('Kills:' + Tostr(kills));
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
        MouseSpeed:=45;
        mmouse(x, y,1,1);
        Wait(20 + Random(50));
        ClickMouse(X, Y, Mouse_Left);
        Wait(1800 + Random(500));
        CheckCombat;
      end;
    end;
    procedure ClickBat;
    var
      X, Y: Integer;
    begin
      if FindDTM(bat, x, y, 4, 6, 512, 333) then
      begin
        ClearDebug;
        status := ('Attacking ');
        writeln('Status:' + status + monsterkill + '.');
        Writeln('Kills:' + Tostr(kills));
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
        MouseSpeed:=45;
        mmouse(x, y,1,1);
        Wait(20 + Random(50));
        ClickMouse(X, Y, Mouse_Left);
        Wait(1800 + Random(500));
        CheckCombat;
      end;
    end;
    procedure ClickDruid;
    var
      X, Y: Integer;
    begin
      if FindDTM(druid, x, y, 4, 6, 512, 333) then
      begin
        ClearDebug;
        status := ('Attacking ');
        writeln('Status:' + status + monsterkill + '.');
        Writeln('Kills:' + Tostr(kills));
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
        MouseSpeed:=45;
        mmouse(x, y,1,1);
        Wait(20 + Random(50));
        ClickMouse(X, Y, Mouse_Left);
        Wait(1800 + Random(500));
        CheckCombat;
      end;
    end;
    procedure ClickDwarf;
    var
      X, Y: Integer;
    begin
      if FindDTM(dwarf, x, y, 4, 6, 512, 333) then
      begin
        ClearDebug;
        status := ('Attacking ');
        writeln('Status:' + status + monsterkill + '.');
        Writeln('Kills:' + Tostr(kills));
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
        MouseSpeed:=45;
        mmouse(x, y,1,1);
        Wait(20 + Random(50));
        ClickMouse(X, Y, Mouse_Left);
        Wait(1800 + Random(500));
        CheckCombat;
      end;
    end;
    procedure ClickGhost;
    var
      X, Y: Integer;
    begin
      if FindDTM(ghost, x, y, 4, 6, 512, 333) then
      begin
        ClearDebug;
        status := ('Attacking ');
        writeln('Status:' + status + monsterkill + '.');
        Writeln('Kills:' + Tostr(kills));
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
        MouseSpeed:=45;
        mmouse(x, y,1,1);
        Wait(20 + Random(50));
        ClickMouse(X, Y, Mouse_Left);
        Wait(1800 + Random(500));
        CheckCombat;
      end;
    end;
    procedure ClickSkeleton;
    var
      X, Y: Integer;
    begin
      if FindDTM(skelet, x, y, 4, 6, 512, 333) then
      begin
        ClearDebug;
        status := ('Attacking ');
        writeln('Status:' + status + monsterkill + '.');
        MouseSpeed:=25;
        mmouse(x, y,1,1);
        Wait(20 + Random(50));
        ClickMouse(X, Y, Mouse_Left);
        Wait(1800 + Random(500));
        CheckCombat;
      end;
    end;
    procedure Chooseproc;
       begin
       if monsterkill = ('ghost') then
        begin
        ClickGhost;
       end;
       if monsterkill = ('skeleton') then
        begin
        Clickskeleton;
       end;
       if monsterkill = ('bat') then
        begin
        ClickBat;
       end;
       if monsterkill = ('druid') then
        begin
        ClickDruid;
       end;
       if monsterkill = ('warewolf') then
        begin
        Clickwarewolf;
       end;
       if monsterkill = ('dwarf') then
        begin
        Clickskeleton;
       end;
    end;
    var
      X,Y,s: Integer;
        begin
        t := GetTimeRunning div 1000+1;
        skelet := DTMFromString('mLgAAAHicY2JgYIhjZGCIBuK9QPZJIO7paWJoaqpk4ASyQZgRihkYAJb8BW8=');
        ghost := DTMFromString('mLgAAAHicY2JgYLgKxDeAuB6Im4F43twlDDNnLmFgAbJBmBGKGRgAuZgGcQ==');
        druid := DTMFromString('mLgAAAHicY2JgYChiZGAoAOIdQPZWIJ6R5s6wd/MMBhYgG4QZoZiBAQCdPQWr');
        bat := DTMFromString('mLgAAAHicY2JgYEhhZGDIAOJlQPZSIC7ITGcozc1hYAGyQZgRihkYAIVaBLQ=');
        dwarf := DTMFromString('mLgAAAHicY2JgYIhihOBgEBuIm6uqGFq0FBlYgWwQZoRiBgYAaUADuA==');
        warewolf := DTMFromString('mLgAAAHicY2JgYFjEyMCwDIhNgdgIiA3UxBh83WwY2IFyIMwIxQwMAF3WAwE=');
        hpbar := DTMFromString('mLgAAAHicY2JgYLBjZGAIAuIOIO4E4pZjQLEdDAzsDBDMCMUMDABvpgP4');
        qtab := DTMFromString('mbQAAAHicY2VgYEhnYmDIBuI8IE4G4jQgPgMUvwTEp4H4AhAfA+KGyd8YUqv+MXz/ehiOuYDi6JgRCwYDAJvSEkI=');
        invtab := DTMFromString('mbQAAAHicY2VgYOhiYmCYDMQTgLgNiFuA+CxQ/AQQXwLiy0B8HIhleFgZkoyFGdxUBMDYTIGTgQsojo4ZsWAwAADC7gkn');

        repeat
        ClearDebug;
        Chooseproc;
        until False;
        Freedtm(skelet);
        Freedtm(hpbar);
        Freedtm(ghost);
        Freedtm(druid);
        Freedtm(bat);
        Freedtm(dwarf);
        Freedtm(warewolf);
        Freedtm(qtab);
        Freedtm(invtab);
    end.

  15. #15
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    I strongly suggest you to make use of case... of statements. They'll make your script much more readable and let you save a lot of time by reducing redundant lines. You should read (or re-read) Coh3n's tutorial: http://villavu.com/forum/showthread.php?t=58935. I don't mean to sound harsh, but it's very painful for the eyes (hard to read).

    As for the actual problem with time, it's exactly what I suspected.

    PS: You really have a variable called bitch? Please...

  16. #16
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    I strongly suggest you to make use of case... of statements. They'll make your script much more readable and let you save a lot of time by reducing redundant lines. You should read (or re-read) Coh3n's tutorial: http://villavu.com/forum/showthread.php?t=58935. I don't mean to sound harsh, but it's very painful for the eyes (hard to read).

    As for the actual problem with time, it's exactly what I suspected.

    PS: You really have a variable called bitch? Please...
    Cba to change it because i wrote that break procedure a month ago and use it for my scripts..
    Also: its my script i could care less if other people cant read it

  17. #17
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    I'm not sure you should say, on one hand, that it's your script and you could care less if other people can't read it, and ask for help on the other.

  18. #18
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    I'm not sure you should say, on one hand, that it's your script and you could care less if other people can't read it, and ask for help on the other.
    All you needed was the 2 lines of code.

  19. #19
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    The problem is that the t variable will only hold the integer value. Not the formula. So you will have to call t := GetTimeRunning div 1000+1; every time before the writeln.

    Simba Code:
    program new;

    var
      t, i: Integer;

    begin
      t := GetTimeRunning div 1000+1;

      for i := 0 to 100 do
      begin
        wait(100);
        t := GetTimeRunning div 1000+1;
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
      end;
    end.

    If you call it every function I suggest to create a procedure.

    Simba Code:
    procedure displayTimeRunning;
    var
      t: Integer;
    begin
      t := GetTimeRunning div 1000 + 1;
      Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
    end;

    But this will not display what you think it will. Can you adjust it? Pm me if you don't know how to continue. ^^
    Last edited by masterBB; 12-11-2012 at 11:24 PM.
    Working on: Tithe Farmer

  20. #20
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  21. #21
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    miliseconds since you pressed start
    Working on: Tithe Farmer

  22. #22
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by ashaman88 View Post
    what does writeln(gettimerunning) display?
    0:0:1

  23. #23
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    The problem is that the t variable will only hold the integer value. Not the formula. So you will have to call t := GetTimeRunning div 1000+1; every time before the writeln.

    Simba Code:
    program new;

    var
      t, i: Integer;

    begin
      t := GetTimeRunning div 1000+1;

      for i := 0 to 100 do
      begin
        wait(100);
        t := GetTimeRunning div 1000+1;
        Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
      end;
    end.

    If you call it every function I suggest to create a procedure.

    Simba Code:
    procedure displayTimeRunning;
    var
      t: Integer;
    begin
      t := GetTimeRunning div 1000 + 1;
      Writeln('Time running: ' + IntToStr(Round(t/3600))+ ':' + IntToStr(Round(t/60))+ ':' + IntToStr(Round(t)));
    end;

    But this will not display what you think it will. Can you adjust it? Pm me if you don't know how to continue. ^^
    Thanks working great!

  24. #24
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    I strongly suggest you to read the includes and try to understand them before posting. You'll learn a lot more this way. There usually is a description of what the procedure or function does.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

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
  •