Results 1 to 15 of 15

Thread: using Bitmap?

  1. #1
    Join Date
    Sep 2006
    Location
    West U.S.
    Posts
    2,172
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default using Bitmap?

    i finally got some time to script but i cant get this to work...

    its for my fisher and its meant to find and click on the shopkeeper's head...

    however the mouse never moves and the script stops without any reason

    SCAR Code:
    program New;

    {.include srl/srl.scar}
    {.include srl/srl/skill/Fishing.scar}

    var
    Shopkeeper,x1,y1: integer;

    procedure Declareplayers;
      Begin

       HowManyPlayers :=2;
       NumberOfPlayers(HowManyPlayers);
       CurrentPlayer:=0;

       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;

       NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
     end;


    Procedure DeclareBitMaps;
    begin
      Shopkeeper:= BitmapFromString(8, 8, 'z78DA9D8F411203210804BF04C32078' +
           '8C26FEFF49615753B5E770E8F2D03803CD44DF4C23A4252728723' +
           '1C5173E9B9C1680DCF33437830E644C1F98D1BDE3F5F45DECA5E3' +
           'F8CB15ADF522B6B999D960EBFC8FEA934C4AA508F963B8B7F26F0' +
           'A48396313537DA76CD6AED5D6E0AAAC3B374723F5F881543D29C3' +
           'A2FC7ACA95D280F27AF57C73D9E95F7739E6DE7AD2830AD94C6BC' +
           '3BBFC355F40924ED3');
           
    end;


    procedure test1;
    begin
     FindBitMap(Shopkeeper, x1, y1)
     begin
       MMouse(x1,y1,2,2)
       wait(1000+(200))
       if(IsUpText('hop'))then
         begin
           Mouse(x1,y1,2,2,false)
           wait(500 + random(300))
           ChooseOption(x,y,'Trade')
           Wait(1000+random(200))
         end;
     end;
    end;



    begin
    SetupSRL;
    SetupSRLFishing;
    DeclarePlayers;
    NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
    Activateclient;
    If(Not(Loggedin)) then
    LoginPlayer;
    DeclareBitMaps;
    test1;

    end.


    Everytime i run it, it stops...

    what is the problem?

    or do i have to Functions in order for this to work?

    If you guys come up with a better procedure or function please share it!

    They are sisters...
    Runescape Classic

  2. #2
    Join Date
    Dec 2006
    Posts
    2,244
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    u have to use soemthing like findBMPS and ClickBMPS try useing the tut fun with bitmaps

  3. #3
    Join Date
    Sep 2006
    Location
    West U.S.
    Posts
    2,172
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    ok thanks alex

    They are sisters...
    Runescape Classic

  4. #4
    Join Date
    Jun 2006
    Location
    Tennessee, USA
    Posts
    2,603
    Mentioned
    1 Post(s)
    Quoted
    46 Post(s)

    Default

    try
    SCAR Code:
    if FindBitMap(Shopkeeper, x1, y1) then
    begin
    that should work

  5. #5
    Join Date
    Sep 2006
    Location
    West U.S.
    Posts
    2,172
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by mjordan View Post
    try
    SCAR Code:
    if FindBitMap(Shopkeeper, x1, y1) then
    begin
    that should work
    it compiles... but it doesnt look for the shopkeeper...

    it just ends there with my char in the shop....

    They are sisters...
    Runescape Classic

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

    Default

    Then it didn't find the bitmap. You should use something in the FindObject class for that.

  7. #7
    Join Date
    Jun 2006
    Location
    Tennessee, USA
    Posts
    2,603
    Mentioned
    1 Post(s)
    Quoted
    46 Post(s)

    Default

    Quote Originally Posted by bullzeye95 View Post
    Then it didn't find the bitmap. You should use something in the FindObject class for that.
    in your original you just had
    SCAR Code:
    FindBitMap(Shopkeeper, x1, y1)
     begin

    make sure you include the "if" and "then" and do what Bullzeye said. also try to find a really unique color of the shopkeeper since alot of things are about the same color around it.

  8. #8
    Join Date
    Sep 2006
    Location
    West U.S.
    Posts
    2,172
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    yeah i think im going to scrap this thing and go for findoject instead since the Bitmap might be to big

    btw, how do you add tolerence to the find object procedure?

    is it just findojecttolerence?

    They are sisters...
    Runescape Classic

  9. #9
    Join Date
    Jul 2006
    Location
    NY
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Take a look in the SRL manual, there are plenty of find object procedures. Find one that fits your needs.

  10. #10
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    You should use a normal findobj and the tolerance is just the color tolerance you have it set to look for.

  11. #11
    Join Date
    Sep 2006
    Location
    West U.S.
    Posts
    2,172
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by almost View Post
    You should use a normal findobj and the tolerance is just the color tolerance you have it set to look for.
    can you guys use an exemplary line?

    like, what do i put in it? i've never been too good at putting tolerance in my script

    They are sisters...
    Runescape Classic

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

    Default

    SCAR Code:
    For I:= 0 to 5 {or something smaller maybe...} do
        begin
          if(FindObj(x, y, 'the uptext', 0 {the color}, I {the tolerance}))then
            begin
              Mouse(x, y, 0, 0, true);
              break;
            end;
        end;

  13. #13
    Join Date
    Sep 2006
    Location
    West U.S.
    Posts
    2,172
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    nice...

    i think ill try that

    They are sisters...
    Runescape Classic

  14. #14
    Join Date
    May 2006
    Location
    West Coast
    Posts
    820
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by legendaryhero90 View Post
    i finally got some time to script but i cant get this to work...

    its for my fisher and its meant to find and click on the shopkeeper's head...

    however the mouse never moves and the script stops without any reason

    SCAR Code:
    program New;

    {.include srl/srl.scar}
    {.include srl/srl/skill/Fishing.scar}

    var
    Shopkeeper,x1,y1: integer;

    procedure Declareplayers;
      Begin

       HowManyPlayers :=2;
       NumberOfPlayers(HowManyPlayers);
       CurrentPlayer:=0;

       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;

       NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
     end;


    Procedure DeclareBitMaps;
    begin
      Shopkeeper:= BitmapFromString(8, 8, 'z78DA9D8F411203210804BF04C32078' +
           '8C26FEFF49615753B5E770E8F2D03803CD44DF4C23A4252728723' +
           '1C5173E9B9C1680DCF33437830E644C1F98D1BDE3F5F45DECA5E3' +
           'F8CB15ADF522B6B999D960EBFC8FEA934C4AA508F963B8B7F26F0' +
           'A48396313537DA76CD6AED5D6E0AAAC3B374723F5F881543D29C3' +
           'A2FC7ACA95D280F27AF57C73D9E95F7739E6DE7AD2830AD94C6BC' +
           '3BBFC355F40924ED3');
           
    end;


    procedure test1;
    begin
     FindBitMap(Shopkeeper, x1, y1)
     begin
       MMouse(x1,y1,2,2)
       wait(1000+(200))
       if(IsUpText('hop'))then
         begin
           Mouse(x1,y1,2,2,false)
           wait(500 + random(300))
           ChooseOption(x,y,'Trade')
           Wait(1000+random(200))
         end;
     end;
    end;



    begin
    SetupSRL;
    SetupSRLFishing;
    DeclarePlayers;
    NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
    Activateclient;
    If(Not(Loggedin)) then
    LoginPlayer;
    DeclareBitMaps;
    test1;

    end.


    Everytime i run it, it stops...

    what is the problem?

    or do i have to Functions in order for this to work?

    If you guys come up with a better procedure or function please share it!
    First of all your BMP is to big. Second of all you really shouldn't use bitmaps to find people, try using a color with a tolerance. You can also give my function a run :

    SCAR Code:
    Function FindNPC(var NPCx, NPCy : integer; Colors: Array Of integer; NPCName : string): boolean;
    var i : integer;
    begin
      MouseSpeed := 8;
      for i := 0 to GetArrayLength(Colors) do
      begin
        if (FindColorSpiralTolerance(NPCx, NPCy, Colors[i], MSX1, MSY1, MSX2, MSY2, 30)) then
        begin
          Mmouse(NPCx, NPCy, 0, 0);
          Wait(10);
          if (IsUpText(NPCName)) then
          begin
            Result := True;
            Break;
          end;
        end;
      end;
      MouseSpeed := DefaultMS;
    end;

    If you need help using it PM me and post here.

  15. #15
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I'll try to give you a good idea of how the tolerance is. I would usually use 5-10. Around 15-20 would be a pretty big tolerance and 1-5 is for really close colors (like automining rocks) There are also procedures that start at a low tolerance, and if the color isn't found it raises the tolerance and searches again. This way you don't start with a huge tol and and up with a color you don't want.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find Bitmap in Bitmap file
    By fORCE_wORKS in forum RS3 Outdated / Broken Scripts
    Replies: 8
    Last Post: 12-13-2007, 11:04 PM
  2. Bitmap
    By whales in forum OSR Help
    Replies: 4
    Last Post: 12-20-2006, 12:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •