mIRC Home    About    Download    Register    News    Help

Topic Options
#246126 - 24/05/14 02:37 PM Auto-fill a name?
judge2020 Offline
Fjord artisan

Registered: 21/03/14
Posts: 215
Loc: USA
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!
_________________________
#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball

Top
#246127 - 24/05/14 02:55 PM Re: Auto-fill a name? [Re: judge2020]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1244
Press tab to autocomplete a nick

Top
#246128 - 24/05/14 03:13 PM Re: Auto-fill a name? [Re: Loki12583]
judge2020 Offline
Fjord artisan

Registered: 21/03/14
Posts: 215
Loc: USA
No, I'm using a tablet to time people out remotely, and I want the script to autofil the name.
_________________________
#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball

Top
#246129 - 24/05/14 03:14 PM Re: Auto-fill a name? [Re: Loki12583]
Nillen Offline
Hoopy frood

Registered: 24/12/13
Posts: 779
Loc: Sweden
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.


Edited by Nillen (24/05/14 03:23 PM)
_________________________
Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Top
#246132 - 24/05/14 05:57 PM Re: Auto-fill a name? [Re: Nillen]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
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
 }
}
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#246134 - 24/05/14 06:52 PM Re: Auto-fill a name? [Re: Wims]
Nillen Offline
Hoopy frood

Registered: 24/12/13
Posts: 779
Loc: Sweden
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.
_________________________
Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Top
#246135 - 24/05/14 06:58 PM Re: Auto-fill a name? [Re: Nillen]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Yeah you are right, I said that with only $2 in mind but the same applies for $3 with "!t & &"
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#246148 - 25/05/14 07:58 AM Re: Auto-fill a name? [Re: Wims]
blessing Offline
Vogon poet

Registered: 03/04/14
Posts: 191
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

Top
#246157 - 25/05/14 03:29 PM Re: Auto-fill a name? [Re: blessing]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Yeah, my bad!
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top