Results 1 to 13 of 13

Thread: GetChatBoxText

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

    Default GetChatBoxText



    Output:

    ['Fr41m']

  2. #2
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Wats the problem with this? I guess its not that accurate to detect spaces ...

  3. #3
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    More information will be helpful.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  4. #4
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Quote Originally Posted by Kyle Undefined View Post
    More information will be helpful.
    More information about giving more information would be helpful

    @OP, are you trying to make a caller for SW?

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

    Default

    Quote Originally Posted by Shay View Post
    More information about giving more information would be helpful

    @OP, are you trying to make a caller for SW?
    @shay> Yes actually

    @Kyle > That's all I can give. Try it out yourself with a test sample

    Simba Code:
    writeln(ChatBoxTextArray(COLOROFFC)));

    I noticed that the space fontset is 3x16, whereas the space for fr4 1m is 2x16

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

    Default



    ^^ 32.bmp does not fit inbetween

  7. #7
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    This isn't that big a bug and it's easily solved. The bitmap for space doesn't fit there. So how to solve it?


    Simba Code:
    {$I SRL/SRL.Simba}

    Function IsChatBoxTextEx(RegExpr: String; Colour: Integer): Boolean;
    var
      I, L: Integer;
      TSA: TStringArray;
    begin
      TSA:= ChatBoxTextArray(Colour);
      L:= High(TSA);

      For I:= 0 To L Do
        if ExecRegExpr(RegExpr, TSA[I]) then
        begin
          Result:= True;
          break;
        end;
    end;

    begin
      //DO NOT put spaces in the regex. Spaces are denoted by "\s" Non-white-space is denoted by "\S"
      //Brackets aren't allowed unless escaped by a backslash and finally  the * means to repeat the previous expression 0 or more times.


      writeln(IsChatBoxTextEx('(Fr4(\s)*1m)', clBlack));

      //The above Regex is equivalent to '(Fr4 1m)|(Fr41m)|(Fr4  1m)|(Fr4   1m)'... etc.. keeps going for an infinite amount of spaces.
    end.
    Last edited by Brandon; 05-29-2012 at 06:15 PM.
    I am Ggzz..
    Hackintosher

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

    Default

    Quote Originally Posted by Brandon View Post
    This isn't that big a bug and it's easily solved. The bitmap for space doesn't fit there. So how to solve it?


    Simba Code:
    {$I SRL/SRL.Simba}

    Function IsChatBoxTextEx(RegExpr: String; Colour: Integer): Boolean;
    var
      I, L: Integer;
      TSA: TStringArray;
    begin
      TSA:= ChatBoxTextArray(Colour);
      L:= High(TSA);

      For I:= 0 To L Do
        if ExecRegExpr(RegExpr, TSA[I]) then
        begin
          Result:= True;
          break;
        end;
    end;

    begin
      //DO NOT put spaces in the regex. Spaces are denoted by "\s" Non-white-space is denoted by "\S"
      //Brackets aren't allowed unless escaped by a backslash and finally  the * means to repeat the previous expression 0 or more times.


      writeln(IsChatBoxTextEx('(Fr4(\s)*1m)', clBlack));

      //The above Regex is equivalent to '(Fr4 1m)|(Fr41m)|(Fr4  1m)|(Fr4   1m)'... etc.. keeps going for an infinite amount of spaces.
    end.
    The biggest problem with that so called 'solution' is that people have to hardcode every single mismatch that occurs...

  9. #9
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by slushpuppy View Post
    The biggest problem with that so called 'solution' is that people have to hardcode every single mismatch that occurs...

    A regex is not hardcoding.. The way your going about it is literally hardcoding. The fact that it doesn't find your exact and specific text due to a space in it, is hardcoding.

    Regular Expressions are otherwise known as pattern matching. It matches a specified pattern.

    For an example of a pattern than matches a TPointArray, see here: http://villavu.com/forum/showpost.ph...10&postcount=3

    The function is called STRToTPA. It's not hardcoded because you can enter any TPA and it will work. hardcoding is where the values must be very specific.

    What I gave you is the ultimate solution. A Regular Expression to match any pattern you like. Of course you'd write your own expressions.

    Some useful ones:
    Simba Code:
    '[A-Za-z0-9_]' // Matches A-z, 0-9 and underscore..
    '^[A-Za-z]' // Matches A-z only if at the beginning of a line..
    '[0-9]*$'  //Matches 0-9 any amount of times AND matches the end of a line aka linefeed.

    Those are just some examples. Of course there are as many patterns as the mind can think of.

    Perhaps you can describe exactly what you want and I can provide a close if not exact solution..
    I am Ggzz..
    Hackintosher

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

    Default

    Quote Originally Posted by Brandon View Post
    A regex is not hardcoding.. The way your going about it is literally hardcoding. The fact that it doesn't find your exact and specific text due to a space in it, is hardcoding.

    Regular Expressions are otherwise known as pattern matching. It matches a specified pattern.

    For an example of a pattern than matches a TPointArray, see here: http://villavu.com/forum/showpost.ph...10&postcount=3

    The function is called STRToTPA. It's not hardcoded because you can enter any TPA and it will work. hardcoding is where the values must be very specific.

    What I gave you is the ultimate solution. A Regular Expression to match any pattern you like. Of course you'd write your own expressions.

    Some useful ones:
    Simba Code:
    '[A-Za-z0-9_]' // Matches A-z, 0-9 and underscore..
    '^[A-Za-z]' // Matches A-z only if at the beginning of a line..
    '[0-9]*$'  //Matches 0-9 any amount of times AND matches the end of a line aka linefeed.

    Those are just some examples. Of course there are as many patterns as the mind can think of.

    Perhaps you can describe exactly what you want and I can provide a close if not exact solution..
    No amount of regex manipulation will work because the input text is wrong.


    Essentially I have an access list that contain array of RSNs that grant users permissions to change calls for the team and a fair bit of ranks have rather popular names. Discarding spaces in the names can lead to unexpected access given to wrong people


    Due to this problem, RSNs get read wrong because of 1px error ;x

    e.g.

    fr4 1m becomes fr41m

    pvm2 j4ck becomes pvm2j4ck
    Last edited by slushpuppy; 05-30-2012 at 01:31 PM.

  11. #11
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    If the issue is the spaces, just TrimSpaces() both on what you're looking for and on what the GetText function returns. Voila.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  12. #12
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by Sir R. M8gic1an View Post
    If the issue is the spaces, just TrimSpaces() both on what you're looking for and on what the GetText function returns. Voila.

    ~RM
    I'm pretty sure what he is looking for is dynamic and he needs to know specifically what was said.

    That aside, You could use another delimiter.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

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

    Default

    Quote Originally Posted by Dgby714 View Post
    I'm pretty sure what he is looking for is dynamic and he needs to know specifically what was said.

    That aside, You could use another delimiter.
    I would, unfortunately I am dealing with runescape names here -then again it is a still a valid bug report

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
  •