Results 1 to 6 of 6

Thread: Bitmap Help.

  1. #1
    Join Date
    May 2009
    Posts
    54
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Bitmap Help.

    SCAR Code:
    program PracticeBitmap;
    {.include SRL/SRL.Scar}

    Var
      Bitmap_Tinderbox, Bitmap_WillowLog : Integer;

    Procedure DeclareBitmaps;
    Begin
      Bitmap_Tinderbox := BitmapFromString(35, 35, 'beNrtlu9LU1EYx9c' +
           'LS23vqrcaoaFvGuIPVDJ/jHQwG5szTYdOZZnKGMMyG1Pnj1mtECH8' +
           'f/UDX3i4bLkdp9YLvTxc7j3n3Ofz/DrPuefn99f/vXy+Bya3pxnp7' +
           '+sZHhp8GxyJhEM3wjLN6ESzKY9H383Eo9xD48FrgqQfVagNh8alfO' +
           '791OL8LJL4MI3EImG4dYOEQI9s5mFpYW4lmfi4vIDwgDDCLPT6QEJ' +
           'ID4La9dWV9Foqs7GK8IwwK48EGhsZ6u3ucmcJgc5PqSXu2fTaZmYD' +
           '2cqmEV4RpmQDFGKoqAJypAiBTlShc/tzJreVzW9v7ua+cOcVkTs4C' +
           'AV3oOAOCXIvOZaZ2kL+68HOt6O9HMIDrwxigFG8QUPcNxHLpPl4P/' +
           '/jcLdULPz+fsCdV8ZxxCjeoGEVjjNI6NxB2IxONIOABVSO4KZSo6z' +
           'hzky4ORF9nIz7U7N+sRi/UujQjH5RgJZRsHwy2CSJTTQLxyfGYou5' +
           'sMwpo6gAFLSJN42SShbLjOXYHMTCSNkJZXSg0cRYhjMWjqsmYdXct' +
           'syyTCsR4vC65xFyGasMh+MYSQafPX2CVGExRS5YTEXRMAOdDb2Bh5' +
           'Wsv+JgKZsU5PPWlva2F9VB+E6CuFO6gLysmjgVDEZ2drzsCryqDsK' +
           'q019FEsRXbA1HlsrS2kXNdscsBXB2WmIfUXV8yNYQ6DIWCNvIahR0' +
           'JM7BmiAo5OjPyU+2ElACTrlWshCUq/IJl7e7qh05NlU6DwEkWWov6' +
           'gZ2XjCiTu7t4bhDqBHHPWs4KARQrbWsP+iwMAOgoJ8RnbZXPc3Vji' +
           'p7kTJiTY/TweJW34+QSh3l+EWbtYZmTQ+EZeQ6P1p8iDtkynsGyXK' +
           'OUapRvfoGf66stSpueETT+Af/ireBuL/u1nUBwN7cMw==');
      Bitmap_WillowLog := BitmapFromString(35, 35, 'beNrtlk9Lw0AUxOs' +
           'nEBURUaqnXtRDEC2WYpWKIj20oPgPURRFEQqe/Pp1YGB47Osum5De' +
           'ssyhJOn77ey+2WQ2a0Yzahyt1pLV4hB7neVif6VbrPWP1897G7WzU' +
           'FD1R8Oty8EmVAEULIgXao6vtoGwKgtiHUwVwpwxc00e00ZBILzKgv' +
           'Dk22P34/nk571/O2pTvqxu6S5Bu+3VTBYe+/0+ox7GO55lEVYEwXU' +
           '1kGVJvG4lUKmlE2j6eWpZvr4Ep9i+fDsxUEJcVdpBw+TEVq0rkF3A' +
           'WH3Gh/0JTa4PLgadBAu3GDooQVFjCEHxj0yTkutxuPJ0c4iFUvRIs' +
           'R3OWPmyipX20c4kYDE7AKHy12uPfyRFc/YI3/B+VT3obzqkBYGQ2Z' +
           'e7o+CQ8RZ8z6dBajOByAUultBYstIg1CQIP2gnlqac8CZAMGJBtvE' +
           'SoLLhZTMIBDs5juZ2PnubZ/7cNJEFXxBc30+KuedDYuuhzNd68Fgs' +
           'tvY8D4pXe1NbRzKlV0+NXyO250mpt75n0cjivqaCjWu+YJtRz/gHf' +
           'kN4MQ==');
    End;

    Procedure FindBitmap;
    Begin
      If FindBitmap(Bitmap_Tinderbox, Bitmap_Tinderbox.X, Bitmap_Tinderbox.Y) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(Bitmap_Tinderbox.X, Bitmap_Tinderbox.Y);
        Wait(250 + Random(250));
        ClickMouse(Bitmap_Tinderbox.X, Bitmap_Tinderbox.Y, True);
        Wait(250 + Random(250));
      End;
      If Not FindBitmap(Bitmap_Tinderbox, Bitmap_Tinderbox.X, Bitmap_Tinderbox.Y) Then
      Begin
        WriteLn('Could not find tinderbox.');
        TerminateScript;
      End;
      If FindBitmap(Bitmap_WillowLog, Bitmap_WillowLog.X, Bitmap_WillowLog.Y) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(Bitmap_WillowLog.X, Bitmap_WillowLog.Y);
        Wait(250 + Random(250));
        ClickMouse(Bitmap_WillowLog.X, Bitmap_WillowLog.Y, True);
        Wait(250 + Random(250));
      End;
      If not FindBitmap(Bitmap_WillowLog, Bitmap_WillowLog.X, Bitmap_WillowLog.Y) Then
      Begin
        WriteLn('Could not find logs.');
        TerminateScript;
      End;
    End;

    Procedure BitmapLoop;
    Begin
      DeclareBitmaps;
      FindBitmap;
    End;

    Begin
      SetupSRL;
      ActivateClient;
      BitmapLoop;
    End.

    Code:
    Line 43: [Error] (16800:44): Semicolon (';') expected in script

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

    Default

    scar Code:
    Bitmap_Tinderbox.X, Bitmap_Tinderbox.Y
    Bitmap_Tinderbox isn't a TPoint, therefore it gives you errors. You would have to declare another variable(can be a TPoint or XY) and use it with FindBitmap. I would also recommend you to use smaller bitmaps if you are going to add them into a script. Finally you should use FindBitmapTolerance if you want the bitmap to work every time it's called. And for inventory items you could use DTM's since they are more used in that case


  3. #3
    Join Date
    May 2008
    Location
    Canada
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    You cannot call a procedure "FindBitmap" it's already a pre-made statement. You have errors in your script regarding syntax. Some of your logic and stuff are also not the most efficient, but i'll leave it to your to fix those. I just made your script compile. Here's a fixed version. Compaire urs and mine=).

    SCAR Code:
    program PracticeBitmap;
    {.include SRL/SRL.Scar}

    Var
      Bitmap_Tinderbox, Bitmap_WillowLog,x,y : Integer;// Must declare a x or y to use.
    //The one you had before is just a longer version of the x & y. + you didn't declare them ^^'

    Procedure DeclareBitmaps;
    Begin
      Bitmap_Tinderbox := BitmapFromString(35, 35, 'beNrtlu9LU1EYx9c' +
           'LS23vqrcaoaFvGuIPVDJ/jHQwG5szTYdOZZnKGMMyG1Pnj1mtECH8' +
           'f/UDX3i4bLkdp9YLvTxc7j3n3Ofz/DrPuefn99f/vXy+Bya3pxnp7' +
           '+sZHhp8GxyJhEM3wjLN6ESzKY9H383Eo9xD48FrgqQfVagNh8alfO' +
           '791OL8LJL4MI3EImG4dYOEQI9s5mFpYW4lmfi4vIDwgDDCLPT6QEJ' +
           'ID4La9dWV9Foqs7GK8IwwK48EGhsZ6u3ucmcJgc5PqSXu2fTaZmYD' +
           '2cqmEV4RpmQDFGKoqAJypAiBTlShc/tzJreVzW9v7ua+cOcVkTs4C' +
           'AV3oOAOCXIvOZaZ2kL+68HOt6O9HMIDrwxigFG8QUPcNxHLpPl4P/' +
           '/jcLdULPz+fsCdV8ZxxCjeoGEVjjNI6NxB2IxONIOABVSO4KZSo6z' +
           'hzky4ORF9nIz7U7N+sRi/UujQjH5RgJZRsHwy2CSJTTQLxyfGYou5' +
           'sMwpo6gAFLSJN42SShbLjOXYHMTCSNkJZXSg0cRYhjMWjqsmYdXct' +
           'syyTCsR4vC65xFyGasMh+MYSQafPX2CVGExRS5YTEXRMAOdDb2Bh5' +
           'Wsv+JgKZsU5PPWlva2F9VB+E6CuFO6gLysmjgVDEZ2drzsCryqDsK' +
           'q019FEsRXbA1HlsrS2kXNdscsBXB2WmIfUXV8yNYQ6DIWCNvIahR0' +
           'JM7BmiAo5OjPyU+2ElACTrlWshCUq/IJl7e7qh05NlU6DwEkWWov6' +
           'gZ2XjCiTu7t4bhDqBHHPWs4KARQrbWsP+iwMAOgoJ8RnbZXPc3Vji' +
           'p7kTJiTY/TweJW34+QSh3l+EWbtYZmTQ+EZeQ6P1p8iDtkynsGyXK' +
           'OUapRvfoGf66stSpueETT+Af/ireBuL/u1nUBwN7cMw==');// Do you really need this much bitmap to
      Bitmap_WillowLog := BitmapFromString(35, 35, 'beNrtlk9Lw0AUxOs' +// find a specific object?
           'nEBURUaqnXtRDEC2WYpWKIj20oPgPURRFEQqe/Pp1YGB47Osum5De' +// The more you have,
           'ssyhJOn77ey+2WQ2a0Yzahyt1pLV4hB7neVif6VbrPWP1897G7WzU' +// the slower your script runs.
           'FD1R8Oty8EmVAEULIgXao6vtoGwKgtiHUwVwpwxc00e00ZBILzKgv' +
           'Dk22P34/nk571/O2pTvqxu6S5Bu+3VTBYe+/0+ox7GO55lEVYEwXU' +
           '1kGVJvG4lUKmlE2j6eWpZvr4Ep9i+fDsxUEJcVdpBw+TEVq0rkF3A' +
           'WH3Gh/0JTa4PLgadBAu3GDooQVFjCEHxj0yTkutxuPJ0c4iFUvRIs' +
           'R3OWPmyipX20c4kYDE7AKHy12uPfyRFc/YI3/B+VT3obzqkBYGQ2Z' +
           'e7o+CQ8RZ8z6dBajOByAUultBYstIg1CQIP2gnlqac8CZAMGJBtvE' +
           'SoLLhZTMIBDs5juZ2PnubZ/7cNJEFXxBc30+KuedDYuuhzNd68Fgs' +
           'tvY8D4pXe1NbRzKlV0+NXyO250mpt75n0cjivqaCjWu+YJtRz/gHf' +
           'kN4MQ==');
    End;

    Procedure LocateObjects; // Changed so script can work
    Begin
      If (FindBitmap(Bitmap_Tinderbox,x,y)) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(x, y);// This will get you banned. Use Mouse or MMouse + clickmouse
        Wait(250 + Random(250));
        ClickMouse(x, y,true); // You missed a parameter here.
        Wait(250 + Random(250));
      End;
      If Not FindBitmap(Bitmap_Tinderbox, x, y) Then // instead of a if not, try "end else".
      Begin
        WriteLn('Could not find tinderbox.');
        exit; // terminatescript wont work to what you want. Forums has the WHY.
      End;
      If FindBitmap(Bitmap_WillowLog, x,y) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(x, y);
        Wait(250 + Random(250));
        ClickMouse(x,y, True);
        Wait(250 + Random(250));
      End;
      If not FindBitmap(Bitmap_WillowLog, x, y) Then
      Begin
        WriteLn('Could not find logs.');
        exit;
      End;
    End;

    Procedure BitmapLoop;
    Begin
      DeclareBitmaps;
      LocateObjects;
    End;

    Begin
      SetupSRL;
      ActivateClient;
      BitmapLoop;
    End.
    Last edited by mrpickle; 06-03-2009 at 08:16 AM.

  4. #4
    Join Date
    May 2009
    Posts
    54
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay, I changed it a bit.

    SCAR Code:
    program PracticeBitmap;
    {.include SRL/SRL.Scar}

    Var
      TBx, TBy, LWx, LWy : Integer;

    Procedure FindBitmap;
    Begin
      If FindBitmap(BMP_Tinderbox, TBx, TBy) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(TBx, TBy);
        Wait(250 + Random(250));
        ClickMouse(TBx, TBy, True);
        Wait(250 + Random(250));
      End;
      If Not FindBitmap(BMP_Tinderbox, TBx, TBy) Then
      Begin
        WriteLn('Could not find tinderbox.');
        TerminateScript;
      End;
      If FindBitmap(BMP_Log_Willow, LWx, LWy) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(LWx, LWy);
        Wait(250 + Random(250));
        ClickMouse(LWx, LWy, True);
        Wait(250 + Random(250));
      End;
      If not FindBitmap(BMP_Log_Willow, LWx, LWy) Then
      Begin
        WriteLn('Could not find logs.');
        TerminateScript;
      End;
    End;

    Begin
      SetupSRL;
      ActivateClient;
      FindBitmap;
    End.

    Code:
    Line 9: [Error] (16766:40): Invalid number of parameters in script
    Last edited by Devoker; 06-03-2009 at 08:25 AM.

  5. #5
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  6. #6
    Join Date
    May 2009
    Posts
    54
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay, another problem. It Activate Client except the mouse doesn't move or anything.

    SCAR Code:
    program PracticeBitmap;
    {.include SRL/SRL.Scar}

    Var
      TBx, TBy, LWx, LWy : Integer;

    Procedure FindBMP;
    Begin
      If FindBitmap(BMP_Tinderbox, TBx, TBy) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(TBx, TBy);
        Wait(250 + Random(250));
        ClickMouse(TBx, TBy, True);
        Wait(250 + Random(250));
      End;
      If Not FindBitmap(BMP_Tinderbox, TBx, TBy) Then
      Begin
        WriteLn('Could not find tinderbox.');
        TerminateScript;
      End;
      If FindBitmap(BMP_Log_Willow, LWx, LWy) Then
      Begin
        Wait(250 + Random(250));
        MoveMouseSmooth(LWx, LWy);
        Wait(250 + Random(250));
        ClickMouse(LWx, LWy, True);
        Wait(250 + Random(250));
      End;
      If not FindBitmap(BMP_Log_Willow, LWx, LWy) Then
      Begin
        WriteLn('Could not find logs.');
        TerminateScript;
      End;
    End;

    Begin
      SetupSRL;
      ActivateClient;
      FindBMP;
    End.

    Code:
    [Runtime Error] : Exception: Access violation at address 00658451 in module 'scar.exe'. Read of address 736572AF in line 9 in script

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
  •