[Script] dummy problem from beginner
Added by Roman Macuda almost 7 years ago
Hi...
On one server I try to connect output is formated on their own way font definition and color definition are marked something like:
"
<Mandragora> Fi%C990033%some text Ipanda
"
Where font decoration are Fi for italics Fb for bold and so on... I tried to overide such strings in sript like that:
on ^:TEXT:*%Fi%*:*:{
echo tbf $+(<,$nick,>:) $replacexcs($1,%Fi%, -)
halt
}*
My desired output for this exampe should be like: <Nick> -some text
But instead it looks like:
<Kleryk_Emeryk>: -C-0-S-m-a-r-k-u-l-o-!-
after every single character it places dash….
So what I'm doing wrog ?
Regards
Xnib
Replies (8)
RE: [Script] dummy problem from beginner - Added by Per Amundsen almost 7 years ago
If it's always the first word, you can try this:
on ^:TEXT:*%Fi%*:*:{ ; Uses $2- to get the entire message from the second token to end echo -tbf $+(<,$nick,>:) $2- halt }
If not, can you post a few lines of text to see the pattern?
RE: [Script] dummy problem from beginner - Added by Per Amundsen almost 7 years ago
Based on your patterns, I came up with this, it should minimize false positives using a whitelist pattern.
on $^*:TEXT:/^(%[FibXC0-9]+%)/:*:{ echo -tbf $+(<,$nick,>:) $replace($1-,$regml(1),) halt }
RE: [Script] dummy problem from beginner - Added by Per Amundsen almost 7 years ago
Btw, it would be possible to convert the bold/italic/colors into mIRC control codes for the messages if that is desired.
RE: [Script] dummy problem from beginner - Added by Roman Macuda almost 7 years ago
After research in regular expresion needed to create two entries:
on $^*:TEXT:/^(%[Fib]+%%[C0-9a-f]+%)/:*:{ echo -tbf $+(<,$nick,>:) $replace($1-,$regml(1),) halt } on $^*:TEXT:/^(%[FibCa-f0-9]+%)/:*:{ echo -tbf $+(<,$nick,>:) $replace($1-,$regml(1),) halt }
And now formating was removed.
But maybe there is idea to pass this for futher formating inside program like colored nicks or emoticons replacement and most annoying my nick is not highlighted in line … because now raw line is displayed
Regards,
Roman
RE: [Script] dummy problem from beginner - Added by Per Amundsen almost 7 years ago
It is possible.
on $^*:TEXT:/^(%[Fib]+%%[C0-9a-f]+%)/:*:{ var %text $replace($1-,$regml(1),) ; italic if (i isin $regml(1)) { %text = $chr(29) $+ %text } ; bold if (b isin $regml(1)) { %text = $chr(2) $+ %text } ; color if ($regex($regml(1),/C([0-9a-f]+)/)) { %text = $chr(4) $+ $regml(1) $+ %text } echo -tbf $+(<,$nick,>:) %text halt }
RE: [Script] dummy problem from beginner - Added by Per Amundsen almost 7 years ago
RE: [Script] dummy problem from beginner - Added by Roman Macuda almost 7 years ago
Hi finally I needed to create this to cover all paterns:
on $^*:TEXT:/^(%[Fib]+%%C0%)/:*:{ var %text $replace($1-,$regml(1),) ; italic if (i isin $regml(1)) { %text = $chr(29) $+ %text } ; bold if (b isin $regml(1)) { %text = $chr(2) $+ %text } ; color if ($regex($regml(1),/C0/)) { %text = $chr(4) $+ $regml(1) $+ %text } echo -tblfmw0 $+(<,$nick,>) %text halt } on $^*:TEXT:/^(%[Fib]+%%C([0-9a-f]+)%)/:*:{ var %text $replace($1-,$regml(1),) ; italic if (i isin $regml(1)) { %text = $chr(29) $+ %text } ; bold if (b isin $regml(1)) { %text = $chr(2) $+ %text } ; color if ($regex($regml(1),/C([0-9a-f]+)/)) { %text = $chr(4) $+ $regml(1) $+ %text } echo -tblfmw0 $+(<,$nick,>) %text halt } on $^*:TEXT:/^(%C0%)/:*:{ var %text $replace($1-,$regml(1),) ; color if ($regex($regml(1),/C0/)) { %text = $chr(4) $+ $regml(1) $+ %text } echo -tblfmw0 $+(<,$nick,>) %text halt } on $^*:TEXT:/^(%[C0-9a-f]+%)/:*:{ var %text $replace($1-,$regml(1),) ; color if ($regex($regml(1),/C([0-9a-f]+)/)) { %text = $chr(4) $+ $regml(1) $+ %text } echo -mtbflw0 $+(<,$nick,>) %text halt } on $^*:TEXT:/^(%[Fib]+%)/:*:{ var %text $replace($1-,$regml(1),) ; italic if (i isin $regml(1)) { %text = $chr(29) $+ %text } ; bold if (b isin $regml(1)) { %text = $chr(2) $+ %text } ; color if ($regex($regml(1),/C([0-9a-f]+)/)) { %text = $chr(4) $+ $regml(1) $+ %text } echo -tbflmw0 $+(<,$nick,>) %text halt }
And I think last question if it is possible to mark nicks by color as its possible without processing ?
No .. .i was not last question as /echo -w0 allows to proces emoticons replacemet it doesn't work if emoticon is the only what is send. Icons are sent in format
%Isometext%
Best regards,
Roman
RE: [Script] dummy problem from beginner - Added by Per Amundsen almost 7 years ago
I think the regex can be compiled into one larger regex, but I am not very good with regex myself, maybe someone else can help with that.
For coloring nick, you can change to something like this:
; color if ($regex($regml(1),/C([0-9a-f]+)/)) { echo -tbflmw0 $+($chr(4),$regml(1),<,$nick,>) %text } else { echo -tbflmw0 $+(<,$nick,>) }
Foe emoticons you would have to add them all yourself with the correct trigger word in Options -> Emoticons, then either use $emoticons/$imagechar to replace the words yourself or -w0 to let AdiIRC do it.