Results 1 to 6 of 6

Thread: loop problem

  1. #1
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default loop problem

    k, well as you probably will know by the many help threads i've had out today, i'm a noob scripter,and for some reason my script won't get out of my one procedure and go to the next, i don't get it

    here she is

    SCAR Code:
    program New;
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}

    var
    x,y,i,TheRoadColor,cowskilled: integer;
    cowcolor: array [0..2] of integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 4;
      CurrentPlayer := 0;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := true;
     
      Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := '';
      Players[1].Active := False;
     
      Players[2].Name := '';
      Players[2].Pass := '';
      Players[2].Nick := '';
      Players[2].Active := False;
     
      Players[3].Name := '';
      Players[3].Pass := '';
      Players[3].Nick := '';
      Players[3].Active := False;
    end;

    function randclick(item , option:string): boolean;
    begin
    if isuptext(item) then
    begin
      case random(4) of
        0,1,2: mouse(x,y,10,10,true);
        3: begin
             mouse(x,y,10,10,false);
             chooseoption(option);
           end
      end
      Result := true;
    end
    end;

    procedure killdacow;

    begin
    Cowcolor[0]:=9278360
    Cowcolor[1]:=4212305
    Cowcolor[2]:=3425883
    if not(loggedin) then Exit;
    makecompass('s');
    repeat
    if findcolortolerance(x,y,Cowcolor[i],0,0,518,328,10) then
    begin
    randclick('ow','ttack');
    wait(1000);
    Repeat
    wait(100);
    cowskilled:=cowskilled+1
    until(infight=false);
    end;
    until(invfull);
    end;

    procedure ToPen;
    var
    z:integer;
    begin
      Z:=0
      Makecompass('n');
      TheRoadColor := findfallyroadColor;
      Wait(500);
      if radialwalk(TheRoadColor,180,270,40,1,1) then
      begin
      wait(500);
      end else Exit;
        repeat
          radialroadwalk(TheRoadColor,165,200,50,1,1);
          Writeln('lalala');
          wait(200);
        until(findsymbolin(x,y,'tree',628,8,704,165));
      mouse(x + 10,y,10,5,true);
      flag;
      if findcolortolerance(x,y,235,628,8,705,117,20) then
      begin
      mouse(x,y + 5,5,5,true);
      flag;
      wait(500);
      end;
        if findcolorSpiraltolerance(x,y,5467001,0,0,516,338,10) then
        begin
        randclick('ate','pen');
        Z:= Z + 1;
        end else exit;
    end;

    procedure ToBank;
    begin
    end;

    begin
    SetupSRL;
    activateclient;
    declareplayers;
    if not(loggedin) then loginplayer;
    Cowskilled:=0
    repeat
    ToPen;
    KilldaCow;
    until(false);
    end.
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  2. #2
    Join Date
    Jun 2007
    Location
    Ohio
    Posts
    341
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i don't think i understand what your saying, but i think this will help

    SCAR Code:
    procedure example;
    begin
     repeat
     writeln('next line will break the repeat')
     break;
     until(false)
    end;

    procedure example2;
    begin
     repeat
      if findcolortolerance(blahblahblah) then
       begin
        mouse(blah blah doesnt matter)
       end;
     if findcolortolerance(this is very important!) then
      begin
       break;  //this breaks out of the loop of looking for colors. once it finds
      end;     //the 2nd color, it will break from the loop and continue on.
     until(false)
    end;

  3. #3
    Join Date
    Jan 2008
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I do not get what you are asking either, try adding WriteLn's to see where its bugging up. Add at least one in each procedure and after every important event, so you know when it's hanging. For example use a writeln('attacked cow successfully') after your randclick('ow','ttack')

    thats just one example, so add them everywhere and run your script once it stops check the debug box and it will tell you where it stopped. then analyze the problem and continue coding

    cheers,
    prince

  4. #4
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    okay, i think i got it fixed anyway, but as it is now, it would walk from fally to the pen, then start spamming the debug with "lalalala" what it was was that my cowkilling procedure sucked and was letting it out of the loop too quick
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  5. #5
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Also if you don't want to end your script in the middle of doing something and you still want it to tell you what to do then do this:
    SCAR Code:
    Procedure TellMeSt00f;
    Begin
      if(What ever you are doing) then
      disguise('We did st00f!!!');
    end;

    This will show you at the little tab thingy at the bottom whatever you want it to tell you

  6. #6
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    right, well i just have script behind my window so that when the window is ontop of SCAR i can still see the debug box, thank you anyway though
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Loop
    By Ethan1221 in forum OSR Help
    Replies: 16
    Last Post: 12-22-2008, 05:31 PM
  2. Nooby Loop Problem :(
    By pianoman933 in forum OSR Help
    Replies: 2
    Last Post: 05-18-2008, 04:01 PM
  3. Problem with if-condition and while loop
    By Repentinus in forum OSR Help
    Replies: 6
    Last Post: 03-27-2008, 10:01 PM
  4. Main Loop Problem
    By kryptonite in forum OSR Help
    Replies: 9
    Last Post: 07-25-2007, 02:22 PM
  5. Infite loop problem
    By twobac in forum OSR Help
    Replies: 6
    Last Post: 02-03-2007, 06:49 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
  •