Results 1 to 12 of 12

Thread: Script Problem, How can you detect if fishing?

  1. #1
    Join Date
    May 2008
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Script Problem, How can you detect if fishing?

    Alright so I've written a script so far that includes an anti-logout procedure and an auto find-shark spot-and-click procedure. The only problem is, I don't know how to write a procedure to detect wether or not I am actually fishing, because If i am not I can run the find-shark-spot procedure. Here is my unfinished script as it is already.

    SCAR Code:
    program Antilogout;

    {.include SRL/SRL.scar}

    var
    Fish,Me: Integer;
    x,y,xbit,ybit,xchange,ychange,xorig,yorig,counter,xfish,yfish,xbit,ybit: Integer;
    Found: Boolean;

    procedure Antilogout;
              begin
              repeat
                   GetMousePos(x,y);
                   Wait(random(40000)); // Wait Up To 40 Second Before Testing Mouse Location
                   GetMousePos(xchange,ychange);
                   if (x=xchange) then
                      begin
                           GetMousePos(x,y);
                           xorig:=x;
                           yorig:=y;
                           Mmouse(x+random(50),y+random(50),0,0);
                           Wait(random(2000));
                           GetMousePos(x,y);
                           Mmouse(x-random(50),y-random(50),0,0);
                           Wait(random(2000));
                           Mmouse(xorig,yorig,0,0);
                      end;
                      counter:= counter + 1;
                      writeln('Script Successfully Executed '+IntToStr(counter)+' Times');
              until(false)
              end;
             
    procedure LoadBmps;
              begin
              Fish := BitmapFromString(138, 30, 'beNrtWUkOwyAMzO/6gV77/2f' +
           'QKlWR5S0DBcKGOIDLknqCh3iej3CW1/PxraybUUM4WE2a+M/W89Xw' +
           'K7R7HMflFN/JrODogINv9Vi7tyiQkoSONSbbyWOh0+Y5KTqfHSuhg' +
           '7xv1r/uLeK1RyfiwjzPTpZjVHmH2mmIU4nJYas41xmDMJ01PWnNDE' +
           'qtgU5sx1/ZFJVTGO/I998ipviXz+34eOYZdczvUXW/+fvKuYi99gl' +
           'C0HHaSZFNPTuq9+h4tY2MAc81sg64fj10aMhiXXpYiqATg5X6ThZs' +
           'y1p239vRkRfjIujUQwTxXu31a6BjdZ2LQQY6jJpl/M/zklzWvxJYN' +
           'w3r9qLaGwDE2E3tShJ0aFG1U6O/Zl6bRS3nwdQbi/XtfGnfCY2q3y' +
           'OjfAWPjshGp3OAJEdsdDqpqXlXnyj7yVGXkg9aHpAV5Ak8CdAV4y8' +
           'iTwyKziLyxAToTCxPBFEy5ANLU0iyW3mJleUJKRMg8oGaFHWEBtxO' +
           'E+aXvDO9POFENvVMMWhAoSGp7Ui0q8kTqb6SfiuOjsOAq8kT//utQ' +
           '3SmkSeyI5vF5jLogfYi6MwnT1zm5BkLszGWSAdm4BEFYcsTpfS7LU' +
           '909RU8PTpDyxMrnJ2h5YkVNNwb5Ik3fSdMSw==');
                Me := BitmapFromString(21, 24, 'beNqNlE1LAlEUhmdTUbSzhQQSgp' +
           'aGggtXrdzYpj8RtbDaCLVItC9SSq1AG+3TNMtKKklwkWQtgn5YLxx' +
           '4u8yMk5cHOd65zz3348xomrRQMEA8bjeZcrnIpNOp9Wl0fV6vWYcI' +
           '8Mhex4CA3083ODpE0N9PV1NjWHhsmEw4HCr2qSWYGx+R1QqD6EjKN' +
           'XCzg+iiiI5foB6XYQYei/QbUv+rA8M9cs3imu/LMI/6yHzj6LTRDc' +
           'j2mVcORy02ywUYdENTq84yKSe31A11i/H7iYSqy2rBgHommWRG6eT' +
           'LpYqcWdVBdmcbIMDMAlz04JduOBRS4Ug9l83t7QKWx9bGOpCYh49Y' +
           'RAQYzAst5/PCZ2E1HosJ8gLyHVRrXuZBUuH8+Ojh8gI6grXlJSAbV' +
           'HWmBjyQSrEA4DYrlfpZGWzG45K9eHigHr6I+PtcvSEQAYKXWo3gEk' +
           'E0EgGzvhnzRwO3U9VPydv9XbvRAMh+kk7jwBfmo9Mej+WNA1YU1gw' +
           '6zSehVb+V7SBvv4+eFLzEsoX31it5vL7KpFIri4tAs221Ugl8tNtf' +
           'nc5Pr/fd7QJsoarrf4N+AbYPC7Q=');
           end;
             
    procedure FreeBmps;
              begin
                   FreeBitmap(Fish);
                   FreeBitmap(Me);
              end;

    procedure FindFish;
              begin
              repeat
              if (FindColor(xfish,yfish,15452590,0,0,513,339)) then
                 begin
                 Wait(1000);
                 Mmouse(xfish,yfish,0,0);
                 Wait(1000+random(500));
                 Mouse(xfish,yfish,0,0,false);
                       if (FindBitmapToleranceIn(Fish,xbit,ybit,0,0,513,339,100)) then
                       begin
                          WriteLn('Found Fishing Spot!');
                          Mmouse(xbit,ybit,0,0);
                          Mouse(xbit+10,ybit+20,0,0,true);
                          Found:=true;
                       end else
                           Found:=false;
                 end;
              until(Found);
              end;

    begin
    setupsrl;
    LoadBmps;
    FindFish;
    FreeBmps;
    end.

    Any help would be GREATLY appreciated! :-D
    Thanks,
    Pianoman933

  2. #2
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    You can make a Bitmap/DTM of the Shark, then do a CountDTM/CountBitmap of it. If the result of the CountBitmap is more than the count before clicking the spot, you re-click Dunno if it would work if someone else catches your fish though =/


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  3. #3
    Join Date
    May 2008
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry, I'm kind of slow so please don't mind me if I work through your logic.
    1) I create a Bitmap of the shark, and covert it into code inserted into the .scar project
    2) I count the number of sharks on the screen before shark-spot clicked
    3) I count the number of sharks on the screen after i clicked it? and see if there are more than before, if so re-click fishing spot?? Ahhh! I'm sorry, i'm confused.

  4. #4
    Join Date
    May 2008
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Can somebody please expalin how this works, I would greatly appreciate it!

  5. #5
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    SCAR Code:
    Function NextSpot: integer;
    var
      i:integer;
    begin
      if not LoggedIn then exit;
      Result := 1;
      for i:=1 to 28 do
        if not ExistsItem(i) then
        begin
          Result:= i;
          exit;
        end;
    end;

    SCAR Code:
    MarkTime(SpotMark);
    CheckSpot := NextSpot;
    wait(100);

    if ExistsItem(CheckSpot) then
    begin
      CheckSpot := NextSpot;
      wait(50);
      MarkTime(SpotMark);
    end;

    if (TimeFromMark(SpotMark) > 30000) then
    begin
      wait(100);
      writeln('i dont think were fishing, but we should be!')
      writeln('lets try finding that fish again!');
      FindFish;
    end;

    that is the way i do it in my woodcutter, but it works for fishing too.
    you make a function that checks what is the next empty spot (Function NextSpot)

    you store that value in CheckSpot (CheckSpot := NextSpot)
    You Start Counting the time ( MarkTime(SpotMark) )
    if there is an item/fish in the NextSpot ( if ExistsItem(CheckSpot) then ) you get the new NextSpot and restart counting the time.

    if it took you more than 30 secs to get a new fish (
    if (TimeFromMark(SpotMark) > 30000) then ) you'll write into the debug that you should be fishing. and then you can look for fish again.

    hope that helped you, this method has never failed for me.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  6. #6
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    rofl when I started scripting, I made a small fisher (never finneshed it) but I used the rod color to detect fishing. If your rod color was found then you where fishing.

    good luck scripting.

  7. #7
    Join Date
    Apr 2007
    Posts
    994
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I remember from a looong time back, I think it was whale, who told you to wield a water or fire staff, and if the color is found near the center of the screen, it would assume you were'nt fishing. Clever, eh?
    [QUOTE]<GoF`> oh no its Raymooond
    <Raymooond> Heya
    <GoF`> is it ray or some other ray?
    <LeeLokHin> No idea
    <LeeLokHin> Raymond, what's the game you like the most?
    <Raymooond> Runescape
    <-- LeeLokHin has kicked Raymooond from #srl (Faker.)[/QUOTE]

  8. #8
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by leelokhin View Post
    I remember from a looong time back, I think it was whale, who told you to wield a water or fire staff, and if the color is found near the center of the screen, it would assume you were'nt fishing. Clever, eh?
    it was my edgeville fisher. But now i check for the existance of the rod.

    SCAR Code:
    Function IsFishing(Var fx, fy: Integer): Boolean;
    Var
      TPA: TPointArray;
    Begin
      FindColorsTolerance(TPA, 334889, fx - 50, fY - 50, fX + 50, fY + 5, 10);
      If(High(TPA) > 10)Then
      Begin
        Status('Fishing...');
        Result := True;
        FTWait(2);
      End Else Status('Not Fishing...');
    End;

    thats how i do it.

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  9. #9
    Join Date
    May 2008
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks a lot for all the input, this is extremely helpful, I'll post the completed script when complete for anyone interested. Thanks again! :-D

  10. #10
    Join Date
    May 2008
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright I have run into a small problem. I have inserted the recently suggested code to autodetect fishing( I changed the suggested code a little as you can see). However I have run into a snag. The FindFish procedure never executes. In order to check if the script is working a added a benchmark. When I got the benchmark results it consistanly read 156 Milliseconds; I believe this is because I am running the DetectFishing procedure in a loop... If this is so, what do i do to allow the DetectFishing procedure to consistently run but not re-loop itself every 156 milliseconds?

    Here is my code:

    SCAR Code:
    program FishSharks;

    {.include SRL/SRL.scar}

    var
    Fish,Me: Integer;
    SpotMark,SpotMarkLater,CheckSpot,x,y,xbit,ybit,xchange,ychange,xorig,yorig,counter,xfish,yfish,xbit,ybit: Integer;
    Found: Boolean;

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

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := 'mfs';
      Players[0].Active := True;

    end;

    procedure FindRandoms;
    begin
      LampSkill := 'fishing';
      FindNormalRandoms;
      if FindFight then RunAway('N',True,1,15000);
    end;

    procedure AntiBan;
    begin
      if not LoggedIn then Exit;
      case Random(30) of
        1: RandomRClick;
        2: HoverSkill('Fishing', False);
        3: RandomMovement;
        4: BoredHuman;
      end;
    end;
             
    procedure LoadBmps;
              begin
              Fish := BitmapFromString(138, 30, 'beNrtWUkOwyAMzO/6gV77/2f' +
           'QKlWR5S0DBcKGOIDLknqCh3iej3CW1/PxraybUUM4WE2a+M/W89Xw' +
           'K7R7HMflFN/JrODogINv9Vi7tyiQkoSONSbbyWOh0+Y5KTqfHSuhg' +
           '7xv1r/uLeK1RyfiwjzPTpZjVHmH2mmIU4nJYas41xmDMJ01PWnNDE' +
           'qtgU5sx1/ZFJVTGO/I998ipviXz+34eOYZdczvUXW/+fvKuYi99gl' +
           'C0HHaSZFNPTuq9+h4tY2MAc81sg64fj10aMhiXXpYiqATg5X6ThZs' +
           'y1p239vRkRfjIujUQwTxXu31a6BjdZ2LQQY6jJpl/M/zklzWvxJYN' +
           'w3r9qLaGwDE2E3tShJ0aFG1U6O/Zl6bRS3nwdQbi/XtfGnfCY2q3y' +
           'OjfAWPjshGp3OAJEdsdDqpqXlXnyj7yVGXkg9aHpAV5Ak8CdAV4y8' +
           'iTwyKziLyxAToTCxPBFEy5ANLU0iyW3mJleUJKRMg8oGaFHWEBtxO' +
           'E+aXvDO9POFENvVMMWhAoSGp7Ui0q8kTqb6SfiuOjsOAq8kT//utQ' +
           '3SmkSeyI5vF5jLogfYi6MwnT1zm5BkLszGWSAdm4BEFYcsTpfS7LU' +
           '909RU8PTpDyxMrnJ2h5YkVNNwb5Ik3fSdMSw==');
           end;
             
    procedure FreeBmps;
              begin
                   FreeBitmap(Fish);
              end;

    procedure FindFish;
              begin
              repeat
              if (FindColor(xfish,yfish,14592886,0,0,513,339)) then
                 begin
                 Wait(1000);
                 Mmouse(xfish,yfish,0,0);
                 Wait(1000+random(500));
                 Mouse(xfish,yfish,0,0,false);
                       if (FindBitmapToleranceIn(Fish,xbit,ybit,0,0,513,339,100)) then
                       begin
                          WriteLn('Found Fishing Spot!');
                          Mmouse(xbit,ybit,0,0);
                          Mouse(xbit+10,ybit+20,0,0,true);
                          Found:=true;
                       end else
                           Found:=false;
                 end;
              until(Found);
              end;
             
    Function NextSpot: integer; // Find the next empty spot
    var
    i:integer;
    begin
         if not LoggedIn then exit;
         Result := 1;
         for i:=1 to 28 do
         if not ExistsItem(i) then
         begin
            Result:=i;
            exit;
         end;
    end;
             
    procedure DetectFishing;
        begin
        repeat

            MarkTime(SpotMark);
            CheckSpot := NextSpot;
            wait(100);

            if ExistsItem(CheckSpot) then
            begin
              writeln('New Item');
              wait(50);
              MarkTime(SpotMarkLater);
              wait(50);
              SpotMarkLater := SpotMarkLater - SpotMark;
              CheckSpot := NextSpot;
              writeln('New Item Captured In '+IntToStr(SpotMarkLater)+' Milliseconds');
                       if ((SpotMarkLater) > 10000) then
                          begin
                               wait(100);
                               writeln('i dont think were fishing, but we should be!')
                               writeln('lets try finding that fish again!');
                               FindFish;
                          end;
            end;
        until(false)
        end;

    begin
    setupsrl;
    LoadBmps;
    DetectFishing;
    FreeBmps;
    end.

  11. #11
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    you can't make it into one procedure, because otherwise everytime the loop restarts CheckSpot will be reset to the new spot.

    you have to do it like i did, but there was one thing i wasn't clear about

    you have the function NextSpot

    and the rest of the code is in WaitingWhileFishing (or something like that where you check for randoms, if your still fishing, antiban etc)


    if it didn't get a new fish after 30 secs it re-calls it FindFish to re-start fishing

    and the loop is causing problems as well as having 2 different time marks. you should only have 1

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  12. #12
    Join Date
    May 2008
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Very helpful reply, thank you.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 04-16-2009, 06:40 AM
  2. Auto detect fishing? Is this possible?
    By pianoman933 in forum OSR Help
    Replies: 1
    Last Post: 11-27-2008, 06:54 PM
  3. Fishing Script
    By jamesreece in forum OSR Help
    Replies: 12
    Last Post: 03-14-2008, 08:58 AM
  4. Ranging Script, Detect if monster is out of range.
    By L3ss Than 33 in forum OSR Help
    Replies: 9
    Last Post: 01-01-2008, 04:35 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
  •