Results 1 to 2 of 2

Thread: ChatBox additions

  1. #1
    Join Date
    Oct 2011
    Posts
    422
    Mentioned
    15 Post(s)
    Quoted
    116 Post(s)

    Default ChatBox additions

    Simba Code:
    function ChatBoxgetNameAt(lineNum : Integer) : String;
    var str : String;
    begin
    str := GetChatBoxText(lineNum,clMessage);
    Result := trim(ReplaceRegExpr('\W?([A-Za-z0-9_\ ]*)\W?', str, '$1', True));
    end;
    function ChatBoxConvoLine(lineNum,color : Integer) : array of String;
    var
    tempstr : String;
    begin
          tempstr := GetChatBoxText(lineNum,color);
          if tempstr <> '' then
          begin
             SetArrayLength(Result,2);

             Result[0] := ChatBoxgetNameAt(lineNum);
             Result[1] := tempstr;
          end
    end;
    function ChatBoxConvoArray(color : Integer) : array of array of String;
    var I,index: Integer;
    begin

      for I := 1 to 8 do
      begin
        index := Length(Result);
        SetArrayLength(Result,index + 1);
        Result[index] := ChatBoxConvoLine(I,color);
          end;
    end;


    ChatBoxConvoLine(lineNum,color : Integer) // returns conversations in chat box in the format ['RSN', 'whatever he/she said']

    function ChatBoxConvoArray(color : Integer) // Same as above except it returns an array of conversations [['RSN1', 'whatever he/she said']['RSN2', 'whatever he/she said']]

  2. #2
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    for this:
    Simba Code:
    SetArrayLength(Result,2);

             Result[0] := ChatBoxgetNameAt(lineNum);
             Result[1] := tempstr;
    why not just:
    Simba Code:
    Result := [ChatBoxgetNameAt(lineNum), tempstr];

    for this:
    Simba Code:
    for I := 1 to 8 do
      begin
        index := Length(Result);
        SetArrayLength(Result,index + 1);
        Result[index] := ChatBoxConvoLine(I,color);
          end;
    why not just do:
    Simba Code:
    SetArrayLength(Result, 8);
      for I := 1 to 8 do
         Result[I] := ChatBoxConvoLine(I,color);
    Last edited by putonajonny; 06-04-2012 at 09:38 AM.

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
  •