Results 1 to 8 of 8

Thread: [Runtime Error] : Exception: Can't allocate the DIB handle in line 436 in script

  1. #1
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default [Runtime Error] : Exception: Can't allocate the DIB handle in line 436 in script

    Code:
    program tanner;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/reflection/reflection.scar}
    var
      x, y, hidedtm : integer;
    
    procedure DeclarePlayers;//add more if needed
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name       := '';
      Players[0].Pass       := '';
      Players[0].Nick       := 'ham';
      Players[0].Active     := True;    // Use this account?
      Players[0].strings[0] := 'soft'; // soft or hard leather
      Players[0].Pin        := ''// bank pin lave if none
      Players[0].BoxRewards := ['XP', 'ostume', 'mote', 'Gem', 'ithril', 'oal'];
    end;
    
    procedure loaddtm;
    begin
        Hidedtm:= DTMFromString('78DA638C60606048624001FBB66E611004D28' +
           'C40FC1F08182B808C7854351B972D05D38C503E632E90A84155B3' +
           '7DCD1A54357E40A21A55CDA9C38750D5B802894854358776EE445' +
           '5930824BC50D5AC9A3717554D3190084455B361C91214350093D2' +
           '17FE');
    end;
    
    
    procedure findtanner; forward;
    
    function InMenu: Boolean;
    var
      c: Integer;
    begin
      if (CountColor(0, MSX1, MSY1, MSX2, MSY2) > 3292486) then
      begin
        MouseBox(26, 138, 489, 157, 1);
        c := GetTimeRunning + 45000;
        while (not InMenu) and (GetTimeRunning < c) do
          Wait(50);
        Wait(RandomRange(100, 150));
      end;
      Result := FindTextTPAEX(2070783, 20, 177, 46, 138, 32, x, y, 'What', upchars, Nothing);
    end;
    
    
    procedure InTanMenu;
    begin
      repeat
        wait(1);
        findnormalrandoms;
      until(InMenu)
      mouse(94, 101, 13, 13, false);
      waitforoption('All', 5000);
      r_chooseoption('All');
    end;
    
    
    procedure FindTanner;
    var
      NPCC: TNPC;
      TanPoint: TPoint;
    begin
      If(FindNPC('Ellis',NPCC))then
      begin
        writeln('Found the Tanner! Attempting to click');
        TanPoint := TileToMS(NPCC.Tile, Random(5));
        mouse(TanPoint.x,TanPoint.y,2,2,false);
        WaitForOption('rade', 5000);
        wait(10 + random (2));
        chooseoption('rade');
      end;
    end;
    
    {*******************************************************************************
    procedure R_Withdraw(Item : Variant; Amount : Integer);
    By: Infantry001
    Description: Withdraw Amount of Item. Item can be either ID or Name.
    *******************************************************************************}
    procedure R_Withdraw(Item : Variant; Amount : Integer);
    var
      I, BankSlot : Integer;
      BBox : TBox;
      Items : TBankSlotArray;
    begin
      if not R_BankScreen then exit;
      Items := GetBankArray;
      case VarType(Item) of
        3:   for I := 0 to High(Items) do
             begin
               if (Items[i].ID = Integer(Item)) then
               begin
                 BankSlot := Items[i].Index + 1;
                 break;
               end;
             end;
        256: for I := 0 to High(Items) do
             begin
               if (Items[i].Name = Item) then
               begin
                 BankSlot := Items[i].Index + 1;
                 break;
               end;
             end;
      end;
      BBox := BankIndexToMSBox(BankSlot);
      If Amount = 1 Then
      Begin
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 1);
        Wait(RandomRange(50, 150));
      End
      Else
      Begin
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
        if (Amount = 5) or (Amount = 10) then
          R_ChooseOption('Withdraw-' +IntToStr(Amount))
        else if Amount = 0 then
          R_ChooseOption('Withdraw-All')
        else
        if not R_ChooseOption('Withdraw-'+IntToStr(Amount)+' ') then
        begin
          MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
          if (R_ChooseOption('Withdraw-X')) then
          begin
            Wait(1000 + Random(100));
            TypeSend(IntToStr(Amount));
          end;
        end;
      end;
    end;
    
    procedure banking;
    begin
      R_OpenBankBooth('akb');
      repeat
        wait(1)
        findnormalrandoms;
      until (R_Bankscreen) or (R_Pinscreen);
      if R_Pinscreen then Inpin(Players[CurrentPlayer].Pin);
      R_MouseItemID(1742,  'All');
      wait(100 + random (10));
      R_Withdraw(1739, 27);
    end;
    
    procedure writepos;
    var
      myposition: TPoint;
    begin
      MyPosition := GetMyPos;
      writeln('Our tile is: '+inttostr(MyPosition.x)+','+inttostr(MyPosition.y));
    end;
    
    function TanneryWalkPath:TPointArray;
    begin
      setlength(result,3);
      result[0] := point(3277,3174);
      result[1] := point(3282,3184);
      result[2] := point(3275,3191);
    end;
    
    function InBank: boolean;
    var
      PlayerPosition : Tpoint;
    begin
      PlayerPosition := GetMyPos;
      if PointInBox(PlayerPosition , IntToBox(3269,3165, 3271,3170)) then
      begin
      result := true;
        writeln('You are in the bank!');
      end else
      writeln('Not in bank relocating');
    end;
    
    Procedure TanneryWalk;
    var
      i :integer;
      path : tpointarray;
      realigntile : Tpoint;
    begin
      If(Not(Inbank))then
      begin
        realignTile := Point(3270, 3167);
        WalkToTile(realignTile, 2, 1);
      end;
      path := tannerywalkpath;
      For I := 0 to High(path) do
      Begin
        If (WalkToTile(path[i], 2, 1)) Then
        R_Flag;
        R_FindRandoms;
        FindNormalRandoms;
        Wait(550+Random(300));
      end;
    end;
    
    function BankWalkPath:TPointArray;
    begin
      setlength(result,3);
      result[0] := point(3282,3182);
      result[1] := point(3276,3167);
      result[2] := point(3269,3167);
    end;
    
    Procedure BankWalk;
    var
      i :integer;
      path : tpointarray;
    begin
      path := bankwalkpath;
      For I := 0 to High(path) do
      Begin
        If (WalkToTile(path[i], 2, 1)) Then //  error line
        R_Flag;
        R_FindRandoms;
        FindNormalRandoms;
        Wait(550+Random(300));
      end;
    end;
    
               
    
    begin
      Smart_server := 101;
      Smart_signed := true;
      Setupsrl;
      Setupreflection;
      activateclient;
      Declareplayers;
      Loginplayer;
      //writepos;
      //Banking;
      //Tannerywalk;
      FindTanner;
      intanmenu;
      BankWalk;
    end.
    it get that error when it does inmenu it opens up the text script btw so i think its in there not sure though could be doing something else worng

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    There is no line 436, please go into more detail so we can help you.

  3. #3
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    the line 436 is in the TEXT.scar it runs fine until it gets to that functions then it opens up the TExt.scar and give me that error

    so i might be text.scar or its something im doing wrong in the setup of FindTextTPA

  4. #4
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    You messed up with FindTextTPAEx. Yours is this:
    SCAR Code:
    Result := FindTextTPAEX(2070783, 20, 177, 46, 138, 32, x, y, 'What', upchars, Nothing);
    It should be this:
    SCAR Code:
    Result := FindTextTPAEX(2070783, 20, 138, 32, 177, 46, x, y, 'What', upchars, Nothing);

    Your start values must always be smaller than your end values.

  5. #5
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Just so you understand how those x1, y1, x2, y2 search boxes work... the x1, y1 is the top left point of the box to search and x2, y2 is the bottom right point.

  6. #6
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Just so you understand how those x1, y1, x2, y2 search boxes work... the x1, y1 is the top left point of the box to search and x2, y2 is the bottom right point.
    Not points..co-ordinates..

  7. #7
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Points have coordinates...so they can be called points too.

  8. #8
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    Not points..co-ordinates..
    I said "points" because a point is made up of and x and a y coordinate. since I was always talking about an x and a y coord, I called them points.

    Sorry for any confusion.

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
  •