Results 1 to 7 of 7

Thread: Some New/Modified functions.

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

    Default 4 New and 1 Modified function.

    ContinueFunc

    Clicks Continue until the continues dissapear.. Made by Danrox2004
    SCAR Code:
    function ContinueFunc(): boolean;begin
      if (ClickToContinue) then
      begin
        result:=true
        repeat
          wait(1000 + random(1000));
        until (not ClickToContinue)
      end else
        Result := false;
    end;

    Check4Head

    Checks for a color in the left of the chat box suggesting the face of an npc might be there which means you are talking to an NPC. Made by Danrox2004
    SCAR Code:
    function Check4Head(color: integer): boolean;
    begin
      Result:=FindColorTolerance(x, y, color, MCX1, MCY1, MCX2, MCY2, 15)
    end;

    TalkToNPC

    Function used alot in my tutorial island script. Description below. Made by Danrox2004.
    SCAR Code:
    function TalkToNPC(Color: integer; Head: integer): boolean;
    begin
      Time := 0;
      MarkTime(Time);
      repeat
        repeat
          SendArrowSilentWait(1, 1000 + random(1000));
          wait(500 + random(1000));
            if (TimeFromMark(Time) > (60000)) then
              break;
        until (FindObjMultiText(x, y, 'Talk-to', 'Talk', '-to', Color, 15))
          if (TimeFromMark(Time) > (60000)) then
            NextChar;
          mouse(x, y, 10, 10, true);
        Flag;
        wait(1000 + random(1000));
      until (Check4Head(Head))
        ContinueFunc;
      Result := true;
    end;

    This is a function I used alot during my Tutorial Island Script.

    It is very useful because it is fairly fast. It finds NPC's based on a color and clicks on it if Talk is in the top left. It then checks that it is talking to the NPC by checking for a specific color in the text window, where the NPC's face should be. It then Clicks to continue until Click to continue disappears.

    If it doesn't find Talk-to in the top left or cannot find the face of the NPC in the chat box then it looks again for the NPC, for up to 60 seconds. If it cannot find it it returns false.

    I have only tested this on tutorial island and it works very well.


    I had some free time and decided to modify some procedures which searched for more then one thing and make them arrays so they search for as many things as they want.

    None of these have been tested sorry

    Thanks for xxKanexx for showing how to do arrays in functions.

    FindBitmapsProgressiveTol
    Credits go to Stupid3000 for origional function.
    SCAR Code:
    {*******************************************************************************
    function FindBitmapsProgressiveTol(Bmp: array of Integer;tolmax, step, xs, ys, xe, ye: Integer): Boolean;
    By: Stupid3000
    Description: Finds any of maximum 5 bitmaps in box specified by xs,ys,xe,ye.
    If you only need to find one bitmap, fill in 0 for others.
    *******************************************************************************}

    function FindBitmapsProgressiveTol(Bmp: array of Integer; tolmax, step, xs, ys, xe, ye: Integer): Boolean;
    var //by Stupid3ooo
      c, i: Integer;
    begin
    for i:= 0 to GetarrayLength(Bmp)-1 do
     begin
      while (c < tolmax) do
      begin
        c := c + step;
        if (Bmp[i] > 0) then
        begin
          if (FindBitmapSpiralTolerance (Bmp[i], x, y, xs, ys, xe, ye, c)) then
          begin
            Result := True;
            break;
          end;
        end;
       end
      end;
    end;


    DropMulti
    SCAR Code:
    {*******************************************************************************
    procedure DropMulti(I: Array of Integer);
    By: Danrox2004
    Description: Drops all except item(s) specified by inventory number(s).
    *******************************************************************************}

    procedure DropMulti(a: array of Integer);
    var
      InvSpot, i: integer;
    begin
      for InvSpot := 1 to 28 do
      begin
        for i:= 0 to GetarrayLength(a)-1 do
        begin
          if(InvSpot = a[i]) then
            If(ItemExists(InvSpot) then DropItem(InvSpot)
        end
      end
    end;

  2. #2
    Join Date
    Apr 2006
    Location
    I live in NH
    Posts
    611
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice work!

    Hey by the way, you can shorten some of your functions. I'm not sure if it makes a difference in speed, but it makes a difference in lines.

    Code such as this:
    Code:
    if(FindDan)then
    begin
      PokeDan;
    end else
    begin
      KeepLooking;
    end;
    Can be shortened to this:
    Code:
    if(FindDan)then
      PokeDan
    else
      KeepLooking;
    This type of thing only works when there is only 1 statement. Notice the first statement "PokeDan" does not end in a comma. You have to do that for the first one if you're going to exclude the begin and end and only if it's 1 line being executed. You couldn't do this.
    Code:
    if(FindDan)then
      PokeDan;
      PokeAgain
    else
      KeepLooking;
      EatASnack;
    Hope that helps. Again, nice work. Did the devs add your function?

    ~Ron

  3. #3
    Join Date
    Oct 2006
    Posts
    207
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah thanks Ron, I'll keep that in mind. I dont think the devs did add this, i don't think its what the devs are looking for

  4. #4
    Join Date
    Apr 2006
    Location
    I live in NH
    Posts
    611
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh that's too bad.

    Hey danrox! You didn't listen to me.

    Code:
    function Check4Head(color: integer): boolean;
    begin
      if (FindColorTolerance(x, y, color, MCX1, MCY1, MCX2, MCY2, 15)) then
        Result := true;
      else
        Result := false;
    end;
    should be this:
    Code:
    function Check4Head(color: integer): boolean;
    begin
      if (FindColorTolerance(x, y, color, MCX1, MCY1, MCX2, MCY2, 15)) then
        Result := true
      else
        Result := false;
    end;
    lol. The statement right before the else can not have a semicolon after it, or it errors out. Just wanted to point that out if you ever put this in your future scripts.

  5. #5
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Or it could just be
    SCAR Code:
    function Check4Head(color: integer): boolean;
    begin
      Result:= FindColorTolerance(x, y, color, MCX1, MCY1, MCX2, MCY2, 15);
    end;

  6. #6
    Join Date
    Oct 2006
    Posts
    207
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Ron View Post
    Oh that's too bad.

    Hey danrox! You didn't listen to me.

    Code:
    function Check4Head(color: integer): boolean;
    begin
      if (FindColorTolerance(x, y, color, MCX1, MCY1, MCX2, MCY2, 15)) then
        Result := true;
      else
        Result := false;
    end;
    should be this:
    Code:
    function Check4Head(color: integer): boolean;
    begin
      if (FindColorTolerance(x, y, color, MCX1, MCY1, MCX2, MCY2, 15)) then
        Result := true
      else
        Result := false;
    end;
    lol. The statement right before the else can not have a semicolon after it, or it errors out. Just wanted to point that out if you ever put this in your future scripts.
    Oops.. Sorry Ron. Will go with Bullzeye's tho because its shorter :P

  7. #7
    Join Date
    Apr 2006
    Location
    I live in NH
    Posts
    611
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Ooooo nice one bullzeye, I didn't realize it returned a boolean. I was concentrating more on the ifs lol.

    Hey whatever is better man. Don't appologize.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. HyperSecret's - SecretFighter - Modified by Nerexis!
    By Nerexis in forum First Scripts
    Replies: 18
    Last Post: 08-01-2009, 01:41 AM
  2. WeStealTea - Modified by Shynie!
    By shynie in forum RS3 Outdated / Broken Scripts
    Replies: 2
    Last Post: 01-30-2009, 06:35 PM
  3. GE Functions
    By Metagen in forum Research & Development Lounge
    Replies: 5
    Last Post: 12-29-2008, 12:34 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
  •