mIRC Home    About    Download    Register    News    Help

Print Thread
(Twitch) Random responses for command #258052 06/06/16 04:40 PM
Joined: Apr 2016
Posts: 86
B
Bestpeff Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2016
Posts: 86
I'm trying to find a way for whenever someone says "hi" or "hello" etc... but have it have a different response EVERY time and I can have multiple responses instead of 2 or 3. If I could have help, it'd be greatly appreciated

Re: (Twitch) Random responses for command [Re: Bestpeff] #258054 06/06/16 06:46 PM
Joined: May 2016
Posts: 11
E
empeK Offline
Pikka bird
Offline
Pikka bird
E
Joined: May 2016
Posts: 11
How i do this stuff is:

I just add random number variable. And then add if statements for each random number how many you want.

Code:
on *:TEXT:hello:#: {
    var %rand = $rand(1,how many you want)
    
    if ( %rand == 1  ) {
       //do something
    }

    if( %rand == 2 ) {
      //do something
    }
    
   // and so on
}

Re: (Twitch) Random responses for command [Re: empeK] #258060 07/06/16 07:53 AM
Joined: Apr 2016
Posts: 86
B
Bestpeff Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2016
Posts: 86
Works great but how do I set it so it only ignores me (Bestpeff) ?

Re: (Twitch) Random responses for command [Re: Bestpeff] #258062 07/06/16 10:16 AM
Joined: May 2016
Posts: 11
E
empeK Offline
Pikka bird
Offline
Pikka bird
E
Joined: May 2016
Posts: 11
You just add an IF statement for your name

Code:
 if ( $nick != Bestpeff ) { 

    //code 
 } 


or you can do it in another way

Code:
 if ( $nick == Bestpeff ) {

    return 
 } 

Re: (Twitch) Random responses for command [Re: Bestpeff] #258823 02/09/16 12:13 PM
Joined: Sep 2016
Posts: 15
T
Tulga Offline
Pikka bird
Offline
Pikka bird
T
Joined: Sep 2016
Posts: 15
with $rand and if statements it will be long script you can create txt file and fill it with bunch of messages like

randommsg.txt

Code:
hey!
hello!
welcomeback
howdy


then use this code:

Code:
on *:text:hello:#: {
  if ($nick == YOURNICK) { return }
  ; this will pick random line from "randommsg.txt" and use that
  msg # $read(randommsg.txt) 
}