mIRC Home    About    Download    Register    News    Help

Print Thread
#246126 24/05/14 01:37 PM
Joined: Mar 2014
Posts: 215
J
Fjord artisan
OP Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
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
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Press tab to autocomplete a nick

Joined: Mar 2014
Posts: 215
J
Fjord artisan
OP Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
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
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.

Last edited by Nillen; 24/05/14 02:23 PM.

Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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
 }
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #246134 24/05/14 05:52 PM
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Yeah you are right, I said that with only $2 in mind but the same applies for $3 with "!t & &"


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #246148 25/05/14 06:58 AM
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
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

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Yeah, my bad!


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard