Results 1 to 4 of 4

Thread: Out of Range

  1. #1
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default Out of Range

    Right. Ive been working on a Universal TPA for a new script Im making today, and I have it finally working out H S and L values, but only when I dont use my case. My case returns an Out of Range error, and I dont know why.

    SCAR Code:
    program UniversalTPA;
    {.include SRL/SRL.scar}

    var
      H, S, L, HueMod, SatMod, RoundedTolerance: Extended;
      MidColour, i, ii, z, z1, z2, z3: integer;
      HueString, SatString, LetsGo: string;
      HSLColor: Array[1..3] of Extended;
      HSL: Array[0..1] of Array[1..3] of Extended;
      Colors: TIntegerArray;
      ColourVariable: array [0..3] of integer;
      UpTextz: array of string;

     
    procedure DeclarePlayers;
    begin
       HowManyPlayers := 1; //How many Players
       NumberOfPlayers(HowManyPlayers);
       CurrentPlayer := 0; //Starting Player

       Players[0].Name := '';
       Players[0].Pass := '';
       Players[0].Nick := '';
       Players[0].Active := True;
       Players[0].Integers[0]:= 50;   // Loads to Do.
       Players[0].Integers[1] := 60;  // Minutes before sleeping (1 player ONLY; Set 'True' below if you want this active)
       Players[0].Booleans[0] := True;    // Do you want to sleep? Reduces Randoms
       Players[0].Strings[0] := 'normal';
    end;

    procedure GetColourVariables;
    begin
      if not (LoggedIn) then
        Exit;
      case lowercase(Players[CurrentPlayer].Strings[0]) of
        'normal':
          begin
            ColourVariable[0] := 3241318;
            ColourVariable[1] := 2119755;
            ColourVariable[2] := 2645844;
            ColourVariable[3] := 3240035;
            UpTextz := ['Tree', 'Tre', 'ree'];
          end;

        'oak':
          begin
            ColourVariable[0] := 2584416;
            ColourVariable[1] := 3305828;
            ColourVariable[2] := 4162678;
            ColourVariable[3] := 5544845;
            UpTextz := ['Oak', 'Oa', 'ak'];
          end;

        'willow':
          begin
            ColourVariable[0] := 2181686;
            ColourVariable[1] := 6193521;
            ColourVariable[2] := 3755332;
            ColourVariable[3] := 3234376;
            UpTextz := ['Willow', 'Will', 'illo', 'llow'];
          end;

        'maple':
          begin
            ColourVariable[0] := 1319487;
            ColourVariable[1] := 725796;
            ColourVariable[2] := 2177124;
            ColourVariable[3] := 1385537;
            UpTextz := ['Maple', 'Map', 'apl', 'ple'];
          end;

        'yew':
          begin
            ColourVariable[0] := 3241318;
            ColourVariable[1] := 2119755;
            ColourVariable[2] := 2645844;
            ColourVariable[3] := 3240035;
            UpTextz := ['Yew', 'Ye', 'ew'];
          end;
      end;
    end;

    procedure ColourToZ;
    begin
      GetColourVariables;
      z := ColourVariable[0];
      z1 := ColourVariable[1]
      z2 := ColourVariable[2];
      z3 := ColourVariable[3];
    end;

    procedure WorkOutTheMods;
    //By MastaRaymond and BazzBarrett, Modified by TorrentOfFlame for this script
    begin
      ColourToZ;
      Colors := [z, z1, z2, z3];
        for i := 1 to 3 do
        begin
          HSL[0][i] := 255; //Max is 240?
        end;
        for i := 0 to High(Colors) do
        begin
          ColortoHSL(Colors[i], HSLColor[1], HSLColor[2], HSLColor[3]);
          for ii:= 1 to 3 do
          begin
            HSL[0][ii] := MinE(HSLColor[ii], HSL[0][ii]);
            HSL[1][ii] := MaxE(HSLColor[ii], HSL[1][ii]);
          end;
        end;
        H := HSL[1][1] - HSL[0][1];
        S := HSL[1][2] - HSL[0][2];
        L := HSL[1][3] - HSL[0][3];
        LetsGo := FloatToStr(H);
        Writeln('H := ' + LetsGo +'.');
        MidColour := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
        HueMod := (H/L);
        SatMod := (S/L);
        RoundedTolerance := Round(L);
        HueString := FloatToStr(HueMod);
        SatString := FloatToStr(SatMod);
        Setlength(HueString, 4);
        Setlength(SatString, 4);
        Writeln('Hue Mod '+ HueString +'');
        Writeln('Sat Mod '+ SatString +'');
        Writeln('Tolerance ' + inttostr(round(RoundedTolerance + 0.2)) +'');
    end;

    function AllTPAs(x, y: Integer): Boolean;
    var
      CTS, i: Integer;
      TPA: TPointArray;
      ATPA: Array of TPointArray;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(HueMod, SatMod);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, MidColour, MSX1, MSY1, MSX2, MSY2, 17);
      ColorToleranceSpeed(CTS);
      ATPA := TPAToATPAEx(TPA, 15, 15);
      for i := 0 to High(ATPA) do
      begin
        MiddleTPAEx(ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        if(IsUpTextMultiCustom([UpTextz])) then
        begin
          Result := True;
          GetMousePos(x, y);
          Break;
        end;
      end;
    end;

    begin
      WorkOutTheMods;
    end.
    Jus' Lurkin'

  2. #2
    Join Date
    Apr 2007
    Location
    Estonia
    Posts
    156
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    SCAR Code:
    begin
      WorkOutTheMods;
    end.

    You need to declare players

    SCAR Code:
    begin
      DeclarePlayers;
      WorkOutTheMods;
    end.

    Should work now
    ROCK IS NOT A DEVILS WORK, ITS MAGICAL AND RAD!

  3. #3
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    Ill try.
    Jus' Lurkin'

  4. #4
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    Worked. Thank you.
    Jus' Lurkin'

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 71-99 range?
    By isjusme in forum RuneScape News and General
    Replies: 16
    Last Post: 06-02-2008, 03:45 PM
  2. 70 range
    By isjusme in forum RuneScape News and General
    Replies: 6
    Last Post: 04-27-2008, 05:37 PM
  3. out of range
    By nik999389 in forum OSR Help
    Replies: 4
    Last Post: 10-29-2007, 09:43 AM
  4. Out of range
    By rotflmfwao in forum OSR Help
    Replies: 3
    Last Post: 08-22-2007, 02:29 AM
  5. Eh... Out of Range...
    By Pancakes in forum OSR Help
    Replies: 4
    Last Post: 07-03-2007, 11:41 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
  •