mIRC Homepage
Posted By: judge2020 Auto-fill a name? - 24/05/14 01:37 PM
I'm trying to make a small command that will say ".timeout (user i specify) (amount of time)" (which for twitch is deleting a message and not allowing a person to chat for (time))
here is my script
Code:
on *:text:!t *:#:{ if ($nick == theyoungergamer) msg # .timeout $2 $3 }
It seems to be hard to type out the whole name ($2) of the person in chat, especially when i'm doing it remotely. I was wondering is there a way to auto-fill the name if i abbreviate it in chat?
like here:
Code:
theyoungergamer: !t theyo 60
paintballbot: .timeout theyoungergamer 60
 

Also would be good if it would return an error if the abbreviation came out with two+ names.

Thanks if anyone can help with this!
Posted By: Loki12583 Re: Auto-fill a name? - 24/05/14 01:55 PM
Press tab to autocomplete a nick
Posted By: judge2020 Re: Auto-fill a name? - 24/05/14 02:13 PM
No, I'm using a tablet to time people out remotely, and I want the script to autofil the name.
Posted By: Nillen Re: Auto-fill a name? - 24/05/14 02:14 PM
This is only possible through the actual application. Most twitch users will use the website to connect to the channel instead, which doesn't support this feature.

I guess something like this would do. I'm sure there's a better way though.
Code:
on *:text:!t *:#: { 
  var %userlist $nick(#,0)
  while (%userlist) { 
    var %user $nick(#,%userlist)
    if ($2 isin %user) { code goes here }
    dec %userlist
  }
}

Edit: It won't print out an error if there are more than one user, it will do the code for both. Unless you specify to break after the first match.
You can print the value yourself and compare it when the loop is over if you want to have a message for each match.
Posted By: Wims Re: Auto-fill a name? - 24/05/14 04:57 PM
Quote:
I'm sure there's a better way though
Yes! You can use $fline to access the nicklist of a channel, $fline accepts wildcard. Also, using "!t &" as the matchtext will make sure $2 is filled, "!t *" is currently match on "!t " which is probably not wanted.
Code:
on *:text:!t &:#:{
 var %f $fline($chan,$2*,0,1)
 if (!%f) msg $chan Can't find a nickname matching $qt($2)
 elseif (%f > 1) msg $chan Multiple nicknames match $qt($2) $+ , please give a better name
 else {
   var %nick $fline($chan,$2*,1,1)
   msg $chan do stuff with %nick
 }
}
Posted By: Nillen Re: Auto-fill a name? - 24/05/14 05:52 PM
Ah, there you have it smile
I tried using if ($2* ison #) or $2 $+ *, but as I expected it didn't work. So I figured something like $fline would exist, I just never searched for it.

Also, I think * is used because there's a $3 in there as well, as I believe that "!t &" will only trigger if the value of $0 == 2? So it's either that or "!t & &", but "!t *" would also allow for $3 to be $null, allowing a default value to be set when user doesn't specify a value etc. At least that would be my thought process.
Posted By: Wims Re: Auto-fill a name? - 24/05/14 05:58 PM
Yeah you are right, I said that with only $2 in mind but the same applies for $3 with "!t & &"
Posted By: blessing Re: Auto-fill a name? - 25/05/14 06:58 AM
I'm pretty sure $fline for this line needs .text property, no?
Code:
var %nick $fline($chan,$2*,1,1)

var %nick $fline($chan,$2*,1,1).text
Posted By: Wims Re: Auto-fill a name? - 25/05/14 02:29 PM
Yeah, my bad!
© mIRC Discussion Forums