mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2010
Posts: 2
vorpal Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
Joined: Nov 2010
Posts: 2
Well it starts with this remote script. It's simplistic in nature, and I'm not exactly a hardcore scripter but eh.

Code:
;  tige/I am not a tiger thank you kindly.
on 1:text:*tige*:#: /msg $chan I am not a tiger thank you kindly.


I'd rather not people ask what the whole story behind that is. :[ Basically I made this script to instantly reply back to anyone who uses the word "Tiger" in varying forms by adding "**" in front and in the end of the word. I'm looking do something more creative with it though, to combat my friends nit-picking loopholes in the script.

#1) Is it possible to in the same script, have other definitions of when to activate? In example, I have many separate scripts which are exactly the same for *tiga* *tigo* to combat spelling tiger in alternate means.

#2) Is it possible, to have the script select a random reply from a pool of answers? I'm not sure how to pull that off at all if it's possible.

Last edited by vorpal; 17/11/10 04:17 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
#1) There are a variety of ways to do this. Here are a couple very basic examples. There may also be a good regex match that can be set up to cover a lot of possible examples without having to put a lot of OR's (the || in the first and the | in the second). For example, something like /tig(e|a|o|i|u)r/ would match tiger, tigar, tigor, tigir, and tigur. Depending on what people are coming up with to use instead of "tiger," regex may be able to cover most or all of them without having to manually OR every possibility.

Code:
on *:text:*:#: {
  if (*tiger* iswm $1- || *tiga* iswm $1- || *whatever* iswm $1-) { msg $chan response }
}


Code:
on $*:text:/(tiger|tigar|tigger|tigor)/Si:#: {
  msg $chan response
}


#2) Put the replies on separate lines in a text file and use:

Code:
msg $chan $read(filename.txt,nt)


Invision Support
#Invision on irc.irchighway.net
Joined: Nov 2010
Posts: 2
vorpal Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
Joined: Nov 2010
Posts: 2
The file path to the text document can be anywhere or is there some specific folder in mIRC's program file that I should create / use? The version of script you listed worked as before, but I cannot get it to read the text document.

EDIT: Ahh, nevermind, slight mistake on my part. It's working. Thank you so much for the help (:

Last edited by vorpal; 17/11/10 05:13 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Although you figured it out, I'll reply for others...

The file can be placed anywhere you like. Include the path to it if you want to have it in a specific location. Otherwise, the path will be the same as $mircdir . You can see where that is by typing //echo -a $mircdir in the Edit line (where you type when talking to others).

You can also include a relative path from there... For example, if $mircdir is c:\mIRC\, then $read(text\file.txt,nt) will look for file.txt in c:\mIRC\text\. A relative path is helpful if you're going to share the script with others. Even if someone doesn't have mIRC in c:\mIRC, they'll still have $mircdir and any subfolders that are created there.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard