how can I change the $replace part to replace "mentbot" with a random nick existing in the channel?
on *:TEXT:*:#todstream: {
write -i todstream.txt $replace($1-,mentbot,$nick)
var %r = $rand(1,26)
var %r2 = $rand(1,42)
set %randomtalk %r
set %randommatch %r2
if (%randomtalk == %randommatch) msg #todstream $read(todstream.txt,n)
.echo 14(00 $+ $time $+ 14) 15 todstream -- The current 00text15 variable is %randomtalk and we are looking for %randommatch
}
Sure: $regubex($nick(#,$r(1,$nick($,0))),(\pL),$upper(\1))
Should be suitable in most cases; will match the first letter in the nick, even if it's not at the beginning, and capitalize it. (eg meta -> Meta, [123]someone[123] -> [123]Someone[123])
As for discluding mentbot, you'll need a loop. goto works well for this...
Before the line with the $replace() add:
:rnick
var %rnick $regubex($nick(#,$r(1,$nick($,0))),(\pL),$upper(\1))
if %rnick == mentbot { goto rnick }
And then just use %rnick in place of what I said to use earlier -- $replace($1-,mentbot,%rnick)
I tried this: $regubex($nick(#,$r(1,$nick($,0))),(\pL),$upper(\1))
but with testing it only wrote all of the text except "mentbot" in the sentence. did not even replace.
or did I get the code wrong altogether maybe? (you did mean to type $regSubex and not $regubex right? I did try both though)
write -i todstream.txt $replace($1-,mentbot,$regsubex($nick(#,$r(1,$nick($,0))),(\pL),$upper(\1)))
like if I typed "asdsdasdsas mentbot asdsdsa 2332" in the channel it only wrote "asdsdasdsas asdsdsa 2332"
I didn't add the loop yet. just wanted to try out the uppercase nick thing.
$nick(#,$r(1,$nick(#,0))) will return a random nick on the channel.