Results 1 to 13 of 13

Thread: repeat until...???

  1. #1
    Join Date
    Mar 2007
    Location
    Finland, Espoo
    Posts
    96
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    repeat until...???

    How I can make scar repeat something until a specific time?
    Like if I want to make it repeat something for 15sec and then
    do something else... Thank you!

  2. #2
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i think this would work


    SCAR Code:
    var
      Count: Integer;

    begin
    repeat
      Wait(1000);
      Count := Count + 1;
    until(Count > 14);
    lol

  3. #3
    Join Date
    Apr 2007
    Location
    The Buckeye State
    Posts
    482
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program New;
    var T: Integer;
    begin
      MarkTime(T);
      repeat
        wait(100);
      until MarkFromTime(T) = 5000;
    end.

    In this example, we mark a point in time using MarkTime(T); where T is the mark in time. We repeat waiting 100ms until we have waited 5000ms (5s) from the Mark in Time T. You would replace the waiting with whatever you want the script to do while it waits the desired amount of time.
    I like my coffee black just like my metal.

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ummm an example ould be
    SCAR Code:
    procedure DoStuff;
    begin
      Dowhateveryouthescripttodo;
    end;
    procedure mainloop;
    var
    time: Integer;
    begin
      repeat
      MarkTime(Time);
       dostuff;
      until TimeFromMark(time) = (15000 + Random (1000));
    end;

    that does the process repeatativly for 15 seconds and a random second. Hope that kinda helps

    edit: Shit lol 2 ppl beat me to it
    “Ignorance, the root and the stem of every evil.”

  5. #5
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    awww ye forgot about marktime
    lol

  6. #6
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by blumblebee View Post
    ummm an example ould be
    SCAR Code:
    procedure DoStuff;
    begin
      Dowhateveryouthescripttodo;
    end;
    procedure mainloop;
    var
    time: Integer;
    begin
      repeat
      MarkTime(Time);
       dostuff;
      until TimeFromMark(time) = (15000 + Random (1000));
    end;

    that does the process repeatativly for 15 seconds and a random second. Hope that kinda helps

    edit: Shit lol 2 ppl beat me to it
    tut tut shouldnt it be this?
    SCAR Code:
    procedure DoStuff;
    begin
      Dowhateveryouthescripttodo;
    end;
    procedure mainloop;
    var
    time: Integer;
    begin
      repeat
      MarkTime(Time);
       dostuff;
      until TimeFromMark(time) >= (15000 + Random (1000));
    end;


    ~shut

  7. #7
    Join Date
    Mar 2007
    Location
    Finland, Espoo
    Posts
    96
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Code:
    program DefCastle;
    {.include srl/srl.scar}
    
    var
    x,y,time: Integer;
    
    const
    MonsterColor = 13421772;
    
    procedure FindRec;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,130);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(20);
      end;
    end;
    
    procedure FindKill;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,3);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(50);
      end;
    end;
    
    begin
    repeat
     FindRec;
      repeat
       MarkTime(time);
       FindKill;
      until TimeFromMark(time) = (20000);
    until(FindColor(x,y,0,13,33,26,47));
    end.
    This is the script. It doesn't do FindRec;
    Script is for Defend Your Castle.
    HTML Code:
    http://www.arcade.fi/peli/defend-your-castle.html
    Thank you for your help.

  8. #8
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Alligaattor View Post
    Code:
    program DefCastle;
    {.include srl/srl.scar}
    
    var
    x,y,time: Integer;
    
    const
    MonsterColor = 13421772;
    
    procedure FindRec;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,130);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(20);
      end;
    end;
    
    procedure FindKill;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,3);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(50);
      end;
    end;
    
    begin
    repeat
     FindRec;
      repeat
       MarkTime(time);
       FindKill;
      until TimeFromMark(time) = (20000);
    until(FindColor(x,y,0,13,33,26,47));
    end.
    This is the script. It doesn't do FindRec;
    Script is for Defend Your Castle.
    HTML Code:
    http://www.arcade.fi/peli/defend-your-castle.html
    Thank you for your help.
    your remarking the time
    try this
    SCAR Code:
    program DefCastle;
    {.include srl/srl.scar}

    var
    x,y,time: Integer;

    const
    MonsterColor = 13421772;

    procedure FindRec;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,130);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(20);
      end;
    end;

    procedure FindKill;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,3);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(50);
      end;
    end;

    begin
    repeat
     FindRec;
     MarkTime(time);
      repeat
       FindKill;
      until TimeFromMark(time) = (20000);
    until(FindColor(x,y,0,13,33,26,47));
    end.


    ~shut

  9. #9
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by blumblebee View Post
    ummm an example ould be
    SCAR Code:
    procedure DoStuff;
    begin
      Dowhateveryouthescripttodo;
    end;
    procedure mainloop;
    var
    time: Integer;
    begin
      repeat
      MarkTime(Time);
       dostuff;
      until TimeFromMark(time) = (15000 + Random (1000));
    end;

    that does the process repeatativly for 15 seconds and a random second. Hope that kinda helps

    edit: Shit lol 2 ppl beat me to it
    The MarkTime goes outside the repeat loop. It is pointless to keep repeating the time, if you do that then you keep reseting the time marked to 0 and starts counting over again.

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  10. #10
    Join Date
    Mar 2007
    Location
    Finland, Espoo
    Posts
    96
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Still not doing FindRec.
    It's suposed to drop 1 enemy per 20sec inside my castle yard
    and not kill it like FindKill; does.
    And it doesn't stop repeating even when the color 0 is found.
    When i remove MarkTime it works but does only once FindRec.

  11. #11
    Join Date
    Mar 2007
    Location
    Finland, Espoo
    Posts
    96
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Anyone? plz... this is quite important experiment.

  12. #12
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    try this one
    SCAR Code:
    program DefCastle;
    {.include srl/srl.scar}
     
    var
    x,y,time: Integer;
     
    const
    MonsterColor = 13421772;
     
    procedure FindRec;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,130);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(20);
      end;
    end;
     
    procedure FindKill;
    begin
     if(FindColor(x,y,MonsterColor,3,254,253,360)) then
      begin
       HoldMouse(x,y,true);
       Wait(50);
       MoveMouse(375,3);
       Wait(50);
       ReleaseMouse(x,y,true);
       Wait(50);
      end;
    end;
     
    begin
    repeat
     FindRec;
     MarkTime(time);
      repeat
       FindKill;
      until TimeFromMark(time) >= (20000);
    until(FindColor(x,y,0,13,33,26,47));
    end.
    dunno if it will work but im now goin to bed

    ~shut

  13. #13
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    haha my bad :P i had 2 minutes b4 i went to school and i was in a rush...
    thanks for catching my mistake
    “Ignorance, the root and the stem of every evil.”

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Repeat?
    By FortAsh in forum OSR Help
    Replies: 9
    Last Post: 01-13-2009, 04:18 PM
  2. How do I get this to repeat until?
    By Claymore in forum OSR Help
    Replies: 2
    Last Post: 07-07-2008, 04:02 PM
  3. repeat help
    By trojan in forum OSR Help
    Replies: 2
    Last Post: 06-15-2007, 03:54 PM
  4. repeat somewhere help thx
    By rkroxpunk in forum OSR Help
    Replies: 4
    Last Post: 03-12-2007, 08:24 PM

Posting Permissions

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