|
Joined: Feb 2003
Posts: 3,412
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,412 |
on *:input:#: {
if ($ctrlenter) || ($left($1,1) === $readini(mirc.ini,text,commandchar)) { return }
set %tline $1-
set %tchn $chan
unset %idle
inc %_ilines
iback
if (%ncc = 2) {
.msg $target $1-
echo -a $inpline
halt
}
set %tline $2-
set %nick $nick(#,$fline(#,$replace($1,%nctr,*),1,1))
if (%nick !ison $active) { set %tline $1- | echo -a $inpline | .msg $target $1- | halt }
set %tline %nick $+ %owcr $2-
.msg $target %nick $+ %ncchr $2-
echo -a $inpline
halt
}
$inpline return the text that was inserted, how ever i have a small problem, when i type just a :, then it pic the first nick in the nick list, and then complete it, how would i make it send the text if it's nothing entered behind the :, like te: will complete test: , but : would just return : ...
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Change:
if ($ctrlenter) || ($left($1,1) === $readini(mirc.ini,text,commandchar)) { return }
To:
if ($ctrlenter) || ($left($1,1) === $readini(mirc.ini,text,commandchar) || ($1 == :)) { return }
Of course, if you want to send something like :test and don't want this to work then, either, you could use this instead:
if ($ctrlenter) || ($left($1,1) === $readini(mirc.ini,text,commandchar) || ($left($1,1) == :)) { return }
|
|
|
|
Joined: Dec 2002
Posts: 1,997
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,997 |
/ is always a command prefix even if it's changed in the options dialog.
if ($left($1,1) === $readini(mirc.ini,text,commandchar) || ($left($1,1) == /))
or
if ($istok($readini(mirc.ini,text,commandchar) /,$left($1,1),32))
Just in case it is changed.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Yes, add in the extra check into what I put so that you don't have issues with /.
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
The mirc.ini file might not be in the mIRC directory all of the time (when the -i command line parameter is used), so it would be better to use $mircini instead.
Might also be worth checking $inpaste and /returning if it's $true.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Ok, updated:
if ($ctrlenter) || ($left($1,1) === $readini($mircini,text,commandchar) || ($left($1,1) == /) || ($left($1,1) == :)) { return }
That is what I get for leaving original code and just inserting the requested answer. 
|
|
|
|
Joined: Feb 2003
Posts: 3,412
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,412 |
Thnx for the help  i have a question tho, i was told befor to not use $left($1,1) , and i dont know why thats not so good, i was told (/* iswm $1) was bether to use? 
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
The iswm method is faster.
|
|
|
|
MeStinkBAD
|
MeStinkBAD
|
The iswm method is faster. This is a joke right? Use $left($1,1) cuz this makes it pretty obvious your specifying the first character. Or the left most one. It's easier to understand by looking at it. Beware of reading the mIRC INI (config) file. The configuration is actually kept in memory, and it's possible the INI file may not match the actual settings.
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
alias bench1 {
var %i = 10000, %ticks = $ticks
while (%i) {
if ($left(/hello,1) == /) { noop }
dec %i
}
return $calc($ticks - %ticks)
}
alias bench2 {
var %i = 10000, %ticks = $ticks
while (%i) {
if (/* iswm /hello) { noop }
dec %i
}
return $calc($ticks - %ticks)
}
alias bench {
var %i = 10
while (%i) {
echo -a $!left: $bench1 ~ iswm: $bench2
dec %i
}
} Type /bench My results: $left: 422 ~ iswm: 391 $left: 422 ~ iswm: 375 $left: 437 ~ iswm: 360 $left: 422 ~ iswm: 375 $left: 422 ~ iswm: 375 $left: 422 ~ iswm: 375 $left: 421 ~ iswm: 375 $left: 438 ~ iswm: 359 $left: 438 ~ iswm: 359 $left: 422 ~ iswm: 359 It seems that parsing identifiers is a slow process.
|
|
|
|
Joined: Dec 2002
Posts: 1,997
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,997 |
$left: 391 ~ iswm: 359 $left: 391 ~ iswm: 359 $left: 407 ~ iswm: 343 $left: 407 ~ iswm: 343 $left: 407 ~ iswm: 343 $left: 407 ~ iswm: 343 $left: 407 ~ iswm: 343 $left: 407 ~ iswm: 359 $left: 391 ~ iswm: 359 $left: 391 ~ iswm: 359
|
|
|
|
|