mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2007
Posts: 280
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
Hi,

This script (also a talker..) colors the nick I'm saying when it is the first word of my sentence. But I want to have it that whenever I say a nick, so not only when I say "Chloe how are you" but also when I say "how are you Chloe" that the nick (ison $active) also then gets colored with the alias 'randc' (included.)

This is the code, I let the first part out because that's the part of the talker. Which isnt needed here. This part is the part of the colored nick.


Code:
  if ($1 ison $active) { 
    if (/* !iswm $1-) && (!$ctrlenter) && (!$inpaste) {
      if ($len($1) == 1) { 
        halt
      }
      else {
        inc %teller
        msg $active 13,1«4»13.4.13|4|13¤ $randc($1) $+ 00 $2- 6¤4|13|4.13.4«13»
        halt
      }
      halt
    }
  }
}

alias randc {
  var %cols = 4 7 8 9 11 12 13
  return $regsubex($strip($$1-),/(\S)/g,$+($chr(3),$base($gettok(%cols,$rand(1,$numtok(%cols,32)),32),10,10,2),\t))
}




Note: %teller is from the other talker. It aint a problem here.


Squee whenever a squee squee's. Squee whenever a squee does not squee.
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
hi
u have to loop all words like
E.G:
Code:
var %x $0
while %x {
  if ($gettok($1-,%x,32) ison #) randc $v1
  dec %x
}


WorldDMT
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You have to loop through every word.

Code:
  var %c = 1, %t = $0
  while (%c <= %t) {
    if ($gettok($1-,%c,32) ison $active) {
      var %message = %message $randc($gettok($1-,%c,32))
      var %ison.check = 1
    }
    else { var %message = %message $gettok($1-,%c,32) }
    inc %c
  } 
  if (%ison.check == 1) {
    if (/* !iswm $1-) && (!$ctrlenter) && (!$inpaste) {
      if ($len($1) != 1) { 
        inc %teller
        msg $active 13,1«4»13.4.13|4|13¤ %message 6¤4|13|4.13.4«13»
      }
      halt
    }
  }
}


That should do it. As a note, you may want to strip out punctuation before checking if the word is a nick on the channel and then put it back in the message afterwards.

Last edited by Riamus2; 01/03/10 07:24 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
the variable %ison.check is not a good idea because if he have 2 nicks that will not work
and overall, this code has always had a problem
because if a Nickname contain numbers the code will return just the letters


WorldDMT
Joined: Jan 2007
Posts: 280
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
Hi,

Tried it but it still does the same thing. Just colored the nick while its the first word. frown


EDIT: Sorry, my bad. Forgot to remove old script.
Thanks! Works!:D

Last edited by DuXxXieJ; 01/03/10 07:37 PM.

Squee whenever a squee squee's. Squee whenever a squee does not squee.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
2 nicks isn't a problem. They will all be colored. The check is because he originally had a check to only do the special output if a nick ison the channel, so it's there for the same reason.

If the nick contains numbers, it will still check the entire nick and include the entire nick in the %message.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
replace %var == 1 by only %var

so
Code:
if (%ison.check) {...}


Last edited by chacha; 01/03/10 07:48 PM.

WorldDMT
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Sure, it can be done, but it doesn't matter.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard