Results 1 to 5 of 5

Thread: Arrays

  1. #1
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Arrays

    I'm having unreasonable issues with these arrays I use in a special pixel-counting uptext function. I've tested it with everything commented out.
    Simba Code:
    Function ReturnUptextPixels(Text: string): integer;
    var
      i, i2, i3, L: Integer;
      Letter: String;
      Alphabet: TStringArray;
      LowerP, UpperP: TIntegerArray;
    begin
      SetLength(UpperP, 25);
      LowerP := [24, 33, 16, 33, 24, 27, 37, 34, 12, 25, 31, 20, 36, 26, 24, 33, 31 +
                   15, 20, 21, 24, 20, 28, 22, 34, 20];
      UpperP := [42, 43, 26, 41, 30, 26, 37, 42, 28, 30, 36, 24, 48, 53, 38, 32, 43 +
                 41, 26, 24, 42, 36, 50, 38, 28, 28];
      Alphabet := ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', +
                   'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
     { L := Length(Text);
      Writeln(ToStr(L)); }

      Writeln(ToStr(UpperP[16]));
     { for i := 1 to L do      //Round(L-(L/sqr(L)))
      begin
        for i2 := 0 to 25 do
        begin
        //  Writeln('loop1');
          if (PosEx(Alphabet[i2], Text, i) = i) then
            for i3 := 0 to 25 do
            begin
              Letter := Alphabet[i2];
           //   Writeln(':(2');
              if (Letter = Alphabet[i3]) then
              begin
                Writeln(Alphabet[i3]);
                if (i3 = 25) then
                begin
                  Writeln(IntToStr(UpperP[i3-1]));
                  IncEx(Result, UpperP[i3-1]);
                end else begin
                  IncEx(Result, UpperP[i3]);
                  Writeln(IntToStr(UpperP[i3]) + ': ' + Alphabet[i3]);
                end;
                break;
              end;
              if (Letter = lowercase(Alphabet[i3])) then
              begin
                Writeln(Alphabet[i3]);
                IncEx(Result, LowerP[i3]);
                continue;
              end;
            end;
        end;
      end;    }

    end;
    WHY IS Q = 84 WHEN IT'S SET AT 43, I EVEN TRIED SetLength!
    Note: The code doesn't matter right now - if you have anything to say, please let it be about my issue and not about the format of the function. That'll be fixed later.

  2. #2
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    LowerP := [24, 33, 16, 33, 24, 27, 37, 34, 12, 25, 31, 20, 36, 26, 24, 33, 31 +
    15
    , 20, 21, 24, 20, 28, 22, 34, 20];
    UpperP := [42, 43, 26, 41, 30, 26, 37, 42, 28, 30, 36, 24, 48, 53, 38, 32, 43 +
    41
    , 26, 24, 42, 36, 50, 38, 28, 28];

    Look at bold closely. You forgot something.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  3. #3
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    LowerP := [24, 33, 16, 33, 24, 27, 37, 34, 12, 25, 31, 20, 36, 26, 24, 33, 31 +
    15
    , 20, 21, 24, 20, 28, 22, 34, 20];
    UpperP := [42, 43, 26, 41, 30, 26, 37, 42, 28, 30, 36, 24, 48, 53, 38, 32, 43 +
    41
    , 26, 24, 42, 36, 50, 38, 28, 28];

    Look at bold closely. You forgot something.
    UpperP and LowerP are used seperately. In fact, lowerp wasn't even used, and the only thing i did was debug. Other than that, the last 3 hours I've spent making this function work are making me a little crazy.

  4. #4
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by DeSnob View Post
    UpperP and LowerP are used seperately. In fact, lowerp wasn't even used, and the only thing i did was debug. Other than that, the last 3 hours I've spent making this function work are making me a little crazy.
    Lol your adding the numbers together in the array. You forgot a ,

    Edit:
    Hence 41 + 43 = 84
    I'm a magician.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  5. #5
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    Lol your adding the numbers together in the array. You forgot a ,

    Edit:
    Hence 41 + 43 = 84
    I'm a magician.
    I saw the 41 + 43, but didn't see that I was missing a coma. My mind is all over the place. Thanks! Rep +

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
  •