Results 1 to 5 of 5

Thread: Need help with break's

  1. #1
    Join Date
    Oct 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need help with break's

    I dont think that i am using the break command properly so im looking for some help. The case below is the following:

    click to go to the furnace
    when at the furnace, click an item
    use the item with the furnace
    if a random pops up, solve it and then start the repeat loop over.
    this time around, no randoms detected, continue on as normal.


    Code:
    Procedure SmeltFurnace;
    begin
    repeat
    If not(FindObj(x,y,'urna',MSFurnace,10))then
         begin
         WalkToFurnaceSymbol;
         end;
    repeat
         if (FindObj(x,y,'urna',MSFurnace,10))then
         begin
              Writeln('using furnace');
              Wait(500+Random(100));
              UseItem(2);
              Mouse(x,y,1,1,false);
              if (ChooseOption(x, y, 'urna')) then
              begin
                   Writeln('Chose opotion');
                   Flag;
                   if(FindNormalRandoms) then
                   begin
                        Break;
                   end;
              end;
         end;
         Wait(500+Random(250));
    until(FindText(x, y, 'would', Upchars, 190, 25, 245, 50));
    until(FindText(x, y, 'would', Upchars, 190, 25, 245, 50));
    end;
    if you need any more explanation of my problem, please say so

  2. #2
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    It looks like you're using it right to me. Basically what it's doing is if it finds a random it will go back to the first repeat in that procedure. Hope that helped.

  3. #3
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    you also might want to check for ClickHereToContinue when a player gains a smithing level

    SCAR Code:
    if(FindNormalRandoms)or(ClickHereToContinue)then
     break;
    Join the Official SRL IRC channel. Learn how to Here.

  4. #4
    Join Date
    Oct 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yep, thank you for clarification, it works, it just got jammed on a box random.. and how does it say what you've gotten BEFORE it solves the box.. its so weird...

  5. #5
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I have a suggestion unrelated to your break question.

    Code:
    Procedure SmeltFurnace;
    begin
    repeat
    If not(FindObj(x,y,'urna',MSFurnace,10))then
         begin
         WalkToFurnaceSymbol;
         end;
    repeat
         if (FindObj(x,y,'urna',MSFurnace,10))then
         begin
              Writeln('using furnace');
              Wait(500+Random(100));
              UseItem(2);
              Mouse(x,y,1,1,false);
              if (ChooseOption(x, y, 'urna')) then
              begin
                   Writeln('Chose opotion');
                   Flag;
                   if(FindNormalRandoms) then
                   begin
                        Break;
                   end;
              end;
         end;
         Wait(500+Random(250));
    until(FindText(x, y, 'would', Upchars, 190, 25, 245, 50));
    until(FindText(x, y, 'would', Upchars, 190, 25, 245, 50));
    end;
    So, you want to make sure you are at the furnace before you continue on. As you have it written, you will run WalkToFurnace one time and then continue on. This ASSUMES that WalkToFurnace worked correctly, but that may not be true. You can have the exact same functionality and include a second symbol check with one simple change.

    Code:
    Procedure SmeltFurnace;
    begin
    repeat
    If not(FindObj(x,y,'urna',MSFurnace,10))then
         begin
           WalkToFurnaceSymbol;
           SmeltFurnace;
           Exit;
         end;
    etc
    So, if you see the furnace, you continue on normally. If you don't see the furnace you run WalkToFurnaceSymbol, then you restart the entire procedure, which adds another check. Now if you find the furnace then you continue on as normal. If not then you try to walk again.

    This may not be appropriate in your particular script, depending on what type of checking and failsafes you include elsewhere, but it's a strategy that I'm beginning to use more in my scripts now and it works well.

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
  •