#11
|
|||
|
|||
Quote:
I really don't get what you're saying. I think you're trying to make it capture the string before the colour code gets turned on. I could be WAY off tho. This is a little bit over my head tho. I will keep messing around with it to try and get it up and running. Thanks everyone for your help. |
#12
|
|||
|
|||
Quote:
Saving Rar. ...then the actual string being sent to your client looks just like that, no funky ANSI sequences. (Not necessarily true, but will suffice for understanding this discussion.) However, when you see a string with any color in it : ## Untamedfurby was just defeated in battle by Nymbus! ...then the string being sent to your client has extra stuff in it. Each time the color changes in the string, it's because there's an ANSI sequence in it. The actual string your client receives looks more like: ^[31m## ^[37mUntamedfurby was just defeated in battle by Nymbus! ...where I'm using ^ to represent the esc char (ASCII #27). You don't see any of that funky stuff because whenever your client sees an escape sequence, it automatically converts it into a color change (and hides all that funky stuff). The ^[31m means "change to bright red", and the ^[37m means "change to grey". When you use stuff like #action, it works off of the cooked text (with the escape sequences removed), so it ignores color (otherwise #actions would be tough to write on the fly!) However, if you use the actual scripting capability of your client (e.g. JScript/Perlscript), the incoming strings have all the escape sequences still attached. (I think with JMC in JScript, you access the incoming string with "$jmc->Event", which should be done in a method which you hook onto the incoming text handler. For example, if you named your input handling method "OnIncomingText", you would hook it with "$jmc->RegisterHandler("Incoming","OnIncomingText()". ) Look at your client's documentation for specifics on how to do all this. Because the escape sequences are still intact, you can do perfect matches based on not just the text, but the color of the text as well. Above, Serenity asked how to view the actual, uncooked string in your client. The method I described does so by changing the ASCII #27 escape to something else and then displaying the string. (If you left the #27 as is, then your client would just translate it into colors and you wouldn't see any of the escape sequence text you're looking for.) |
#13
|
|||
|
|||
I understand the majority of what you're saying, Rar. I know there's just one key piece that I'm missing... and that is this: which character(s), exactly, represent ASCII #27? Would you type ESC? Or would you type its hex value, 1B? Is it universal? Thanks for taking the time to explain this stuff.
________ Web Shows Last edited by Ahriman; 09-04-2011 at 08:11 AM. |
#14
|
|||
|
|||
Quote:
$ESC = chr(27); $text =~ s/$ESC/%%/g; // replaces #27 with %% |
#16
|
|||
|
|||
Bump
I know this thread has been dead for a while but I came back to try this again and I got it work.
Code:
#alias {grab} {#action {$$0} {#script umc.getEvent();#script umc.setVar("raw", umc.getEvent());#unaction {$$0}} Thanks for everyones help on this. Last edited by Bellum; 01-28-2010 at 09:13 PM. |
Thread Tools | |
Display Modes | |
|
|