mIRC Home    About    Download    Register    News    Help

Print Thread
B
Bestpeff
Bestpeff
B
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

E
empeK
empeK
E
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
}

B
Bestpeff
Bestpeff
B
Works great but how do I set it so it only ignores me (Bestpeff) ?

E
empeK
empeK
E
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 
 } 

T
Tulga
Tulga
T
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) 
}


Link Copied to Clipboard