Results 1 to 18 of 18

Thread: Get text in Runescape

  1. #1
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default Get text in Runescape

    Hello,

    I'm Having trouble reading a text in Runescape This is my script:

    Simba Code:
    program DeclarePlayers;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    var
    x,y : integer ;
    DTM1, DTM2 : integer ;
    ItemBox : array[0..1] of Tpoint ;
    textresult : string ;

    begin

    DTM1 := DTMFromString('mQwAAAHicY2ZgYHBkYmBwYYLQZowQbAnEy5cvZ/j79y8YcwHVwTAjEgYCAFnTCXw=');
    DTM2 := DTMFromString('mQwAAAHicY2YAAmYGhr9MENqMEYItgXj58uUMf//+BWMuoDQMMyJhIAAAZvQJtQ==');

    if ( FindDTM(DTM1,x,y,525,180,769,506 ) ) then begin
      ItemBox[0] := Point( x, y ) ;
    end;

    if ( FindDTM(DTM2,x,y,525,180,769,506 ) ) then begin
      ItemBox[1] := Point( x, y ) ;
    end;

      textresult := '-1' ;

      Writeln( '************' ) ;
      Writeln( textresult ) ;
      Writeln( '************' ) ;
      Writeln( '' ) ;


      ItemBox[0].x :=  ItemBox[0].x + 51 ;
      ItemBox[0].y :=  ItemBox[0].y + 4 ;
      ItemBox[1].x :=  ItemBox[1].x - 8 ;
      ItemBox[1].y :=  ItemBox[1].y + 22 ;

      MoveMouse( ItemBox[0].x, ItemBox[0].y );
      wait( 1000 ) ;
      MoveMouse( ItemBox[1].x, ItemBox[1].y );
      wait( 1000 ) ;

      FreeDTM( DTM1 ) ;
      FreeDTM( DTM2 ) ;

      textresult := GetTextAtExWrap(ItemBox[0].x,ItemBox[0].y,ItemBox[1].x,ItemBox[1].y,10,50,2,7067128,20,SmallChars) ;

      Writeln( '************' ) ;
      Writeln( textresult ) ;
      Writeln( '************' ) ;
      Writeln( '' ) ;

    end.

    When I run the Script the "ItemBox" will leave the next part of the minigame picture:

    The output will remain:
    Code:
    ************
    -1
    ************
    
    ************
    ************
    
    Successfully executed.
    Can anyone help me out to get the text string ?
    I dont really care what function i need to use as long as it will work

  2. #2
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    The next function doens work for me ?

    Simba Code:
    textresult := GetTextAtEx( ItemBox[0].x, ItemBox[0].y, ItemBox[1].x, ItemBox[1].y, 1, 50, 2, 7067128, 10, SmallChars ) ;

    I get the error:
    Code:
    [Error] C:\_Simba_Scripts\Testing.simba(50:122): Invalid number of parameters at line 49
    But i am really sure i use all the right parameters.

  3. #3
    Join Date
    Jan 2012
    Location
    In A Farm
    Posts
    3,301
    Mentioned
    30 Post(s)
    Quoted
    444 Post(s)

    Default

    Does it open another tab where parameters show?

  4. #4
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    No it only gives the error, and im really using 11 vars

  5. #5
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    When i opened the function i find this:

    Simba Code:
    function GetTextAtEx(x, y: Integer; Tolerance: Integer; Chars: String; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer; TextLength: Integer; Strict: Boolean; Range: TCharRange): string;

    A working function would be nice for me

  6. #6
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    How do you determine the upper left and btm right points of the box through DTM?
    I'd personally use TPA and get the bounds.

    Also i think the font is UpCharsEx.

    Why not just use WaitOption?

  7. #7
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    How do you determine the upper left and btm right points of the box through DTM?
    I'd personally use TPA and get the bounds.

    Also i think the font is UpCharsEx.

    Why not just use WaitOption?

    Yes i use a dtm to get the position of the new popup screen in your inv.
    Its not fully tested.
    The menu isnt fixed and moves depeninding on location in inv and the item.

    But can you give me a working example of the given picture?
    Cant upload the entire screen of rs atm.

  8. #8
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Where does the 'Amulet of glory (4)' appear at? As a right click option in inventory or equipment?

  9. #9
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    In the inventory when youre mouse is on the glory without clicking.
    Ive tested in paint for this menu so thats why the finddtm is a lil odd

  10. #10
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Simba Code:
    writeln(GetUptext);
    Move your mouse over the item, and wait a bit before calling it.

  11. #11
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Ive been using the get uptext, but sometimes the backround at getuptext screws the result up. So i was trying to use the new function in rs. What would not mess the result up, hopefully.

  12. #12
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Hmm that's coincidentally what i attempted yesterday too.
    Just use fixed coordinates for the search box parameter? Uptext position won't change. I'm lost as to how you are using DTM to find the box, like what are these DTMs?

  13. #13
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Dtm1 : upper left popup screen when mouse is on item (grey pixel)
    Dtm2 : same as dtm1 but then the upper right.

    After the given ofset the name of the item is left ( not 100% tested )

    The given coords to look for the dtm are not permanent as i was tesing in paint .
    This will change to a more logic something like mix2 and miy2. But i cant in paint

  14. #14
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    I'm even more confused now -.-

    Can you show a screenshot of where the item is, and where is the text you are grabbing, and where are your DTMs?

    Also why do you move your mouse to a point, then wait for 1sec without doing anything, then move to another point (also you should use MMouse for it, much less bot-like)

  15. #15
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Yes, Moving the mouse is bot-like.
    I use it to see where the DTM starts so i could make the offset for isolating the text of the item.
    If the mouse is moved the screen popup is gone.



  16. #16
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Oh new EOC window...

    Get the TPA bound of the words (it should be an unique color), then use that as the search area? Where are your DTM mainpoint and subpoints?

    Also vertical spacing should be 0 if you are only getting the 'Amulet of glory' text.

  17. #17
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Oh new EOC window...

    Get the TPA bound of the words (it should be an unique color), then use that as the search area? Where are your DTM mainpoint and subpoints?

    Also vertical spacing should be 0 if you are only getting the 'Amulet of glory' text.
    I get the upper left and the upper right points.
    With the offset given in the program:

    Simba Code:
    ItemBox[0].x :=  ItemBox[0].x + 51 ;
      ItemBox[0].y :=  ItemBox[0].y + 4 ;
      ItemBox[1].x :=  ItemBox[1].x - 8 ;
      ItemBox[1].y :=  ItemBox[1].y + 22 ;

    Edit:
    Code:
    ItemBox[0] = upper left Popup box
    ItemBox[1] = upper right Popup box
    Its just in a beta for me. When i can read the text ill improve it
    But reading failed so i asked help.
    Going to set vspacing to 0, both Min and Max and i'll look what will happen.

    Edit:

    Code:
    Changed minVspacing & maxVspacing to 0
    Changed font to : UpCharsEx
    Output: 'A m u l e t o f g l o r y M )'
    
    Changed hspacing to 1 & 0:
    Output: 'A m u l e t o f g l o r y ( 4 )'
    This function wil do for me :)
    Last edited by kazhual; 11-22-2012 at 04:51 PM.

  18. #18
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Finishing Touch:
    Moving mouse to inventory spot 4,

    Results i got so far:
    - N a t u r e t i a r a
    - A m u l e t o f g l o r y ( 4 )
    - P r a y e r p o t i o n ( 4 )
    - S u p e r s t r e n g t h ( 1 )
    - S u p e r a t t a c k ( 2 )

    Too bad about the spaces

    Simba Code:
    program FindItemEOC;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    var
    x,y : integer ;
    Color, Tol : integer;
    DTM1, DTM2 : integer ;
    ItemBox : array[0..1] of Tpoint ;
    textresult : string ;

    begin

      SRL_SixHourFix := True ;
        Smart_FixSpeed := True ;
        ClearDebug ;
        SetupSRL ;

      MMouseItem( 4 );

      wait( 1000 );
    {
      MoveMouse(
      MIX1 + 153 ,
      MIY1 + 36 )
      wait ( 1000 ) ;
    }

      DTM1 := DTMFromString('mQwAAAHicY2ZgYHBkYmBwYYLQZowQbAnEy5cvZ/j79y8YcwHVwTAjEgYCAFnTCXw=');
      DTM2 := DTMFromString('mQwAAAHicY2YAAmYGhr9MENqMEYItgXj58uUMf//+BWMuoDQMMyJhIAAAZvQJtQ==');

      ClearDebug ;
      textresult := '' ;
      Color := 7067128 ;
      Tol := 10 ;

      if ( FindDTM(DTM1,x,y,MIX1,MIY1,MIX2+27,MIY2 ) ) then begin

        ItemBox[0] := Point( x, y )

        if ( FindDTM(DTM2,x,y,MIX1,MIY1,MIX2+27,MIY2 ) ) then begin

          ItemBox[1] := Point( x, y )
          ItemBox[0].x :=  ItemBox[0].x + 51 ;
          ItemBox[0].y :=  ItemBox[0].y + 4 ;
          ItemBox[1].x :=  ItemBox[1].x - 8 ;
          ItemBox[1].y :=  ItemBox[1].y + 22 ;
          textresult := GetTextAtExWrap( ItemBox[0].x, ItemBox[0].y, ItemBox[1].x, ItemBox[1].y, 0, 0, 1, Color, Tol, UpCharsEx) ;

        end;

      end;

      FreeDTM( DTM1 ) ;
      FreeDTM( DTM2 ) ;

      Writeln( '************' ) ;
      Writeln( textresult ) ;
      Writeln( '************' ) ;
      Writeln( '' ) ;

    end.

    Posting this in the Devellopment section in case there is some interest

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •