Results 1 to 12 of 12

Thread: Thinning down procedure

  1. #1
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Thinning down procedure

    Hey guys, I just spent like an hour making a WithdrawPick procedure. It turned out SUPER successful. It will withdraw a new pick within the first 2 seconds of opening the bank anywhere in the first screen so far. Its really nice IMO. One problem is its pretty FAT and I was wondering if there are shorter ways of doing this. It looks like a jumble to look at. I tested it a whole lot.

    SCAR Code:
    {*******************************************************************************
    procedure WithdrawPick;
    By: The[Cheese]
    Description: Will look in bank down each row for a DTM of a pickaxe. It will
                 withdraw the first one it comes to.
    *******************************************************************************}

    function WithdrawPick: boolean;
    var
      i1, i2, i3: integer;
      BY1, BY2, BX1, BX2: integer;
      PickDTM: integer;
    begin
      PickDTM := DTMFromString('78DA63E4666060E0614001060A6C0CAC409A1' +
           '188FF0301A31090C1C48006189148202D0524B809A86123C21C66' +
           '202149843904D4000068A204FC');
      i3 := 0;
      BY1 := 60;
      BY2 := 97;
      for i2 := 1 to 6 do
      begin
        if(i2 > 1)then
        begin
          BY1 := BY1 + 37;
          BY2 := BY2 + 37;
        end;
        BX1 := 71;
        BX2 := 118;
        for i1 := 1 to 8 do
        begin
          if(i1 > 1)then
          begin
            BX1 := BX1 + 37;
            BX2 := BX2 + 37;
          end;
          if(FindDTM(PickDTM, x, y, BX1, BY1, BX2, BY2))then
          begin
            Writeln('Withdrawing pick.');
            Mouse(x, y, 8, 8, true);
            wait(1000);
            if(FindDTM(PickDTM, x, y, MIX1, MIY1, MIX2, MIY2))then
            begin
              Result := True;
              Writeln('Withdrew Pick in row ' + inttostr(i2) + ' at column ' + inttostr(i1));
              FreeDTM(BankDTM);
              Exit;
            end;
          end;
        end;
      end;
      Writeln('Could not withdraw pickaxe.');
      Result := False;
      FreeDTM(BankDTM);
    end;

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    function WithdrawPick: boolean;
    var
      PickDTM, x, y, a, b: integer;
    begin
      PickDTM := DTMFromString('78DA63E4666060E0614001060A6C0CAC409A1' +
           '188FF0301A31090C1C48006189148202D0524B809A86123C21C66' +
           '202149843904D4000068A204FC');
      if(not(FindDtm(PickDTM, x, y, MSX1, MSY1, MSX2, MSY2))then exit;
      Mouse(x, y, 5, 5, True);
      if(not(FindDTM(PickDTM, a, b, MIX1, MIY1, MIX2, MIY2))then exit;
      Writeln('Withdrew pickaxe from row ' + IntToStr((y - 118) div 37) + ' and slot ' + IntToStr((x - 71) div 37));
      Result := True;
    end;
    If you really want to, you could then use a simple mathematical method to get the slot it was in, but there's really no point...
    Edit: Added it anyway...
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well the reason I have it go down each row and column in order is so that they put there best picks first. That way its always the best they can use getting picked. All they have to do is put their picks in order from greatest to least=]

  4. #4
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Well, yours goes to row 1 slot 1, row 1 slot 2 etc. Funnily enough, that is how Scar searches. it goes x1, y1, x1 + 1,y etc. then goes onto the next line below, so no need for the crap load of extra stuff. Of course, you could also check the UpText to make sure it is the best pick to use, but then you have to check all of them...
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  5. #5
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yah, but whats weird is that I tried doing a search like that and it skipped the ones at the top and got an iron one in some random spot. I'm super content with the way this one functions, im just wondering if there are ways to shorten it. Like little shortcuts to code.

  6. #6
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    It shouldn't skip the top ones. If it does, then your DTM may not have enough reference points. Other than that, there isn't really any way to shorten it by a lot, but this is about as short I can get it:
    SCAR Code:
    {*******************************************************************************
    procedure WithdrawPick;
    By: The[Cheese]
    Description: Will look in bank down each row for a DTM of a pickaxe. It will
                 withdraw the first one it comes to.
    *******************************************************************************}

    function WithdrawPick: boolean;
    var
      PickDTM, x, y, i: Integer;
    begin
      PickDTM := DTMFromString('78DA63E4666060E0614001060A6C0CAC409A1' +
           '188FF0301A31090C1C48006189148202D0524B809A86123C21C66' +
           '202149843904D4000068A204FC');
      while  i < 48 do
      begin
        Result := FindDTM(PickDTM, x, y, 70 + ((i div 6) * 37), 71 + ((i mod 8) * 37), 107 + ((i div 6) * 37), 108 + ((i mod 8) * 37));
        if Result then
        begin
          Mouse(x, y, 5, 5, True);
          Wait(250 + Random(500));
          if not FindDTM(PickDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
            Continue;
          FreeDtm(PickDTM);
          Writeln('Pick axe found at row ' + IntToStr((i div 6) + 1) + ' and slot ' + IntToStr((i mod 8) + 1));
          exit;
        end;
        Inc(i);
      end;
      FreeDtm(PickDTM);
    end;

    Offers little readability but very minimalistic code. Also, if it finds the DTM in the bank screen but doesn't withdraw it, then it repeats the check for the same slot.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  7. #7
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well if there isnt much we can do don't worry about it =] Thanks for all ur effort though

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

    Default

    SCAR Code:
    Mouse(x, y, 5, 5, True);
          Wait(250 + Random(500));
          if not FindDTM(PickDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
            Continue;

    you do kow that if he has more than one pick it'll still find it although you withdrew it right?

    ~RM

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

  9. #9
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    I was just shortening his original code, so his would've done that as well
    I'm not here to make new code, just break the existing stuff
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  10. #10
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Actually mine doesnt do that.... look it has an exit; Trust me i have like every type of pick, it only gets one

  11. #11
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Mine has an exit as well, my continue is when it does find the pick in the bank but not in the inventory... Anyway, what's wrong with my code? Isn't it short enough for you
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  12. #12
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    :P way to short for me XD. I'm just afraid to change it because my is working so perfect for me XD

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Procedure TypeSendRandom & Procedure AutoResponder!
    By Ultra in forum Research & Development Lounge
    Replies: 12
    Last Post: 01-08-2008, 07:04 PM
  2. Help with Procedure
    By Esteban in forum OSR Help
    Replies: 8
    Last Post: 07-06-2007, 03:45 AM
  3. Need help with Procedure
    By Venom666 in forum OSR Help
    Replies: 3
    Last Post: 07-05-2007, 10:03 PM
  4. Replies: 8
    Last Post: 05-24-2007, 11:57 PM
  5. Procedure that calls random procedure?
    By Secet in forum OSR Help
    Replies: 2
    Last Post: 03-03-2007, 03:56 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
  •