mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2004
Posts: 124
S
sigbin Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 124
anyone can make a response script that has a multiple and random response from a list of response... like when your nick is mentions the script reply a random response...

thankz in advance

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
To have random responses, put your different responses in a text file. Each line is a seperate response.

Then you can use the $read identifier.

$read(textfile.txt) will resd a random line from textfile.txt. Make sure you point to the path correctly.

Code:
on *:text:*:#:{
  if (%nicktxt_ [ $+ [ $nick ] ] > 3) return
  if ($me isin $1-) {
    msg # $read(text.txt)
    inc -u3 %nicktxt_ [ $+ [ $nick ] ]
  }
}


You will have to create your own text file. Make sure the file path is correct.
Originally Posted By: text.txt

Random Reply1
Random Reply2
Random Reply3



Joined: Jun 2004
Posts: 124
S
sigbin Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 124
thankz it works great.... thankz thankz

Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Quote:
msg # $read(text.txt)


$read(text.txt,n) if you know what's good for you...

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Take your own advice
Quote:
//echo $read(funny.txt)



Reads a random line from the file funny.txt.



Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Yes, and what happens if $version is the only line within funny.txt? 'n' does not signify a numerical value. It's a literal frikkin n! and it means, as quoted from the mIRC help file (if only you had kept reading):
Quote:
If the n switch is specified then the line read in will not be evaluated and will be treated as plain text.


What exactly does that mean? Well, I suppose it means that any text you read using $read(text.txt) may be evaluated as code, rather than plain text! You didn't even read the definition of the function: $read(filename, [[color:#FF0000]ntswrp], [matchtext], [N])[/color]

Last edited by s00p; 10/11/09 12:02 PM.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Sound the "possible exploit"-alarm for a file that may be manipulated by the OP only (viz not remotely)? Do you expect the OP to add $findfiles $decodes $com and stuff to the file himself?
He rather may regard it a feature to have identifiers like $me $day $network or what have you evaluated. Though a short note could have been helpful, imho the n switch is not mandatory here...

Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Or be socially engineered into loading a maliciously crafted 'quotes' file or something without being aware of the problem. A little awareness, and an extra switch doesn't harm. It could be far worse, if he were to come back with stories of compromisation and an irrelevant script to blame because he's not sure what to look for.


Link Copied to Clipboard