mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
If I have:

($gettok(%filter,1,32) = sometext)

how can I do

($gettok(%filter,1,32) = anytextwithcolourcodeof15)

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Can you be more precise ?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
There is no way to see what color text is other than seeing the actual control code. If you did something like:

04This is red text

And you check the word "red," there's no way for mIRC to know what color that word is without checking the entire line and seeing what the most recent color code was.


Invision Support
#Invision on irc.irchighway.net
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Originally Posted By: firefox
If I have:
($gettok(%filter,1,32) = sometext)
how can I do
($gettok(%filter,1,32) = anytextwithcolourcodeof15)

Code:
if (15 isin $gettok(%filter,1,32))

?

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
alias find {
  if ($regex($1-,/\cc15(\S+)/)) && ($gettok(%filter,1,32) = $regml(1)) {
    echo -a TRUE
  }
}
This will match against text (anywhere in a sentence) with the color 15 in your %filter variable for the first word when you enter:
Quote:
/find sometextwiththecolour15

It'll echo TRUE

You don't put color codes in your %filter but enter /find with the color code to match.

You can apply this to an event to match too...

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
@5618: That won't work unless the color is in the word, like I mentioned.

@Tomao: Yeah, as I mentioned, you have to check the entire line and not a specific word. Whether you do that with regex or another method, it still requires checking the entire line.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
If I were at a mirc this is what I'd do.

I'd copy and paste the ctrl + k color code box in $asc to find the value for it. Then I would search for this in a string of text. If I find it I'd look for number following it with no space.

Last edited by DJ_Sol; 26/02/10 11:09 PM.
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
Originally Posted By: Wims
Can you be more precise ?
I want to extract words which have colour code 15 in a specific place for an on text event

the line has multiple colour codes - I only want to match it if it is in a certain position which is found by filtering out brackets from $1

var %filter $replace($replace($1,],$chr(32)),[,$chr(32))

[text1][text2][ text3 ]

text3 and the brackets are always 15
text1 is always the same colour
text2 is various colours and sometimes 15

I actually use gettok to get text1 atm
I want to use gettok again to get text2 and then if it is in 15 echo it to an @window and if it is something else then just ignore it

Last edited by firefox; 26/02/10 09:37 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
[text1][text2][text3]
Or...
[text1][text2][text3]


You could do this:

Code:
var %word1 = $remove($gettok($1-,1,93),[)
var %word2 = $remove($gettok($1-,2,93),[)
var %word3 = $remove($gettok($1-,3,93),[)
if ($left(%word2,3) == 15) { echo @window %word2 }


You can, of course, remove any of the %word var lines that you don't need and adjust as necessary. Note that this will not show []'s around the text.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Originally Posted By: firefox
I want to extract words which have colour code 15 in a specific place for an on text event
the line has multiple colour codes - I only want to match it if it is in a certain position which is found by filtering out brackets from $1

var %filter $replace($replace($1,],$chr(32)),[,$chr(32))

[text1][text2][ text3 ]

text3 and the brackets are always 15
text1 is always the same colour
text2 is various colours and sometimes 15

I actually use gettok to get text1 atm
I want to use gettok again to get text2 and then if it is in 15 echo it to an @window and if it is something else then just ignore it
If I read you correctly, this should do what you're after:
Code:
on $*:text:/\cc15\133?(.+)\cc15\135?/:*: {
  echo @window * Text consists of colour 15: $regsubex($regml(1),/\133|\135/gS,$chr(32))
}
This will match text with the color code 15 enclosed within the '[text]' and echo it to the @window as 'text'
if text2 and text3 have color code 15 in them, they'll be matched as well.

firefox #219174 07/03/10 03:38 PM
Joined: Mar 2010
Posts: 17
V
Pikka bird
Offline
Pikka bird
V
Joined: Mar 2010
Posts: 17
why my seen no detect when ppl use colour text

on *^:text:*cari*:#:{
if ($1 == %c $+ cari) {
if ($2 == $null) { .msg $chan 5cara yg betul bonggok: %c $+ cari <nick> | halt }
if ($2 == $me) { .msg $chan 5ko buta ke tak nampak aku $+ . | halt }
if ($2 == $nick) { .msg $chan 5ko giler $nick $+ , carik diri sendiri | halt }
if ($2 ison $chan) { .msg $chan 5 $+ $2 ada ko buta ke tak nampak dia alaa dia bukan penting pon buang karen jer | halt }
if ($readini ini\users.ini $2 date == $null) { .msg $chan 5 $+ $2 aku tak nampak dia lah dia sapa tak penting pon | halt }
else {
if ($readini ini\users.ini $2 me == $null) {
if ($readini ini\users.ini $2 part == yes) { .msg $chan 5 $+ $2 last nampak dia keluar [ $readini ini\users.ini $2 chan ]  $+ $duration($calc($ctime($fulldate)-$ctime($readini ini\users.ini $2 date))) ago. }
else { .msg $chan [ 5 $+ $2 ] last nampak dia blah  $+ $duration($calc($ctime($fulldate)-$ctime($readini ini\users.ini $2 date))) lepas mangkok nie tinggalkan message: " $+ [ $readini ini\users.ini $2 message ] $+ ". }
}
else {
if ($readini ini\users.ini $2 part == yes) { .msg $chan 5 $+ $2 last nampak dia keluar [ $readini ini\users.ini $2 chan ]  $+ $duration($calc($ctime($fulldate)-$ctime($readini ini\users.ini $2 date))) ago. | .msg $chan 5 $+ $2 $+ 's last melalak: 6 $+ [ $readini ini\users.ini $2 me ] }
else { .msg $chan 5 $+ $2 last nampak dia blah  $+ $duration($calc($ctime($fulldate)-$ctime($readini ini\users.ini $2 date))) lepas mangkok nie tinggalkan message: " $+ [ $readini ini\users.ini $2 message ] $+ ". | .msg $chan 5 $+ $2 $+ 's last melalak: 6 $+ [ $readini ini\users.ini $2 me ] }
}
}
else { halt }
}
}

sorry use my lang word

Venus78 #219176 07/03/10 05:47 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
As I don't want to fiddle with the code itself - for a quick fix, you could try:
Quote:
on *^:text:*cari*:#:{
tokenize 32 $strip($1-)
if ($1 == %c $+ cari) {

[...]

Venus78 #219177 07/03/10 05:48 PM
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
replace $1 by $strip($1)


WorldDMT
Horstl #219193 08/03/10 02:28 PM
Joined: Mar 2010
Posts: 17
V
Pikka bird
Offline
Pikka bird
V
Joined: Mar 2010
Posts: 17
thank for this last one i can't work i changed coz the they play with my seen n got flood in main chat..i changed to this but can't work with this

tokenize 32 $strip($1-)
if ($1 == %c $+ cari) {


on *:TEXT:!cari*:#: {
.timerfloods 1 10 unset %s
if ( %s >= 3 ) { halt }
inc %s 1
if ( $2 ison $chan ) {
msg $chan $2 is currently in the channel
halt
}

Venus78 #219194 08/03/10 02:50 PM
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
for the flood use set -uN

Code:
on *:text:*:#:{
  if (!%fld) {
    set -u2 %fld 1
    tokenize 32 $1-
    if $1 == !cari {
      if $2 == $null {
        your cmd and word here
      }
      elseif $2 == $me {
        your cmd and word here
      }
      elseif $2 == $nick {
        your cmd and word here
      }
      ....
      .....
      ......
    }
  }
}


WorldDMT

Link Copied to Clipboard