Results 1 to 22 of 22

Thread: My Procedures/Functions!

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

    Default My Procedures/Functions!

    Don't pay attention to the old ones. I'll probably be adding useful stuff when I update now.

    SCAR Code:
    //////////////////////////////////////////////////////////////////////////
    ////////////////////////////ALL BY BULLZEYE95!////////////////////////////
    //////////////////////////////////////////////////////////////////////////
    {

    Procedure WaitB(lowest: Integer; highest: Integer);
    Function  ModFound: Boolean;
    Function  IsUpTextMultiArr(text: array of string): Boolean;
    Function  IsMouseIn(x1, y1, x2, y2: Integer): Boolean;
    Procedure DropAllRan;
    Function  GetDate(getTime, displayWords, militaryTime: Boolean): String;
    Procedure TargetRS;
    Function  Reverse(Text: String): String;
    Function  IsPrime(Num: Integer): Boolean;
    Function  IsComposite(Num: Integer): Boolean;
    Function  RandomCase(Text: String): String;
    Function  GetNumbers(Text: String): String;
    Function  GetLetters(Text: String): String;
    Function  ReArrange(Text: String): String;
    Function  TrimAllSpaces(Text: String): String;
    Function  DeleteAll(Str, Del: String): String;
    Function  Average(Num: Array of Integer): Integer;
    Function  StrContains(Find, InString: String): Boolean;
    Function  BitmapFromColor(Width, Height, Color: Integer): Integer;
    Function  GetTradeAmount(TradePos: Integer; Side: String): Integer;
    Function  Range(Num1, Num2: Integer): Integer;
    Function  MixColors(col1, col2: Integer): Integer;
    Function  Place(I: Integer): String;
    Function  FindColorRightTol2(var cx, cy: Integer; Color, x1, y1, x2, y2, Tolerance: Integer): Boolean;

    }




    {*******************************************************************************
    Procedure WaitB(lowest, highest: Integer);
    By: Bullzeye95
    Description: Waits a time between "lowest" and "highest".
    *******************************************************************************}


    procedure waitB(lowest, highest: Integer);
    var
     waitTime: Integer;
    begin
      if(lowest >= highest)then
       begin
         writeln('Lowest number is greater than or equal to your highest.');
         exit;
       end;
      repeat
        WaitTime:= random(highest);
      until(not(waitTime<= lowest))
      wait(waittime);
    end;

    {*******************************************************************************
    Function ModFound: boolean;
    By: Bullzeye95
    Description: Returns true if a mod is present.
    *******************************************************************************}


    function ModFound: boolean;
    var
      tx, ty: Integer;
    begin
      if (not (GetColor(20, 434) = 0)) then Exit;
      Wait(100);
      if (BmpMod = 0) or (BmpAdmin = 0) then
        LoadSRLBitMaps;
      if (FindBitmapToleranceIn(bmpMod, tx, ty, 1, 345, 110, 430, 15)) or
        (FindBitmapToleranceIn(bmpAdmin, tx, ty, 1, 345, 110, 430, 15)) then
      begin
        Result := True;
      end;
    end;

    {*******************************************************************************
    Function IsUpTextMultiArr(text: array of string): Boolean;
    By: Bullzeye95
    Description: This is like IsUpTextMulti, but you can have however many
                 different strings to check for as you want.
    REMEMBER: Use like if(MyIsUpTextMulti(['hi', 'hi', 'hi', 'hi']))then
    *******************************************************************************}

    function IsUpTextMultiArr(text: array of string): boolean;
    var
      tempx, tempy, I: Integer;
    begin
      for I := 0 to getarraylength(text)-1 do
       begin
         if IsTextInAreaEx(7, 7, 334, 20, tempx, tempy, text[i], 100, UpChars, True, True, 0, 2, -1)then
          Result := True;
       end;
    end;

    {*******************************************************************************
    Function IsMouseIn(x1, y1, x2, y2: Integer): Boolean;
    By: Bullzeye95
    Description: This checks if your mouse is in a defined box.
    *******************************************************************************}

    function IsMouseIn(x1, y1, x2, y2: integer) : Boolean;
    begin
      getmousepos(x, y);
      if(x >= x1) and (x <= x2) and (y >= y1) and (y <= y2)then
       Result:= true;
    end;

    {*******************************************************************************
    Procedure DropAllRan;
    By: Bullzeye95
    Description: This chooses a random drop procedure each time.  There are
                 currently three different ones it can choose from.
    *******************************************************************************}

    procedure DropAllRan;
    begin
      case Random(3) of
        0: begin
             dropall;
           end;

        1: begin
             DropTo(1, 4);
             DropInvPosition(8);
             DropInvPosition(12);
             DropInvPosition(16);
             DropInvPosition(20);
             DropInvPosition(24);
             DropInvPosition(28);
             DropInvPosition(27);
             DropInvPosition(26);
             DropInvPosition(25);
             DropInvPosition(21);
             DropInvPosition(17);
             DropInvPosition(13);
             DropInvPosition(9);
             DropTo(5, 7);
             DropInvPosition(11);
             DropInvPosition(15);
             DropInvPosition(19);
             DropInvPosition(23);
             DropInvPosition(22);
             DropInvPosition(18);
             DropInvPosition(14);
             DropInvPosition(10);
           end;

        2: begin
             dropto(1, 4);
             DropInvPosition(8);
             DropInvPosition(7);
             DropInvPosition(6);
             DropInvPosition(5);
             dropto(9, 12);
             DropInvPosition(16);
             DropInvPosition(15);
             DropInvPosition(14);
             DropInvPosition(13);
             dropto(17, 20);
             DropInvPosition(24);
             DropInvPosition(23);
             DropInvPosition(22);
             DropInvPosition(21);
             dropto(23, 28);
           end;
      end;
    end;

    {*******************************************************************************
    Function GetDate(getTime, displayWords, militaryTime: Boolean): String;
    By: Bullzeye95
    Description: This function returns a string containing the date, with
                 some options.
    How to use the booleans:
    -getTime: Return the time also.
    -displayWords: Make it look like January 14th, 2007, instead of 1/14/2007
    -militaryTime: Make the time look like 16:27:32, not 4:27:32

    USED RON'S FUNCTION TO MAKE THIS!  I JUST BUILT ON TO IT!
    *******************************************************************************}

    function GetDate(getTime, displayWords, militaryTime: Boolean): String;
    var
      Year, Month, Day, Hour, Min, Sec, MSec: Word;
      M, D: String;
    begin
      if(displayWords)then
        begin
          DecodeDate(Date, Year, Month, Day);
          case Month of
            1 : M := 'January';
            2 : M := 'February';
            3 : M := 'March';
            4 : M := 'April';
            5 : M := 'May';
            6 : M := 'June';
            7 : M := 'July';
            8 : M := 'August';
            9 : M := 'September';
            10 : M := 'October';
            11 : M := 'November';
            12 : M := 'December';
          end;
          case Day of
            1 : D := 'st';
            2 : D := 'nd';
            3 : D := 'rd';
          end;
          if(Day > 3)then
            D := 'th';
          if(getTime)then
            begin
              DecodeTime(time, Hour, Min, Sec, MSec);
              if(not(militaryTime))then
                begin
                  if(Hour > 12)then
                    begin
                      Hour:= Hour-12;
                      Result:= M+' '+IntToStr(Day)+D+', '+IntToStr(Year) + '  ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
                      exit;
                    end;
                end;
              Result:= M+' '+IntToStr(Day)+D+', '+IntToStr(Year) + '  ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
            end
          else
            Result := M+' '+IntToStr(Day)+D+', '+IntToStr(Year);
        end;
      if(not(displayWords))then
        begin
          if(getTime)then
            begin
              DecodeTime(time, Hour, Min, Sec, MSec);
              if(not(militaryTime))then
                begin
                  if(Hour > 12)then
                    begin
                      Hour:= Hour-12;
                      Result:= DateToStr(date) + '  ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
                      exit;
                    end;
                  if(not(Hour > 12))then
                    begin
                      Result:= DateToStr(date) + '  ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
                      exit;
                    end;
                end;
              if(militaryTime)then
                begin
                  Result:= DateToStr(date) + '  ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
                  exit;
                end;
            end;
            if(not(getTime))then
              begin
                Result:= DateToStr(date);
              end;
        end;
    end;

    {*******************************************************************************
    Function CapitalizeIt(theWord: String): String;
    By: Bullzeye95
    Description: Capitalizes the first letter of the first word in your string.
    *******************************************************************************}

    function CapitalizeIt(theWord: String): String;
    var
      tWord, firstLetter: String;
    begin
      tWord:= theWord;
      if(tWord = '')then
       begin
         writeln('Your string is blank');
         exit;
       end;
      tWord:= Trim(tWord);
      firstLetter:= uppercase(copy(tWord, 1, 1));
      delete(tWord, 1, 1);
      tWord:= firstLetter + tWord;
      Result:= tWord;
    end;

    {*******************************************************************************
    Procedure TargetRS;
    By: Bullzeye95
    Description: Does the same thing as selecting the RS screen with the
                 crosshairs.
    *******************************************************************************}

    Procedure TargetRS;
    begin
      FindWindowBySize(766, 504);
    end;

    {*******************************************************************************
    Function Reverse(Text: String): String;
    By: Bullzeye95
    Description: This reverses a string.  For example, asdf would become fdsa.
    *******************************************************************************}

    function Reverse(Text: String): String;
    var
      I: Integer;
      S: String;
    begin
      Text:= Trim(Text);
      for I:= Length(Text) downto 1 do
        S:= S + copy(Text, I, 1);
      Result:= S;
    end;

    {*******************************************************************************
    Function IsPrime(Num: Integer): Boolean;
    By: Bullzeye95
    Description: Returns true if a number is prime.
    *******************************************************************************}

    function IsPrime(Num: Integer): Boolean;
    var
      I: Integer;
    begin
      if(Num = 2)then
        begin
          Result:= True;
          exit;
        end;
      for I:= 2 to Num - 1 do
        begin
          if((Num mod I) = 0)then
            begin
              Result:= False;
              exit;
            end;
        end;
      Result:= True;
    end;

    {*******************************************************************************
    Function IsComposite(Num: Integer): Boolean;
    By: Bullzeye95
    Description: Returns true if a number is composite.
    *******************************************************************************}

    function IsComposite(Num: Integer): Boolean;
    begin
      Result:= not(IsPrime(Num));
    end;

    {*******************************************************************************
    Function RandomCase(Text: String): String;
    By: Bullzeye95
    Description: Makes all letters of a string a different case.  For example,
                 'hello bob' might become 'hELlO boB'
    *******************************************************************************}

    function RandomCase(Text: String): String;
    var
      S: Array of String;
      I: Integer;
    begin
      setarraylength(S, Length(Text));
      for I:= 0 to Length(Text) - 1 do
        case Random(2) of
          0: S[I]:= Uppercase(copy(Text, I + 1, 1));
          1: S[I]:= Lowercase(copy(Text, I + 1, 1));
        end;
      for I:= 0 to Length(Text) - 1 do
        Result:= Result + S[I];
    end;

    {*******************************************************************************
    Function GetNumbers(Text: String): String;
    By: Bullzeye95
    Description: Returns only the numbers in a string.
    *******************************************************************************}

    function GetNumbers(Text: String): String;
    var
      I: Integer;
      CE: String;
    begin
      Text:= Trim(Text);
      for I:= 1 to Length(Text) do
        if(Lowercase(copy(Text, I, 1)) = Uppercase(copy(Text, I, 1)))then
          try
            CE:= inttostr(strtoint(copy(Text, I, 1)));
            Result:= Result + copy(Text, I, 1);
          except
          end;
    end;

    {*******************************************************************************
    Function GetLetters(Text: String): String;
    By: Bullzeye95
    Description: Returns only the letters in a string.
    *******************************************************************************}

    function GetLetters(Text: String): String;
    var
      I: Integer;
    begin
      Text:= Trim(Text);
      for I:= 1 to Length(Text) do
        if(not(Lowercase(copy(Text, I, 1)) = Uppercase(copy(Text, I, 1))))then
          Result:= Result + copy(Text, I, 1);
    end;

    {*******************************************************************************
    Function ReArrange(Text: String): String;
    By: Bullzeye95
    Description: It mixes up a string.  For example, 'hello' might become 'loleh'
    *******************************************************************************}

    function ReArrange(Text: String): String;
    var
      Str: Array of String;
      I, TempRan: Integer;
      Finish: Boolean;
    begin
      Text:= Trim(Text);
      SetArrayLength(Str, Length(Text));
      for I:= 0 to GetArrayLength(Str) - 1 do
        Str[I]:= copy(Text, I + 1, 1);
      while Finish = False do
        begin
          TempRan:= Random(GetArrayLength(Str));
          Result:= Result + Str[TempRan];
          Str[TempRan]:= '';
          for I:= 0 to GetArrayLength(Str) - 1 do
            begin
              if(not(Str[I] = ''))then
                begin
                  Finish:= False;
                  break;
                end;
              if(I = GetArrayLength(Str) - 1)then
                exit;
            end;

        end;
    end;

    {*******************************************************************************
    Function TrimAllSpaces(Text: String): String;
    By: Bullzeye95
    Description: Takes out all spaces in your string.
    *******************************************************************************}

    function TrimAllSpaces(Text: String): String;
    var
      I: Integer;
    begin
      Text:= Trim(Text);
      for I:= 1 to Length(Text) do
        while pos(' ', Text) <> 0 do
          delete(Text, pos(' ', Text), 1);
      Result:= Text;
    end;

    {*******************************************************************************
    Function DeleteAll(Str, Del: String): String;
    By: Bullzeye95
    Description: Deletes all of the string Del in the string Str, then
                 returns it.
    *******************************************************************************}

    function DeleteAll(Str, Del: String): String;
    var
      I: Integer;
    begin
      for I:= 1 to Length(Str) do
        begin
          delete(Str, pos(Del, Str), Length(Del));
        end;
      Result:= Str;
    end;

    {*******************************************************************************
    Function Average(Num: Array of Integer): Integer;
    By: Bullzeye95
    Description: Returns the average of an array of integers.
    *******************************************************************************}

    function Average(Num: Array of Integer): Integer;
    var
      TAns, I: Integer;
    begin
      try
        SetArrayLength(Num, GetArrayLength(Num));
        for I:= 0 to GetArrayLength(Num) - 1 do
          TAns:= TAns + Num[I];
        Result:= TAns div GetArrayLength(Num);
      except
      end;
    end;

    {*******************************************************************************
    Function StrContains(Find, InString: String): Boolean;
    By: Bullzeye95
    Description: Returns true if string InString contains string Find.
    *******************************************************************************}

    Function StrContains(Find, InString: String): Boolean;
    begin
      Result:= pos(Find, InString) <> 0;
    end;

    {*******************************************************************************
    Function BitmapFromColor(Width, Height, Color: Integer): Integer;
    By: Bullzeye95
    Description: Returns a bitmap of one color.
    *******************************************************************************}

    function BitmapFromColor(Width, Height, Color: Integer): Integer;
    var
      Buffer: Integer;
    begin
      Buffer:= BitmapFromString(Width, Height, '');
      FastDrawClear(Buffer, Color);
      Result:= Buffer;
    end;

    {*******************************************************************************
    Function GetTradeAmount(TradePos: Integer; Side: String): Integer;
    By: Bullzeye95
    Description: Returns the amount of an item on either side of the trade
                 screen.
    TradePos - The position of the item.  Used like inventory position.
    Side - Tells it on what side of the trade screen to look.  Left or right.
    *******************************************************************************}

    function GetTradeAmount(TradePos: Integer; Side: String): Integer;
    var
      CoordPoint: TPoint;
    begin
      case lowercase(Side) of
        'left':  CoordPoint:= AmountCoords('your trade', TradePos);
        'right': CoordPoint:= AmountCoords('trade', TradePos);
        else Exit;
      end;
      Result:= GetAmount(CoordPoint.x, CoordPoint.y);
    end;

    {*******************************************************************************
    function Range(Num1, Num2: Integer): Integer;
    By: Bullzeye95
    Description: Returns the range of two numbers.
    *******************************************************************************}

    function Range(Num1, Num2: Integer): Integer;
    begin
      if(Num1 - Num2 >-1)then
        Result:= Num1 - Num2
      else
        Result:= Num2 - Num1;
    end;

    {*******************************************************************************
    function MixColors(col1, col2: Integer): Integer;
    By: Bullzeye95
    Description: Mixes two colors.
    *******************************************************************************}

    function MixColors(col1, col2: Integer): Integer;
    var
      H1, S1, L1, H2, S2, L2, H3, S3, L3: Extended;
    begin
      ColortoHSL(col1, H1, S1, L1);
      ColortoHSL(col2, H2, S2, L2);
      H3:= abs((H1 + H2) div 2);
      S3:= abs((S1 + S2) div 2);
      L3:= abs((L1 + L2) div 2);
      Result:= HSLtoColor(H3, S3, L3);
    end;

    {*******************************************************************************
    function Place(I: Integer): String;
    By: Bullzeye95
    Description: Returns the number as a string, with either a 'st', 'nd', 'rd', or
                 'th' at the end of it.
    *******************************************************************************}

    function Place(I: Integer): String;
    begin
      case Copy(IntToStr(I), Length(IntToStr(I)), 1) of
        '1': Result:= IntToStr(I) + 'st';
        '2': Result:= IntToStr(I) + 'nd';
        '3': Result:= IntToStr(I) + 'rd';
        else Result:= IntToStr(I) + 'th';
      end;
    end;

    {*******************************************************************************
    function FindColorRightTol2(var cx, cy: Integer; Color, x1, y1, x2, y2, Tolerance: Integer): Boolean;
    By: Bullzeye95
    Description: Faster version of FindColorRightTol.
    *******************************************************************************}

    function FindColorRightTol2(var cx, cy: Integer; Color, x1, y1, x2, y2, Tolerance: Integer): Boolean;
    var
      Boxes: TBoxArray;
      I: Integer;
      tX1, tY1, tX2, tY2: Integer;
    begin
      SetLength(Boxes, x2 - x1);
      tX1:= x2 - 1;
      tY1:= y1;
      tX2:= x2;
      tY2:= y2;
      for I:= 0 to Length(Boxes) - 1 do
      begin
        tX1:= tX1 - 1;
        tX2:= tX2 - 1;
        Boxes[I]:= IntToBox(tX1, tY1, tX2, tY2);
      end;
      for I:= 0 to Length(Boxes) - 1 do
        if(FindColorTolerance(cx, cy, Color, Boxes[I].x1, Boxes[I].y1, Boxes[I].x2, Boxes[I].y2, Tolerance))then
        begin
          Result:= True;
          exit;
        end;
    end;

    I have to say the ReArrange function was definitely the hardest to make. I tried at least 20 times, no joke.

    You can also see how much better I've gotten since when I started.

    UPDATE: MUCH faster FindColorRightTol.

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

    Default

    Just added another function

    SCAR Code:
    {*******************************************************************************
    Function BitmapFromColor(Width, Height, Color: Integer): Integer;
    By: Bullzeye95
    Description: Returns a bitmap of one color.
    *******************************************************************************}

    function BitmapFromColor(Width, Height, Color: Integer): Integer;
    var
      Buffer: Integer;
    begin
      Buffer:= BitmapFromString(Width, Height, '');
      FastDrawClear(Buffer, Color);
      Result:= Buffer;
    end;

    Updated first post.



    Hey, it might be useful to someone lol

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

    Default

    Nobody has any suggestions or comments? *cries*



    EDIT: Whoops! I just realized I triple posted

  4. #4
    Join Date
    Feb 2006
    Location
    Under a rock.
    Posts
    1,351
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Some pretty unique functions and stuff there, keep up the good work!
    SRL Developer
    ◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘

  5. #5
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah, after i look through them deeper, i may consider using some
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

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

    Default

    Thanks guys

    Lol now that I look back at the ReArrange function, I have no clue how it works

    Any suggestions of what to make? I'm stuck :-/

  7. #7
    Join Date
    Dec 2006
    Posts
    374
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Something to count the yellow number on a noted item in a trade screen. like for example GetItemAmount(Name : String); or something/
    Another awsome scripting forum! Check it out: www.Uberbroproductions.net/forums
    TRY MY VARROCK ZAMMY MAGE CURSER/CONFUSER/WEAKENER! THE LINK IS BELOW
    http://www.srl-forums.com/forum/varr...56.html?t=6356
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~


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

    Default

    Hmm that's an idea. I'll see what I can do.

    EDIT: This should work
    SCAR Code:
    function GetTradeAmount(TradePos: Integer; Side: String): Integer;
    var
      CoordPoint: TPoint;
    begin
      case lowercase(Side) of
        'left':  CoordPoint:= AmountCoords('your trade', TradePos);
        'right': CoordPoint:= AmountCoords('trade', TradePos);
        else Exit;
      end;
      Result:= GetAmount(CoordPoint.x, CoordPoint.y);
    end;
    TradePos is the position of the item, like in the inventory.
    Side tells it to either check the left side or the right side of the trade screen.

  9. #9
    Join Date
    Dec 2006
    Posts
    374
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    so i could do something like
    SCAR Code:
    Var TheAmount : Integer;
    Procedure GetThatAmount;
    begin
    TheAmount := GetTradeAmount(1,'right');
    //Coind DTM and blah blah right click coins
    TypeSend(IntToStr(TheAmount));
    end;
    basic idea but that should work right?
    Another awsome scripting forum! Check it out: www.Uberbroproductions.net/forums
    TRY MY VARROCK ZAMMY MAGE CURSER/CONFUSER/WEAKENER! THE LINK IS BELOW
    http://www.srl-forums.com/forum/varr...56.html?t=6356
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~


  10. #10
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    you could make these alot smaller then you have them

    SCAR Code:
    {*******************************************************************************
    Function GetNumbers(Text: String): String;
    By: Bullzeye95 Edit By Sky Scripter
    Description: Returns only the numbers in a string.
    *******************************************************************************}


    function GetNumbers(Text: String): String;
    var
       i, c:Integer;
    begin
      For i:= 1 to length(Text) do
       For C:= 48 to 57 do
        if (Text[i] = Chr(c)) then
         result:= Result + text[i];
    end;

    {*******************************************************************************
    Function Reverse(Text: String): String;
    By: Bullzeye95 Edit By Sky Scripter
    Description: This reverses a string.  For example, asdf would become fdsa.
    *******************************************************************************}

    function Reverse(Text: String): String;
    var
      I: Integer;
    begin
      for I:= Length(Text) downto 1 do
        Result:= Result + Text[i]
      Trim(Result);
    end;

    Basically all i am saying is you can use result
    instead of asking for a new string.
    it can save you a few lines, great job

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

    Default

    I can't believe I'm actually taking the time to update this with a worthless function, but here:
    SCAR Code:
    function MixColors(col1, col2: Integer): Integer;
    var
      H1, S1, L1, H2, S2, L2, H3, S3, L3: Extended;
    begin
      ColortoHSL(col1, H1, S1, L1);
      ColortoHSL(col2, H2, S2, L2);
      H3:= abs((H1 + H2) div 2);
      S3:= abs((S1 + S2) div 2);
      L3:= abs((L1 + L2) div 2);
      Result:= HSLtoColor(H3, S3, L3);
    end;
    It... mixes two colors...
    I was bored...
    To test it:
    SCAR Code:
    program New;
    var
      Buffer: Integer;

    const
      TheColor = 12764645; //Put in the color to view it

    function BitmapFromColor(Width, Height, Color: Integer): Integer;
    var
      Buffer: Integer;
    begin
      Buffer:= BitmapFromString(Width, Height, '');
      FastDrawClear(Buffer, Color);
      Result:= Buffer;
    end;

    begin
      Buffer:= BitmapFromColor(40, 40, TheColor);
      DisplayDebugImgWindow(40, 40);
      SafeDrawBitmap(Buffer, GetDebugCanvas, 0, 0);
    end.

  12. #12
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    lol you bounced a old thread up

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

    Default

    OMG I R T3H BANZ
    Haha my new function is fun to play with. I like to see what it comes up with.

  14. #14
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    Hah What a Dork.... jk
    i like pretty Colors as Well

    Edit : woe and im a king black dragon when that happen XD

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

    Default

    Dude I swear the SRL Activity and Longevity is rigged. My post count and Activity are alot higher than yours, yet I'm still a Lesser Demon.

    My longevity isn't that much higher than yours anyway. What's wrong?!
    [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]

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

    Default

    Dunno. BTW if its about post count and those, by looking at SKy's , I will soon become KBD too :O

  17. #17
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    it might be because of your Rep++?

  18. #18
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    It's because of the time you spent on the board and the longetivity and activity I believe
    Hup Holland Hup!

  19. #19
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    getdate could be helpful if you only wanted a script to go on at certain times of day to be more human, or am i mistaken
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


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

    Default

    Dunno dan, I don't even remember making it

    And updated with a faster version of FindColorRightTol. The old version was SLOW.

    SCAR Code:
    function FindColorRightTol2(var cx, cy: Integer; Color, x1, y1, x2, y2, Tolerance: Integer): Boolean;
    var
      Boxes: TBoxArray;
      I: Integer;
      tX1, tY1, tX2, tY2: Integer;
    begin
      SetLength(Boxes, x2 - x1);
      tX1:= x2 - 1;
      tY1:= y1;
      tX2:= x2;
      tY2:= y2;
      for I:= 0 to Length(Boxes) - 1 do
      begin
        tX1:= tX1 - 1;
        tX2:= tX2 - 1;
        Boxes[I]:= IntToBox(tX1, tY1, tX2, tY2);
      end;
      for I:= 0 to Length(Boxes) - 1 do
        if(FindColorTolerance(cx, cy, Color, Boxes[I].x1, Boxes[I].y1, Boxes[I].x2, Boxes[I].y2, Tolerance))then
        begin
          Result:= True;
          exit;
        end;
    end;

  21. #21
    Join Date
    Jan 2007
    Posts
    580
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Cool. I love you random dropping procedure. I was about to make one of my own but i don't do that much scripting anymore.
    I like cats.
    Narcle's AK Smelter 1.1.6
    Run Time : 7 Hr 53 Min 5 Sec
    Total Bars : 3371
    Total XP : 58995

  22. #22
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    SCAR Code:
    {*******************************************************************************
    Procedure WaitB(lowest, highest: Integer);
    By: Bullzeye95
    Description: Waits a time between "lowest" and "highest".
    *******************************************************************************}

     
    procedure waitB(lowest, highest: Integer);
    var
     waitTime: Integer;
    begin
      if(lowest >= highest)then
       begin
         writeln('Lowest number is greater than or equal to your highest.');
         exit;
       end;
      repeat
        WaitTime:= random(highest);
      until(not(waitTime<= lowest))
      wait(waittime);
    end;

    you could make that a lot simpler
    SCAR Code:
    {*******************************************************************************
    Procedure WaitB(wait1, wait2: Integer);
    By: Bullzeye95
    Description: Waits a time between "wait1" and "wait2".
    *******************************************************************************}

     
    procedure waitB(wait1, wait2: Integer);
    begin
      wait(Randomrange(wait1,wait2));
    end;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 16
    Last Post: 07-31-2008, 05:40 PM
  2. Functions or Procedures One Shouldn't Use?
    By Azzon in forum OSR Help
    Replies: 2
    Last Post: 01-28-2007, 06:09 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
  •