Results 1 to 11 of 11

Thread: FindAndUse

  1. #1
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FindAndUse

    Little function I made because I was bored / trying to learn arrays better and better

    SCAR Code:
    program New;
    {.include srl/srl.scar}

    {*************************}
    { FindAnd Use Function    }
    {*     by: Dumpin        *}
    {Description:
      Finds an Object and Uses it}

    {*************************}

    Function FindAndUse(Name : string; Color : TintegerArray; Tolerance: integer): boolean;
    var
     B,C, x, y, L : integer;
     FoundC : boolean;
    begin
      For B := 0 To High(Color) Do
      begin
        L := High(Color);
        For B := 0 To L Do
        begin
          if FindColorTolerance(x, y, Color[b], MIX1,MIY1, MIX2, MIY2, Tolerance) then
          begin
            FoundC := True;
            Break;
          end;
        end;
        if FoundC then
        begin
         mouse(x,y, 0, 0, False);
         if IsUpText(Name) then
         wait(100+ random(100));
         ChooseOption('se');
         C := C+1;
         Result := true;
        end;
      end;
    end;

    begin
    SetupSRL;
    wait(2000);
    FindAndUse('ey', [1410982], 10);
    end.


    Well basically It Finds / uses an Item in your inventory :P

    Fill in a part of the item name / the color(s) / tolerance and voilá

    SCAR Code:
    FindAndUse('ey', [1477031], 10);

    this can be edited for other options... do it if you want / PM me if you can't =D

    [22:20] <[-jesus-]> freddy, go uninstall yourself

  2. #2
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Good job, to avoid doing GetArrayLength(Color) - 1 use

    "For B := 0 To High(Color) Do"

    Also, to make the loop faster, make a new integer type var, and do like

    "L := High(Color);"

    and then "For B := 0 To L Do"

    That ways it doesn't have to count everytime

  3. #3
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    aahh nice updated it... can you tell me what High does?

    [22:20] <[-jesus-]> freddy, go uninstall yourself

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

    Default

    I like it , what if you did had there be a TStringArray like there is in FindObjCustom?
    Formerly known as Cut em2 it

  5. #5
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by cut em2 it View Post
    I like it , what if you did had there be a TStringArray like there is in FindObjCustom?
    yea but I didn't want to for some way rofl... well of for today ill go to bed

    Cya and post my topic full for tommorow =D

    [22:20] <[-jesus-]> freddy, go uninstall yourself

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

    Default

    Holy crap! Deja vu! I made something exactly like this, with exactly the same parameters...except it clicked on use, drop or wield then exited the procedure.
    [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]

  7. #7
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Lol....


    Dumpin, High(ArrayHere) is basically same as "GetArrayLength(ArrayHere) - 1"

  8. #8
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    Lol....


    Dumpin, High(ArrayHere) is basically same as "GetArrayLength(ArrayHere) - 1"
    ok, but why should I use that instead of GetArrayLength?

    [22:20] <[-jesus-]> freddy, go uninstall yourself

  9. #9
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    a) The L := High or GetArrayLength - 1 and then For B := 0 To L Do

    or

    b) High?


    A: a) Speed
    A: b) Leet

  10. #10
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok :P got it ^^

    [22:20] <[-jesus-]> freddy, go uninstall yourself

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

    Default

    If you don't mind Dumpin I'm gonna use your function for an include gathering. I will include Credits!!!
    Formerly known as Cut em2 it

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
  •