Results 1 to 16 of 16

Thread: Handle Furnace

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

    Default Handle Furnace

    This is just a basic function that I made for my smelter, just so it could find the furnace more reliably than FindObjTPA. And I thought it might be useful to people making smelters, just incase they don't know TPAs. Its my first proper TPA usage so don't insult it too much

    SCAR Code:
    Function HandleFurnace:Boolean;
    Var
      TPA: TPointArray;
      Temp: T2DPointArray;
      h, x, y, MouseSpeed2, z, t, CTS: Integer;
    begin
      If not LoggedIn then Exit;
      MouseSpeed2 := MouseSpeed;
      MouseSpeed := 25;
      t := GetSystemTime;
      CTS := ColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(x, y, TPA, 2500137, MSX1, MSY1, MSX2, MSY2, 5);
      Temp := TPAtoATPAex(TPA, 40, 40);
      SortATPASize(Temp, True);
      h := High(Temp);
      For z := 0 to h do
      Begin
        If Length(z) >= 10 then //10 a good ammount?
          Continue;
        MiddleTPAex(Temp[z], x, y);
        MMouse(x, y, 5, 5);
        Result := IsUpText('melt');
        If Result then
        Begin
          WriteLN('Found the furnace in '+IntToStr((GetSystemTime) - t)+' msecs');
          break;
        end;
        Wait(100);
      end;
      If Result then
      Begin
        GetMousePos(x, y);
        Mouse(x, y, 0, 0, True);
      end;
      If Not Result then
      WriteLN('Couldn'#39't find a furnace');
      MouseSpeed := MouseSpeed2;
      ColorToleranceSpeed(CTS);
    end;

    Example of how quickly it finds it:

    Code:
    Found the furnace in 477 msecs
    Thats one of the slower times, it once did it in 138 I think, somewhere near that.

    NOTE: I've only testing in Al Kharid, I think all furnaces are the same, but if they aren't this may only work there.

    Thanks to Hermpie for helping me learn TPAs.

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    U are a copycat using higher mousespeed like 25 u do is detectable i should delete it k
    ~Hermen

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

    Default

    Quote Originally Posted by Hermpie View Post
    U are a copycat using higher mousespeed like 25 u do is detectable i should delete it k
    I find its better, makes is less detectable really. And is only for like half a second so it doesn't matter.

  4. #4
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Set your ColorToleranceSpeed as it was before changing it.


  5. #5
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    You could accomplish the same thing and still make it faster.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

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

    Default

    Quote Originally Posted by Cazax View Post
    Set your ColorToleranceSpeed as it was before changing it.
    Done

  7. #7
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by R0b0t1 View Post
    You could accomplish the same thing and still make it faster.
    Well could you not spam and tell us how...

  8. #8
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    I suggest looking at the length of an array before doing a MiddleTPA. What if the length is 3, are you still sure it might be a furnace?
    Hup Holland Hup!

  9. #9
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by nielsie95 View Post
    I suggest looking at the length of an array before doing a MiddleTPA. What if the length is 3, are you still sure it might be a furnace?
    It might be Pi, Rounded!
    What Nielsie means is basically:

    SCAR Code:
    For z := 0 to h do
      Begin
        if length(Temp[z]) < 10 then // 10?
          continue;
        MiddleTPAex(Temp[z], x, y);
        MMouse(x, y, 5, 5);
        Result := IsUpText('melt');
        If Result then
        Begin
          WriteLN('Found the furnace in '+IntToStr((GetSystemTime) - t)+' msecs');
          break;
        end;
        Wait(100);
      end;



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

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

    Default

    Quote Originally Posted by nielsie95 View Post
    I suggest looking at the length of an array before doing a MiddleTPA. What if the length is 3, are you still sure it might be a furnace?
    Ok, I get what you mean, I'll edit it now.

    Quote Originally Posted by Wizzup? View Post
    It might be Pi, Rounded!
    What Nielsie means is basically:

    SCAR Code:
    For z := 0 to h do
      Begin
        if length(Temp[z]) < 10 then // 10?
          continue;
        MiddleTPAex(Temp[z], x, y);
        MMouse(x, y, 5, 5);
        Result := IsUpText('melt');
        If Result then
        Begin
          WriteLN('Found the furnace in '+IntToStr((GetSystemTime) - t)+' msecs');
          break;
        end;
        Wait(100);
      end;
    What would you say is a good length, because furnaces are quite big?

    Thanks Wizzy and Nielsie for help (I repped you both).

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

    Default

    just comment the length check out for a time, and make it print the length of the TPA each time it finds it. do that 10 times or so, take the lowest and the highest it prints, and viola, you have an accurate length check
    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

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

    Default

    Quote Originally Posted by drizzt View Post
    just comment the length check out for a time, and make it print the length of the TPA each time it finds it. do that 10 times or so, take the lowest and the highest it prints, and viola, you have an accurate length check
    How would you print out the length of the TPA. Sorry I'm new to TPAs.

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

    Default

    SCAR Code:
    Function HandleFurnace:Boolean;
    Var
      TPA: TPointArray;
      Temp: T2DPointArray;
      h, x, y, MouseSpeed2, z, t, CTS: Integer;
    begin
      If not LoggedIn then Exit;
      MouseSpeed2 := MouseSpeed;
      MouseSpeed := 25;
      t := GetSystemTime;
      CTS := ColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(x, y, TPA, 2500137, MSX1, MSY1, MSX2, MSY2, 5);
      Temp := TPAtoATPAex(TPA, 40, 40);
      SortATPASize(Temp, True);
      h := High(Temp);
      For z := 0 to h do
      Begin
        If Length(z) >= 10 then //10 a good ammount?
          Continue;
        MiddleTPAex(Temp[z], x, y);
        MMouse(x, y, 5, 5);
        Result := IsUpText('melt');
        If Result then
        Begin
          WriteLN('Found the furnace in '+IntToStr((GetSystemTime) - t)+' msecs');
          Writeln(inttostr(Length(Temp[z])) + ' is the length of the TPA');
          break;
        end;
        Wait(100);
      end;
      If Result then
      Begin
        GetMousePos(x, y);
        Mouse(x, y, 0, 0, True);
      end;
      If Not Result then
      WriteLN('Couldn'#39't find a furnace');
      MouseSpeed := MouseSpeed2;
      ColorToleranceSpeed(CTS);
    end;

    also, 40*40 is pretty huge..thats a possible 1600 points, so 10 is definately not a good length
    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

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

    Default

    Well I don't know, I'm rubbish at all this TPA stuff. I might make it 20 by 20. Then I'd made the legnth something higher. But what it is at the moment seems to work fine, its never not found it, and its never gone to click on something other than the furnace.

  15. #15
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Dude Richard View Post
    Well I don't know, I'm rubbish at all this TPA stuff. I might make it 20 by 20. Then I'd made the legnth something higher. But what it is at the moment seems to work fine, its never not found it, and its never gone to click on something other than the furnace.
    See i said 40*40 was good
    ~Hermen

  16. #16
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    First off, continue makes a loop hold (not continue).

    SCAR Code:
    program New;
    var
      i: Integer;
    begin
      for i := 0 to 3 do
      begin
        if (i = 2) then
          Continue;
        WriteLn(IntToStr(i));
      end;
    end.

    SCAR Code:
    If Length(z) <= 10 then //Why check for z here?
          Continue;

    You have a double array, which means you have an array of an array. You loop through the first array to find an array that matches your needs. If you keep checking the same array, it wont work Check the array you are going to use if it's a possible furnace. To find a proper length, let it write it out a few times:

    SCAR Code:
    Function HandleFurnace:Boolean;
    Var
      TPA: TPointArray;
      Temp: T2DPointArray;
      h, x, y, MouseSpeed2, z, t, CTS: Integer;
    begin
      If not LoggedIn then Exit;
      MouseSpeed2 := MouseSpeed;
      MouseSpeed := 25;
      t := GetSystemTime;
      CTS := ColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(x, y, TPA, 2500137, MSX1, MSY1, MSX2, MSY2, 5);
      Temp := TPAtoATPAex(TPA, 40, 40);
      SortATPASize(Temp, True);
      h := High(Temp);
      For z := 0 to h do
      Begin
        WriteLn(IntToStr(Length(Temp[z])));
        MiddleTPAex(Temp[z], x, y);
        MMouse(x, y, 5, 5);
        Result := IsUpText('melt');
        If Result then
        Begin
          WriteLN('Found the furnace in '+IntToStr((GetSystemTime) - t)+' msecs');
          Writeln(inttostr(Length(Temp[z])) + ' is the length of the TPA');
          break;
        end;
        Wait(100);
      end;
      If Result then
      Begin
        GetMousePos(x, y);
        Mouse(x, y, 0, 0, True);
      end;
      If Not Result then
      WriteLN('Couldn'#39't find a furnace');
      MouseSpeed := MouseSpeed2;
      ColorToleranceSpeed(CTS);
    end;
    Hup Holland Hup!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. from furnace to bank and back
    By markmccain in forum OSR Help
    Replies: 40
    Last Post: 06-04-2008, 10:53 PM
  2. Phasmatys Furnace Door
    By benjaa in forum OSR Help
    Replies: 16
    Last Post: 05-17-2008, 01:56 PM
  3. Blast Furnace CokeFiller!
    By drnewheart in forum RS3 Outdated / Broken Scripts
    Replies: 14
    Last Post: 09-03-2007, 09:18 PM
  4. Furnace color has changed.
    By WT-Fakawi in forum RS has been updated.
    Replies: 9
    Last Post: 05-13-2006, 03:36 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
  •