mIRC Homepage
Posted By: Lys Adding : at the end of tab-completion? - 30/08/05 05:55 PM
Right now, when I use tab completion mIRC doesn't put a : at the end of the word. How do I make mirc do so?

I mean: when I expand g-tab and get guy, i'd like to get guy: instead.
Here's an example of how it can be done, it's not too accurate but you may be able to improve slightly..

-Andy
Posted By: Om3n Re: Adding : at the end of tab-completion? - 30/08/05 08:27 PM
As far as i know there is no way to trigger an action on a keypress in a normal window such as a channel (apart from the built in control, shift and function key support). There is an on keydown and on keyup which could do it but the events work only in custom windows.

What you may have to do is use an on input event. Script this event to check if $1 (first word) is a nickname in the channel the text is being input to (or matches query nick in query) and replace nick with nick:

something like... keep in mind this code is untested, and if i recall correctly you do not need to specify the output location with the /say command when used in an on input, but i could be wrong.

Code:
on *:INPUT:*: {
  if ($chan) {
    ; in channel
    if ($1 ison $chan) { say $1 $+ : $2- }
  else {
    ; in query
    if ($1 == $active) { say $1 $+ : $2- }
    ; in chat
    elseif ($+(=,$1) == $active) { say $1 $+ : $2- }
  }
}


This would not append the : when you press tab, but it would insert it when the line is input.
Didn't actually think of that, doh! smile

-Andy
Posted By: Lys Re: Adding : at the end of tab-completion? - 31/08/05 05:55 AM
Tried that, it works. I know nothing of scripting, I just copy/paste from other people wink

It sorta works, but it doubles things frown

Example: this is what I get when I do N tab hello:

[13:52] > nael: hello
[13:52] > nael hello

Repeats twice frown
maybe if you add haltdef at the end it would work?
try this:

Code:
on *:INPUT:*: {
  if ($chan) {
    ; in channel
    if ($1 ison $chan) { say $1 $+ : $2- }
  else {
    ; in query
    if ($1 == $active) { say $1 $+ : $2- }
    ; in chat
    elseif ($+(=,$1) == $active) { say $1 $+ : $2- }
  }
haltdef
}
You're also missing a closing brace too.. smile

Code:
on *:INPUT:*: {
  if ($chan) {
    if ($1 ison $chan) { say $1 $+ : $2- }
  [color:red]}[/color]
  else {
    if ($1 == $active) { say $1 $+ : $2- }
    elseif ($+(=,$1) == $active) { say $1 $+ : $2- }
  }
  halt
}


-Andy
Posted By: Lys Re: Adding : at the end of tab-completion? - 31/08/05 08:52 AM
It no longer repeats with that, now it doesn't accept input at all smirk no text is sent to the channel after the first substitution.
Posted By: Kelder Re: Adding : at the end of tab-completion? - 31/08/05 09:11 AM
Code:
on *:INPUT:*: {
  if (($ctrlenter) || (/*iswm $1-)) return
  if (($1 ison $chan) || ((!$chan) && (($1 == $active) || ($+(=,$1) == $active)))) {
    haltdef
    say $1 $+ : $2-
  }
}
Posted By: Lys Re: Adding : at the end of tab-completion? - 31/08/05 12:20 PM
* /if: invalid format

Changed it a bit, got

* /if: invalid format (line 66, script2.mrc)

line 66 is:

if (($ctrlenter) || (/*iswm $1-)) return

Found out the problem on EFNet #mirc, missing a space between /* and iswm. Works perfectly now smile
Posted By: UOnur Re: Adding : at the end of tab-completion? - 31/08/05 12:25 PM
Code:
alias -l say {
  if ($active == #) && ($1 ison #) msg $active $+($1,:) $2-
  elseif ($active == $1) || ($+(=,$1) == $active) msg $active $+($1,:) $2-
  else msg $active $1-
}
Posted By: Om3n Re: Adding : at the end of tab-completion? - 31/08/05 02:12 PM
Apologies for the missing brace and haltdef, that code was quickly typed out in the post and never given a second look. This revised code should work as you desire without the need for a say alias and so on. It was tested and worked correctly for me in all 3 circumstances (nick in chan, nick in query, nick in chat).

Code:
on *:INPUT:*: {
  ; in channel
  if ($chan) && ($1 ison $chan) {
    say $1 $+ : $2-
    haltdef
  }
  ; in query or chat
  elseif ($1 == $active) || ($+(=,$1) == $active) {
    say $1 $+ : $2-
    haltdef
  }
}

Buster and Slade mistakenly placed the halts outside of the if statements, Kelder's code will also work correctly (and infact goes further by taking into account the $ctrlenter to overide). The check for "/" is not actually needed, as the proceding if statements will fail if it is present (i dont know any network that allows a nickname to begin with a /). However checking if it the custom command prefix is present could be useful.
Posted By: Riamus2 Re: Adding : at the end of tab-completion? - 31/08/05 03:38 PM
Is it just me, or did everyone forget to use a ^?

on ^*:input:*: {
Posted By: Mentality Re: Adding : at the end of tab-completion? - 31/08/05 04:11 PM
You don't need the ^ prefix with the ON INPUT event.

Regards,
Posted By: Riamus2 Re: Adding : at the end of tab-completion? - 31/08/05 07:40 PM
Ok. I didn't know that. laugh
© mIRC Discussion Forums