Results 1 to 11 of 11

Thread: Counting In Inv

  1. #1
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Counting In Inv

    I'm making a chicken killer but how would i go about counting how many feathers has it picked up? i read Munks function but i don't understand it so there's no point in it if i don't understand how it works
    Thx

    ~Spaz

  2. #2
    Join Date
    Nov 2007
    Location
    Nowhereville
    Posts
    1,155
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    function FindInventoryText(txt: string): Boolean;

    I hope this helps

    Cut em2 it
    Formerly known as Cut em2 it

  3. #3
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I'd use GetInvItemBounds(InvSpot: Integer; Var T: TBox): Boolean; for the inv spot the feathers are in (which you can find with like a BMP or DTM) and get the number in that box.

  4. #4
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok so would the usage be like
    SCAR Code:
    GetInvItemBounds(1: Integer??; Var T: TBox): Boolean;
    without sounding stupid, i don't get what vars and TBox i need to enter??
    thanx for your help,

    ~Spaz

  5. #5
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I meant like making a function like this:
    SCAR Code:
    Function CountInvSpot(InvSpot: Integer): Integer;
    var
      Box: TBox;
    begin
      GetInvItemBounds(InvSpot, Box);
      try
        Result := StrToInt(GetTextAtEx(box.x1, Box.y1, 10, tradeChars, False, False, 0, 2, 65535, 8, False, tr_Digits));
      except
        Result := 0;
      end;
    end;
     
     
    begin
      CountInvSpot(1);
      CountInvSpot(4);
      CountInvSpot(5);
    end.

    Although it doesn't seem to work for some reason??...
    And I can't figure out why...

  6. #6
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    tr_Digits
    should be numberchars or something like that...don't rememeber exactly...

    Edit:Statchars not tradechars, also im not sure but x1 and y1 isn't right I think...they should be exact coords where text begins...
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  7. #7
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I thought it was AlphaNumericChars.
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  8. #8
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Santa_Clause View Post
    I thought it was AlphaNumericChars.
    Yeh, you're right
    tr_AlphaNumericChars
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  9. #9
    Join Date
    Dec 2007
    Posts
    103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What about AmountColor, AmountBmp, or AmountDTM?

    Code:
    AmountColor('Inventory',color,tol);
    This sentence is false.

  10. #10
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Function CountFeather : Integer;
    var
      Fether, Fether2, ax, ay : Integer;
    begin
        Fether:= DTMFromString('78DA63E46562605067644001EA0C0C5C400A2' +
                '4FA1F0818416AD450D56C5BBD0AAE0604C06A3450D59C3C781045' +
                '0D00F3EE0943');
        Fether2:= DTMFromString('78DA63DCC7C8C0A001C44860EBAA550C5C401' +
             'A24FA1F08180F01599AA86A18D418E06A408011648E16AA9A433B' +
             '77A0A80100CAC20B42');
        If (FindDTM(Fether,x ,y , MIX1, MIY1, MIX2, MIY2))
        or (FindDTM(Fether2,x ,y , MIX1, MIY1, MIX2, MIY2)) then
        GetMousePos(ax, ay);
        B := StrToInt(GetTextAtEx(ax, ay, 5, StatChars, False, False, 0, 2, 65535, 8, False, tr_AlphaNumericChars));
        FreeDTM(fether);
        FreeDTM(fether2);
    end;

    I tried that Would it work,? because i couldn't get the otehr one to work,
    its more or less the same but i used my feather DTM's to find the feathers in the Invent slot

    Would that work?
    ~Spaz

    EDIT
    Insted of making another post, my attack function has no stopped working
    SCAR Code:
    Procedure AttackChicken;
    var
      p, g, a, i: Integer;
      ChickenColor: Array [0..4] of Integer;
    begin
      if not (InFight(x, y))
      and not (FindFeather) then
      begin
        If (TimeFromMark(g) < 7000) or (TimeFromMark(a) < 7000) then exit;
        ChickenColor[0] = 1055613;
        ChickenColor[1] = 8299963;
        ChickenColor[2] = 1055621;
        ChickenColor[3] = 2841210;
        ChickenColor[4] = 3706527;
        For I := 0 to 4 do
        If (FindColorTolerance(x, y, ChickenColor[i], MSX1, MSY1, MSX2, MSY2, 5)) then
        begin
          MMouse(x, y, 1, 1);
          If IsUptextMulti('cken','hicken','chic') then
          begin
            Mouse(x,y,1,1, false);
            chooseoption('tack')
            MarkTime(g);
            If (Debug) then Writeln('Killing Chicken');
            FindNormalRandoms;
            AntiLog;
            Chick := Chick + 1
            Chickens := Chickens + 1
            FindNormalRandoms;
            if not(InFight(x, y)) then
            exit;
          end;
        end;
        If not(FindColorTolerance(x, y, ChickColor[i], MSX1, MSY1, MSX2, MSY2, 5)) then
        begin
          If (Debug) then Writeln('Increasing Tol');
          for p := 1 to 10 do
          If (FindColorTolerance(x, y, ChickColor[i], MSX1, MSY1, MSX2, MSY2, p)) then
            MMouse(x, y, 2, 2);
            Wait(200+Random(50));
            If (TimeFromMark(g) < 7000) or (TimeFromMark(a) < 7000) then exit;
            If IsUptextMulti('cken','hicken','chic') then
               Mouse(x,y,1,1, false);
               chooseoption('tack')
            If (Debug) then Writeln('Killing Chicken');
               MarkTime(a);
               findnormalrandoms;
            if Debug  then Writeln(' Found chicken with Tol of ['+IntToStr(p-1)+']')
         end;
         If not (FindColorTolerance(x, y, ChickColor[i], MSX1, MSY1, MSX2, MSY2, p)) then
         if Debug  then Writeln(' No chickens here, look elsewhere')
         if R < 6 then
           Relocate;
           If Debug then Writeln('Relocated #['+IntToStr(R)+']times')
         if R >= 6 then
         NextPlayer(False)
        end;
        If FindBlackChatMessage('omeone') then exit;
        ftwait(6);
    end;

    i get this error
    SCAR Code:
    Failed when compiling
    Line 171: [Error] (12798:17): Assignment expected in script
    line 171 is ChickenColor[0] = 1055613;

    it worked before and now i put in the countfeathers it doesn't work, but even after i take it out it still gives me that error and i have no idea why.

    Thanks for all your help

    ~Spaz

  11. #11
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Function CountFeather : Integer;
    var
      Feather, x, y, B : Integer;
    begin
      Feather:= DTMFromString('78DA63E46562605067644001EA0C0C5C400A2' +
                '4FA1F0818416AD450D56C5BBD0AAE0604C06A3450D59C3C781045' +
                '0D00F3EE0943');
      Gametab(4);
      Wait(500);
      If (FindDTM(Feather,x ,y , MIX1, MIY1, MIX2, MIY2)) then
      Try
        B := StrToInt(GetTextAtEx(x-numberx, y-numbery, 5, StatChars, False, False, 0, 2, 65535, 8, False, tr_AlphaNumericChars));
        Except writeln('Could not get feather amount');
      end;
      Result := B;
      FreeDTM(feather);
    end;
    x-numberx, y-numbery:
    See, you need x1 and y1 where text starts, only you know where is dtm centrepoint, you can set it...

    Edit:
    SCAR Code:
    ChickenColor[0] = 1055613;
    to
    SCAR Code:
    ChickenColor[0] := 1055613;
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Counting
    By Smarter Child in forum OSR Help
    Replies: 3
    Last Post: 03-04-2009, 11:14 PM
  2. Counting runes
    By trojan in forum OSR Help
    Replies: 7
    Last Post: 02-10-2009, 10:13 PM
  3. Counting Inv?
    By Prince in forum OSR Help
    Replies: 3
    Last Post: 02-17-2008, 07:46 PM
  4. Counting Kebabs
    By The Claw in forum OSR Help
    Replies: 9
    Last Post: 05-06-2007, 11:21 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
  •