mIRC Home    About    Download    Register    News    Help

Print Thread
nick completer problem #179074
17/06/07 08:41 PM
17/06/07 08:41 PM
Joined: Feb 2003
Posts: 3,432
Sweden/Borlänge
S
sparta Offline OP
Hoopy frood
sparta  Offline OP
Hoopy frood
S

Joined: Feb 2003
Posts: 3,432
Sweden/Borlänge
Code:
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 : ...


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: nick completer problem [Re: sparta] #179078
17/06/07 09:19 PM
17/06/07 09:19 PM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Hoopy frood
Riamus2  Offline
Hoopy frood

Joined: Oct 2004
Posts: 8,327
MA, USA
Change:
Code:
  if ($ctrlenter) || ($left($1,1) === $readini(mirc.ini,text,commandchar)) { return }



To:
Code:
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:

Code:
if ($ctrlenter) || ($left($1,1) === $readini(mirc.ini,text,commandchar) || ($left($1,1) == :)) { return }



Invision Support
#Invision on irc.irchighway.net
Re: nick completer problem [Re: Riamus2] #179083
17/06/07 09:48 PM
17/06/07 09:48 PM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
RoCk  Offline
Hoopy frood
R

Joined: Dec 2002
Posts: 2,010
/ 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.

Re: nick completer problem [Re: RoCk] #179088
17/06/07 10:03 PM
17/06/07 10:03 PM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Hoopy frood
Riamus2  Offline
Hoopy frood

Joined: Oct 2004
Posts: 8,327
MA, USA
Yes, add in the extra check into what I put so that you don't have issues with /.


Invision Support
#Invision on irc.irchighway.net
Re: nick completer problem [Re: RoCk] #179102
17/06/07 11:29 PM
17/06/07 11:29 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
hixxy  Offline
Hoopy frood
H

Joined: Sep 2005
Posts: 2,876
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.

Re: nick completer problem [Re: hixxy] #179104
18/06/07 12:11 AM
18/06/07 12:11 AM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Hoopy frood
Riamus2  Offline
Hoopy frood

Joined: Oct 2004
Posts: 8,327
MA, USA
Ok, updated:
Code:
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. smile


Invision Support
#Invision on irc.irchighway.net
Re: nick completer problem [Re: Riamus2] #179124
18/06/07 07:34 AM
18/06/07 07:34 AM
Joined: Feb 2003
Posts: 3,432
Sweden/Borlänge
S
sparta Offline OP
Hoopy frood
sparta  Offline OP
Hoopy frood
S

Joined: Feb 2003
Posts: 3,432
Sweden/Borlänge
Thnx for the help smile 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? smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: nick completer problem [Re: sparta] #179127
18/06/07 09:38 AM
18/06/07 09:38 AM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
hixxy  Offline
Hoopy frood
H

Joined: Sep 2005
Posts: 2,876
The iswm method is faster.

Re: nick completer problem [Re: hixxy] #179204
19/06/07 05:49 AM
19/06/07 05:49 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
MeStinkBAD  Offline
Fjord artisan
M

Joined: Apr 2003
Posts: 342
Originally Posted By: hixxy
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.


Beware of MeStinkBAD! He knows more than he actually does!
Re: nick completer problem [Re: MeStinkBAD] #179223
19/06/07 11:36 AM
19/06/07 11:36 AM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
hixxy  Offline
Hoopy frood
H

Joined: Sep 2005
Posts: 2,876
Code:
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:

Quote:
$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.

Re: nick completer problem [Re: hixxy] #179225
19/06/07 11:53 AM
19/06/07 11:53 AM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
RoCk  Offline
Hoopy frood
R

Joined: Dec 2002
Posts: 2,010
$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