Results 1 to 10 of 10

Thread: AeroLib and lape reflection both not working when trying to grab text from chatbox

  1. #1
    Join Date
    Aug 2013
    Location
    Florida
    Posts
    87
    Mentioned
    1 Post(s)
    Quoted
    40 Post(s)

    Thumbs up AeroLib and lape reflection both not working when trying to grab text from chatbox

    I need somebody to help me with getting the information from checking your task with the gem, it should work but when it grabs the line the string is something like this
    Y. o. u.'re assigneH. to K. il.l. H. il.l. giants'. onl.y V-.V- more to go.

    Also, when I try grabbing the line with reflection it returns nothing

    Here is the code I'm using
    Simba Code:
    function SetCurrentTask: Boolean;
    var
      slayGem: TReflectInvItem;
      lastMessage: String;
      i: Integer;
      taskInfo: TStringArray;
      messageNull: Boolean;
    begin
      if not slayGem.Find('Enchanted gem') then
      begin
        Result := false;
      end else
      begin
        Reflect.Mouse.Move(slayGem.GetPoint, 1, 1);
        wait(randomRange(50,150));
        Reflect.Mouse.Click(mouse_right);
        wait(randomRange(30,60));
        Reflect.Text.ChooseOption('Chec');
        wait(randomRange(200,300));
        messageNull := true;
        for i:=1 to 8 do
        begin
          //writeln(getChatBoxText(i, clBlack));  debug
          if FindChatBoxText('assigned', i, clBlack) then
          begin
            messageNull := false;
            lastMessage := getChatBoxText(i, clBlack);
          end
        end
        //writeln(lastMessage); debug
        if not messageNull then
        begin
          //writeln('here'); debug
          lastMessage := ReplaceRegExpr('''', lastMessage, '"', True);
          lastMessage := ReplaceRegExpr(lastMessage, 'You"re assigned to kill ', '', True);
          lastMessage := ReplaceRegExpr(lastMessage, ' only ', '', True);
          lastMessage := ReplaceRegExpr(lastMessage, ' more to go.', '', True);
          taskInfo := SplitRegExprEx(';', lastMessage);
          writeln(ToStr(taskInfo[0]));
          writeln(ToStr(taskInfo[1]));
          Result := True;
        end
      end
    end
    Stay Blessed

  2. #2
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by slayr288 View Post
    I need somebody to help me with getting the information from checking your task with the gem, it should work but when it grabs the line the string is something like this
    Y. o. u.'re assigneH. to K. il.l. H. il.l. giants'. onl.y V-.V- more to go.

    Also, when I try grabbing the line with reflection it returns nothing

    Here is the code I'm using
    Simba Code:
    function SetCurrentTask: Boolean;
    var
      slayGem: TReflectInvItem;
      lastMessage: String;
      i: Integer;
      taskInfo: TStringArray;
      messageNull: Boolean;
    begin
      if not slayGem.Find('Enchanted gem') then
      begin
        Result := false;
      end else
      begin
        Reflect.Mouse.Move(slayGem.GetPoint, 1, 1);
        wait(randomRange(50,150));
        Reflect.Mouse.Click(mouse_right);
        wait(randomRange(30,60));
        Reflect.Text.ChooseOption('Chec');
        wait(randomRange(200,300));
        messageNull := true;
        for i:=1 to 8 do
        begin
          //writeln(getChatBoxText(i, clBlack));  debug
          if FindChatBoxText('assigned', i, clBlack) then
          begin
            messageNull := false;
            lastMessage := getChatBoxText(i, clBlack);
          end
        end
        //writeln(lastMessage); debug
        if not messageNull then
        begin
          //writeln('here'); debug
          lastMessage := ReplaceRegExpr('''', lastMessage, '"', True);
          lastMessage := ReplaceRegExpr(lastMessage, 'You"re assigned to kill ', '', True);
          lastMessage := ReplaceRegExpr(lastMessage, ' only ', '', True);
          lastMessage := ReplaceRegExpr(lastMessage, ' more to go.', '', True);
          taskInfo := SplitRegExprEx(';', lastMessage);
          writeln(ToStr(taskInfo[0]));
          writeln(ToStr(taskInfo[1]));
          Result := True;
        end
      end
    end
    they work for me (reflection)

  3. #3
    Join Date
    Aug 2013
    Location
    Florida
    Posts
    87
    Mentioned
    1 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    they work for me (reflection)
    The debug returns empty strings with this code, ignore the AeroLib functions
    Simba Code:
    for i:=1 to 8 do
        begin
          writeln(Reflect.Chat.GetTextOnLine(i, false));
          if FindChatBoxText('assigned', i, clBlack) then
          begin
            messageNull := false;
            lastMessage := getChatBoxText(i, clBlack);
          end
        end
    Stay Blessed

  4. #4
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by slayr288 View Post
    The debug returns empty strings with this code, ignore the AeroLib functions
    Simba Code:
    for i:=1 to 8 do
        begin
          writeln(Reflect.Chat.GetTextOnLine(i, false));
          if FindChatBoxText('assigned', i, clBlack) then
          begin
            messageNull := false;
            lastMessage := getChatBoxText(i, clBlack);
          end
        end
    make your own with widgets, this one might still be broken.

  5. #5
    Join Date
    Aug 2013
    Location
    Florida
    Posts
    87
    Mentioned
    1 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    make your own with widgets, this one might still be broken.
    This returns absolutely nothing after testing 10000 combinations
    Simba Code:
    function GetTextLine(line: Integer): String;
    var
      J, I: Integer;
      ChatWidget, ChatChild: TReflectWidget;
    begin
      for J := 0 to 50 do
      begin
        for I:=0 to 200 do
        begin
          ChatWidget.GetWidget(Widget_Chat_Container, I);
          ChatChild.GetChild(ChatWidget, J);
          Result := Result + Reflect.Text.RemoveFormatting(ChatChild.GetText);
        end
      end
      ChatWidget.Free;
      ChatChild.Free;
    end
    Stay Blessed

  6. #6
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by slayr288 View Post
    This returns absolutely nothing after testing 10000 combinations
    Simba Code:
    function GetTextLine(line: Integer): String;
    var
      J, I: Integer;
      ChatWidget, ChatChild: TReflectWidget;
    begin
      for J := 0 to 50 do
      begin
        for I:=0 to 200 do
        begin
          ChatWidget.GetWidget(Widget_Chat_Container, I);
          ChatChild.GetChild(ChatWidget, J);
          Result := Result + Reflect.Text.RemoveFormatting(ChatChild.GetText);
        end
      end
      ChatWidget.Free;
      ChatChild.Free;
    end
    check out what this returns: widget: (parent) 162, (parent's, child) 43, (child's child) 0

  7. #7
    Join Date
    Aug 2013
    Location
    Florida
    Posts
    87
    Mentioned
    1 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    check out what this returns: widget: (parent) 162, (parent's, child) 43, (child's child) 0
    Simba Code:
    function GetTextLine(line: Integer): String;
    var
      J, I: Integer;
      ChatWidget, ChatChild, ChildChild: TReflectWidget;
    begin
      ChatWidget.GetWidget(Widget_Chat_Container, 162);
      ChatChild.GetChild(ChatWidget, 43);
      ChildChild.GetChild(ChatChild, 0);
      Result := Result + Reflect.Text.RemoveFormatting(ChildChild.GetText);
      ChatWidget.Free;
      ChatChild.Free;
      ChildChild.Free;
    end

    returns nothing, I'm not really sure how to use widgets so idk if that is right though
    Stay Blessed

  8. #8
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    In line 330 of Chat.simba (AeroLib > core > Chat.simba) change the 347 to 346, like so:
    Simba Code:
    Result.Y := 346 + (14 * (textn - 1));
    That should give you accurate results. It'll be fixed in an upcoming small revision for AL but if you'd like to fix it yourself now, that's how you do it.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  9. #9
    Join Date
    Aug 2013
    Location
    Florida
    Posts
    87
    Mentioned
    1 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    In line 330 of Chat.simba (AeroLib > core > Chat.simba) change the 347 to 346, like so:
    Simba Code:
    Result.Y := 346 + (14 * (textn - 1));
    That should give you accurate results. It'll be fixed in an upcoming small revision for AL but if you'd like to fix it yourself now, that's how you do it.
    Thanks, I'll test it tomorrow
    Stay Blessed

  10. #10
    Join Date
    Mar 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by slayr288 View Post
    I need somebody to help me with getting the information from checking your task with the gem, it should work but when it grabs the line the string is something like this
    Y. o. u.'re assigneH. to K. il.l. H. il.l. giants'. onl.y V-.V- more to go.

    Also, when I try grabbing the line with reflection it returns nothing

    Here is the code I'm using
    Simba Code:
    function SetCurrentTask: Boolean;
    var
      slayGem: TReflectInvItem;
      lastMessage: String;
      i: Integer;
      taskInfo: TStringArray;
      messageNull: Boolean;
    begin
      if not slayGem.Find('Enchanted gem') then
      begin
        Result := false;
      end else
      begin
        Reflect.Mouse.Move(slayGem.GetPoint, 1, 1);
        wait(randomRange(50,150));
        Reflect.Mouse.Click(mouse_right);
        wait(randomRange(30,60));
        Reflect.Text.ChooseOption('Chec');
        wait(randomRange(200,300));
        messageNull := true;
        for i:=1 to 8 do
        begin
          //writeln(getChatBoxText(i, clBlack));  debug
          if FindChatBoxText('assigned', i, clBlack) then
          begin
            messageNull := false;
            lastMessage := getChatBoxText(i, clBlack);
          end
        end
        //writeln(lastMessage); debug
        if not messageNull then
        begin
          //writeln('here'); debug
          lastMessage := ReplaceRegExpr('''', lastMessage, '"', True);
          lastMessage := ReplaceRegExpr(lastMessage, 'You"re assigned to kill ', '', True);
          lastMessage := ReplaceRegExpr(lastMessage, ' only ', '', True);
          lastMessage := ReplaceRegExpr(lastMessage, ' more to go.', '', True);
          taskInfo := SplitRegExprEx(';', lastMessage);
          writeln(ToStr(taskInfo[0]));
          writeln(ToStr(taskInfo[1]));
          Result := True;
        end
      end
    end
    NPC chatbox with options returns nothing, Is it fixed ?

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
  •