Results 1 to 10 of 10

Thread: FindGas

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

    Default FindGas

    I've heard that FindGas in SRL isn't working or is outdated. So I made a gas finder:
    SCAR Code:
    Function FindGas(RockX, RockY : Integer; Var GasX, GasY : Integer): Boolean;
    Var
      TPA, Points : TPointArray;
      ATPA : T2DPointArray;
      I, Bmp, Hi, temp, Bmp2, J, K, Count : Integer;
      H, S, L : Extended;
      Box : TBox;
      Canv1, Canv2 : TCanvas;
    Begin
      Bmp := BitmapFromString(0, 0, '');
      Bmp2 := BitmapFromString(0, 0, '');
      SetLength(Points, 0);
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, 8820900, RockX - 30, RockY - 30, RockX + 30, RockY + 30, 30);
      ColorToleranceSpeed(1);
      If Length(TPA) = 0 Then
        Exit;
      Hi := High(TPA);
      For I := 0 To Hi Do
      Begin
        temp := GetColor(TPA[I].X, TPA[I].Y);
        ColorToHSL(temp, H, S, L);
        If H < 13 Then
          If H > 6 Then
          Begin
            SetLength(Points, Length(Points) + 1);
            Points[High(Points)] := TPA[I];
          End;
      End;
      ATPA := SplitTPA(Points, 10);
      Hi := High(ATPA);
      For I := 0 To Hi Do
      Begin
        If Length(ATPA[I]) < 100 Then
          Continue;
        Box := GetTPABounds(ATPA[I]);
        CopyClientToBitmap(Bmp, Box.X1, Box.Y1, Box.X2, Box.Y2);
        Wait(250);
        CopyClientToBitmap(Bmp2, Box.X1, Box.Y1, Box.X2, Box.Y2);
        Canv1 := GetBitmapCanvas(Bmp);
        Canv2 := GetBitmapCanvas(Bmp2);
        For J := Box.X1 To Box.X2 Do
          For K := Box.Y1 To Box.Y2 Do
            If Canv1.Pixels[J, K] <> Canv2.Pixels[J, K] Then
              Inc(Count);
        If (Count / ((Box.X2 - Box.X1) + (Box.Y2 - Box.Y1))) * 100 >= 70 Then
        Begin
          Writeln('Found Gas!');
          Result := True;
          MiddleTPAex(ATPA[I], GasX, GasY);
          FreeBitmap(Bmp);
          FreeBitmap(Bmp2);
          Exit;
        End;
      End;
      FreeBitmap(Bmp);
      FreeBitmap(Bmp2);
    End;
    I have tested it with gasses, haven't failed


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

    Default

    Did you test on zombie clothes? Both the gasses? (Old rock gas != New rock gas)
    Freaky Forester clothes?

    E: AFAIK the two in my Multi Miner still work nicely?



    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)

  3. #3
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    The two in your multiminer aren't in SRL, are they?
    I made a new script, check it out!.

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

    Default

    I have tested it with freaky forester clothes, and zombie ones, nothing happened. I couldn't find any old rock in f2p, the dwarf mines have new rocks.
    @Markus: There is only 1 FindGas in SRL by nielsie and sumilion.


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

    Default

    I'll throw it into my mining script, have it take screenshots, and see what happens.

    Edit: It doesn't compile??

    Code:
    Failed when compiling
    Line 1: [Error] (1:1): Variable Expected in script
    That's with SCAR 3.20 Beta 8.1 and the latest Dev SRL.


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

    Default

    Quote Originally Posted by tarajunky View Post
    I'll throw it into my mining script, have it take screenshots, and see what happens.

    Edit: It doesn't compile??

    Code:
    Failed when compiling
    Line 1: [Error] (1:1): Variable Expected in script
    That's with SCAR 3.20 Beta 8.1 and the latest Dev SRL.
    The function will store the gas coords in X and Y so they have to be variables no need to input the rock coords.

    EDIT: Then you can use Distance to see if your near that rock.


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

    Default

    Quote Originally Posted by Cazax View Post
    The function will store the gas coords in X and Y so they have to be variables no need to input the rock coords.

    EDIT: Then you can use Distance to see if your near that rock.
    Why don't you let it return the gas coordinates with different variables?
    This way is not very convenient for the scripter.



    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)

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

    Default

    Quote Originally Posted by Wizzup? View Post
    Why don't you let it return the gas coordinates with different variables?
    This way is not very convenient for the scripter.
    Ok, updated


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

    Default

    Code:
    Line 219: [Error] (18504:1): Unknown identifier 'DebugTPA' in script
    Is that one of your functions?

    edit: Nevermind, I found it and put it in. I'll let you know how it works.


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

    Default

    Quote Originally Posted by tarajunky View Post
    Code:
    Line 219: [Error] (18504:1): Unknown identifier 'DebugTPA' in script
    Is that one of your functions?

    edit: Nevermind, I found it and put it in. I'll let you know how it works.
    Oops, I forgot to remove it


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
  •