Results 1 to 5 of 5

Thread: Whats wrong in this procedure?

  1. #1
    Join Date
    Dec 2007
    Location
    Colombia. Bogotá D.C
    Posts
    720
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Whats wrong in this procedure?

    Hmm I was trying to make a procedure that writes in the debug what a NPC is saying, but is says invalid number of parameters , Can anybody help me a bit and point out whats wrong?

    SCAR Code:
    Program New;
    {.include srl/srl.scar}
    Procedure GetIt;
    Var
       TPA : TPointArray;
       T :String;
       i : Integer;
    Begin
      TPA[0].x := MCX1;
      TPA[0].y := MCY1;
      TPA[1].x := MCX2;
      TPA[1].y := MCY2;
     For i := 0 To 1 Do
     Begin
      T := GetTextAtEx(TPA[i], 30, NPCChars, false, false, 0, 0, 0 , 30, false, tr_NormalChars);
      WriteLn(T);
     End;
    End;

    Begin
     SetupSrl;
     ActivateClient;
     GetIt;
     
    End.
    -------------------------------------------------------------------


  2. #2
    Join Date
    Jun 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The problem is with this line:
    GetTextAtEx(TPA[i], 30, NPCChars, false, false, 0, 0, 0 , 30, false, tr_NormalChars);

    It wants an x & y integer, but you're giving it a TPointArray
    Try like this:
    GetTextAtEx(TPA[0].x, TPA[0].y, 30, NPCChars, false, false, 0, 0, 0 , 30, false, tr_NormalChars);

    I haven't tested it (currently on a mac), but if that doesn't fix everything, check the other parameters to make sure they match with the function definition.

  3. #3
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Change:

    SCAR Code:
    T := GetTextAtEx(TPA[i], 30, NPCChars, false, false, 0, 0, 0 , 30, false, tr_NormalChars);

    to:

    SCAR Code:
    T := GetTextAtEx(TPA[i].x, TPA[i].y, 30, NPCChars, false, false, 0, 0, 0 , 30, false, tr_NormalChars);

    You're getting that error because the function does not accept a TPoint as an x and y coordinate.

    EDIT: Looks like I was beaten.
    :-)

  4. #4
    Join Date
    Jun 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh.. Also don't forget to declare the length of the array before putting items into it. Add this line after the first "Begin":
    SetLength(TPA, 2)

    And the line I posted before should have an i instead of 0:
    GetTextAtEx(TPA[i].x, TPA[i].y, 30, NPCChars, false, false, 0, 0, 0 , 30, false, tr_NormalChars);

    Hope this helps. 8D

  5. #5
    Join Date
    Dec 2007
    Location
    Colombia. Bogotá D.C
    Posts
    720
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks a lot for the help guys!
    -------------------------------------------------------------------


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Whats Wrong.
    By kooldude in forum OSR Help
    Replies: 2
    Last Post: 03-27-2008, 09:13 AM
  2. Cant Find Whats wrong with procedure.
    By kooldude in forum OSR Help
    Replies: 3
    Last Post: 03-20-2008, 07:45 AM
  3. Whats Wrong???
    By bilbobaggins in forum OSR Help
    Replies: 12
    Last Post: 04-10-2007, 10:05 AM
  4. Replies: 8
    Last Post: 03-23-2007, 04:20 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
  •