Results 1 to 2 of 2

Thread: if IsUpText problem.

  1. #1
    Join Date
    May 2013
    Location
    USA
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default if IsUpText problem.

    Alright so my problem really isn't UpText or maybe it is. I made a thread around monday asking for help for a private server. I was told that I needed to make my own font cause reg rs and rsps have different font types so the script can't read the private server text.

    So I made the font and made a file for it in the fonts folder, I already called loadfont with the directory of the folder and all I need to know is what do I do next in order for it to check the font for UpText for the private server. I was trying to wrap my head around it but can't seem to do it.

  2. #2
    Join Date
    Apr 2013
    Location
    Las Vegas
    Posts
    111
    Mentioned
    1 Post(s)
    Quoted
    35 Post(s)

    Default

    Well, let's take a look at the normal IsUpText function.

    It defers to a few other functions before we get to the core function, 'P07_GetUpText'. In order to determine if the uptext contains what you are looking for, we need to fetch the actual up text. The code is:

    Simba Code:
    Function P07_GetUpText: String;
    Var
      WhiteT,BlueT,YellowT,OrangeT,FoundText: String;
    Begin
      WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'UpChars07');      
      BlueT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 13423640, 65, 'UpChars07');    
      YellowT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 1235160, 40, 'UpChars07');  
      OrangeT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 4687583, 53, 'UpChars07');    
      FoundText:=WhiteT + ' ' + BlueT + YellowT + OrangeT;
      FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '/', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
      Result:=FoundText;
    End;

    You need to first copy and paste to create a completely new function. Name this function appropriately and it then looks like you need to change WhiteT, BlueT, YellowT and OrangeT to retrieve the text. First change the UpChars07 to the name of the font that you created. Then load the private server into your client and use the color picker/position tool to find out what pixel coordinates the text starts and ends at. The start coordinates are the upper left corner of the text; pick the pixel located directly where the text starts. The end coordinates are the bottom right corner of the text; pick the pixel located at the very end on the bottom.

    The next two arguments (0 and 5) seem to be the minimum and maximum vertical spacing which for this particular purpose is irrelevant. I would just leave those as they are and then find the horizontal spacing between each letter (probably the same: 1) and then find the color of the uptext as found on your private server. The next argument is the tolerance, which you may need to do some experimenting on to find the correct values for each of the colors.

    After you change the font to your custom made font and find the coordinates at which the uptext ends and starts, you should be able to successfully retrieve the up text from your private server.

    A simple test script will help you in setting all of the arguments correctly.

    Simba Code:
    program RSPS_Uptext;
    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.Simba}
         
    Function RSPS_GetUpText: String;
    Var
      WhiteT,BlueT,YellowT,OrangeT,FoundText: String;
    Begin
      WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'RSPSFont');        // These functions need to be editted to fit the server.
      BlueT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 13423640, 65, 'RSPSFont');       // These functions need to be editted to fit the server.
      YellowT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 1235160, 40, 'RSPSFont');      // These functions need to be editted to fit the server.
      OrangeT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 4687583, 53, 'RSPSFont');      // These functions need to be editted to fit the server.
      FoundText:=WhiteT + ' ' + BlueT + YellowT + OrangeT;
      FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '/', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
      Result:=FoundText;
    End;                  
                 
    begin
    setupSRL;
    writeLn (RSPS_GetUpText);
    end.

    After you manage to retrieve the up text from the private server, you can start creating clone functions of the ones that SRL has for the 07 servers.

    Simba Code:
    function RSPS_IsUpText(UpText: string): Boolean;
    begin
      Result := (Pos(UpText, RSPS_GetUpText) > 0);
    end;        
         
    function RSPS_IsUpTextEx(Text: String): Boolean;
    begin
      Text := Replace(Text, '?', '.');
      Result := ExecRegExpr('.*'+Text+'.*', RSPS_GetUpText);
    end;    

    function RSPS_IsUpTextRe(RegEx: String): Boolean;
    begin
      Result := ExecRegExpr(RegEx, RSPS_GetUpText);
    end;

    And that should be everything you need to start using Up Text functions on your private server. Give it a try and tell me how it goes.
    Last edited by bob_dole; 06-15-2013 at 02: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
  •