Results 1 to 9 of 9

Thread: My First Function ^^

  1. #1
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    My First Function ^^

    Hi,
    This is my first Function! Just starting to script agian after some minor problems ^^.

    Its my newby tree finder!, Finds any tree in Rs with right setup.

    SCAR Code:
    FindaTree('TreeName', TreeColor1, TreeColor2, Tolerance, HowLongInSec);

    TreeName, Name of the tree!
    TreeColor1-2, TreeColor ( Pick a pretty rare color )
    Tolerance, Use 3-10 ( 10 is very high. )
    HowLongInSec, How long it will look for tree until it gives up.

    SCAR Code:
    Procedure FindaTree(TreeName: String; TreeCol1, TreeCol2, Tolerance, HowlongInSec : integer);
    Var
    Time, x, y, i, Count : integer;
    TreeColor : Array[0..1] of Integer;
    Begin
      TreeColor[0] := TreeCol1;
      TreeColor[1] := TreeCol2;
      MarkTime(Time);
      Repeat
        For i:= 0 to 1 do
        If FindColorSpiralTolerance(x, y, TreeColor[i], MSX1, MSY1, MSX2, MSY2, Tolerance) then
        begin
          MMouse(x, y, 0, 0);
          If IsUpText(TreeName) then Mouse(x, y, 0, 0, False);
           If ChooseOption('hop') then Exit;
        end else Count := Count + 1;
      Until(TimeFromMark(time) > 1000*HowLongInSec) or (Count = 3);
    end;

  2. #2
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    for i := 0 to 1 do;

    not

    for i := 0 to 2 do;

    the array of colors is only 0 and 1 so you dont need the 2 because it starts at 0 and goes to 1

    besides that nice a basic keep going

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  3. #3
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ty Just started agian and i forgot the most stuff :/
    Have seen N3ss3s gone crazy with TPA's ?

  4. #4
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by N1ke! View Post
    Ty Just started agian and i forgot the most stuff :/
    Have seen N3ss3s gone crazy with TPA's ?
    n3ss3s is the TPA machine

    You could make the colors in the syntax be a TIntegerArray so you could pick multiple colors as well...something like this:

    SCAR Code:
    Procedure FindaTree(TreeName: String; TreeColor: TIntgerArray; Tolerance, HowlongInSec : integer);
    Var
    Time, x, y, i, Count : integer;
    TreeColor : TIntegerArray;
    Begin
      MarkTime(Time);
      Repeat
        For i:= 0 to GetArrayLength(TreeColor - 1) do
        If FindColorSpiralTolerance(x, y, TreeColor[i], MSX1, MSY1, MSX2, MSY2, Tolerance) then
        begin
          MMouse(x, y, 0, 0);
          If IsUpText(TreeName) then Mouse(x, y, 0, 0, False);
           If ChooseOption('hop') then Exit;
        end else Count := Count + 1;
      Until(TimeFromMark(time) > 1000*HowLongInSec) or (Count = 3);
    end;
    METAL HEAD FOR LIFE!!!

  5. #5
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats way better ^^ Thx for that!
    Maybe start working on a Wcer could get me back..

  6. #6
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    remember when you use TIntegerArray you need the [] around the colors

    SCAR Code:
    FindaTree('Oak', [6574684, 6746746, 9385068], 15, 10);

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  7. #7
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if you do work on a woodcutting script, just a suggestion, since JaGeX is crackin' down on us, maybe you could use a random click function so it won't always right click chop, maybe just throw a left click on there every once in a while. it'd be pwnsome for those little JaGeX noobs to try to find it, in my opinion.
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  8. #8
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    most scripts use that already...its just a case statment:

    SCAR Code:
    case random(4) of
      0,1,2: Mouse(x,y,3,3,True);
      3: begin    
            Mouse(x,y,3,3,False);
            ChooseOption('hop');
          end;
    end;
    METAL HEAD FOR LIFE!!!

  9. #9
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hmm..wow, i've seen it before i think, but only one 1 of the scripts i used, but thats pretty dandy..nice procedure n1ke btw
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 02-27-2008, 05:20 PM
  2. Replies: 2
    Last Post: 02-26-2008, 08:26 PM
  3. Any function that does this?
    By shadowpwner in forum OSR Help
    Replies: 2
    Last Post: 08-14-2007, 03:15 AM
  4. [FUNCTION] FindDoorColour: integer; By ZephyrsFury [FUNCTION]
    By ZephyrsFury in forum Research & Development Lounge
    Replies: 10
    Last Post: 07-27-2007, 08:45 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
  •