Results 1 to 7 of 7

Thread: uptext

  1. #1
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default uptext

    SCAR Code:
    program test;

    var
       rscc:array of integer;
       
    const
       offset = 97;
       uptext_x = 4;
       uptext_y = 4;
       
    type return = record
       character:string;
       x:integer;
       end;





    procedure loadfont();
    var
       i:integer;
       path:string;

    begin
       path := AppPath + 'fonts\classiccharsold\';
       SetArrayLength(rscc, 26);
       for i := 0 to 25 do
          rscc[i] := LoadBitmap(path + inttostr(i+offset) + '.bmp');
    end;

    function letter(x,y,x2,y2:integer):return;
    var i,p,o,w:integer;
    begin
       for w := -1 to 16 do
       begin
          w := w + 1
          i := -1;
          repeat
             i := i + 1;
          until (i = 25) or FindBitmapMaskTolerance(rscc[i],p,o,x+w,y,x2+w,y2,0,200)
          if i < 25 then
          begin
             result.character := Chr(97 + i);
             if w > 10 then
                result.character := ' ' + result.character;
             result.x := p;
             exit;
          end;
       end;
    end;

    function uptext():string;
    var
       t:return;
       x:integer;
       tm:integer;
    begin
       x := uptext_x;
       tm := GetSystemTime();
       repeat
          t := letter(x,uptext_y,x+9,uptext_y+20);
          if t.x = 0 then
             exit;
          if x = t.x + 1 then
             exit;
          x := t.x + 1;
          result := result + t.character;
       until ((tm + 1000) < GetSystemTime);
    end;


    begin
       loadfont;
       writeln(uptext);
    end.

    this won't work unless the rsc client is targetted and the very top left of rsc screen is at 0,0 coords

    edit: i dunno wut happen but it dun work nemore gonna try to fix lol had it working half an hour ago
    Last edited by Feroc1ty; 12-14-2009 at 04:34 AM.

  2. #2
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Post when you have fixed it and I'll commit it but I think that normal text finding would work..I'll have to do some testing.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  3. #3
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    The function itself works flawlessly, it's just that my coordinates are off.

  4. #4
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    i <3 you.

    when i finish my current projects, i'll start to work on an epic rsc script, now that uptext is (hopefully) fix'd.

    although i also think just using findtext would work just as well.. our only problem was loading the rsc fonts lol
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  5. #5
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    i tried using the findtext but failed so ended up making this, and im not sure if there is an issue in this code or in my current script that uses this include but it wont work, ill get this shit figured out and complete by tommorow, so start making your script as if uptext was working

  6. #6
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    GetTextAtEx(382, 2, 0, Charsrsc, false, false, 0, 1, -1, 100, true, tr_NormalChars);
    You have to change 382 and Charsrsc.

  7. #7
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by antti mies View Post
    GetTextAtEx(382, 2, 0, Charsrsc, false, false, 0, 1, -1, 100, true, tr_NormalChars);
    You have to change 382 and Charsrsc.
    Saved me 10 minutes trying to fix mine up, thx, works perfectly.

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
  •