mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2013
Posts: 17
L
LCX Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Mar 2013
Posts: 17
Ok, I don't know if this is doable or not but I figured I'd ask if it is and if anyone knows what I would need to do to make this script work cause I honestly don't know how to script besides C&P something I'd find online.

Firstly, I want to have a script that gives a random reply when someone in the channel types something, for example if they typed !link. If they did that and I was in the channel, I would automatically reply with a random link from a list of links that I have.

Secondly, I would want that script to only work in specific channels I am in, not all the channels I'm in.

I know the first is possible cause in all my years on mIRC I've known people that have done the first. I just don't know if the second is doable with the first...

Thanks.

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Code:
on *:TEXT:!link:#chan1,#chan2,#chan3:{
  msg $chan $read(links.txt,n)
}

The above will do what you want only on channels #chan1 #chan2 and #chan3. All your URLs will need to be in a file called links.txt in your $mircdir (//run $mircdir to open that location).

Joined: Mar 2013
Posts: 17
L
LCX Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Mar 2013
Posts: 17
Is there any special way I need those links listed in that text file? Cause I think I have everything put in the right place, have the script in the remote tab, the txt file in my mircdir, and each link on its own line. But it doesn't seem to work...

Joined: Jun 2012
Posts: 14
Y
Pikka bird
Offline
Pikka bird
Y
Joined: Jun 2012
Posts: 14
Originally Posted By: LCX
Is there any special way I need those links listed in that text file? Cause I think I have everything put in the right place, have the script in the remote tab, the txt file in my mircdir, and each link on its own line. But it doesn't seem to work...


Have you changed #chan1,#chan2,#chan3 to your allowed channels?

Joined: Mar 2013
Posts: 17
L
LCX Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Mar 2013
Posts: 17
Yes, I've updated #chan1 to the channel I want to use it in. Removed #chan2 and #chan3 as I only want it to work in one channel. Assume that would work right? Or do I need it listed 3 times then if I want it in one?

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Having just one channel name there should work fine.
Did you paste the script in Remote (Alt+R)?
Are you aware you cannot trigger this script yourself, only other people?

If yes, then maybe you are running other scripts that interfere with this one. Placing this script in an empty/new file (File > New) and moving it up in the script order (File > Order...) may help.

Joined: Mar 2013
Posts: 17
L
LCX Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Mar 2013
Posts: 17
Did paste in the Remote (Alt+R) in an empty/new file and did bump it up to the top of the list.
Am aware I can't trigger my own scripts, or at least this one.
And do have just one channel name in there so it reads as follows:

on *:TEXT:!link:#chan1:{
msg $chan $read(links.txt,n)
}

Where #chan1 is the name of the channel I'm in. Only other script I have is one that autoreplies when someone private messages me.

Also, I did have someone test it and did notice that I got the following:

/msg: insufficient parameters (line 2, script1.mrc)

Last edited by LCX; 26/03/13 10:52 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If you get that, then your file is likely not in the correct location. You can verify this by typing //run links.txt . If it doesn't open, then you know it's in the wrong location. An easy way to make sure it's in the right place is to put it in $scriptdir or $mircdir locations. To see those locations, use //echo -a $scriptdir and //echo -a $mircdir . Then, once it's in one of those locations, you can use: msg $chan $read($scriptdir\links.txt,n) or msg $chan $read($mircdir\links.txt,n) . Note that the \ isn't really necessary, but it makes it easier to see what the filename is. Using one of those helps to prevent the location mIRC is looking from being wrong no matter what you do to your mIRC install. You can also just put a full path such as: msg $chan $read(c:\mIRC\links.txt,n) .


Invision Support
#Invision on irc.irchighway.net
Joined: Mar 2004
Posts: 526
Fjord artisan
Offline
Fjord artisan
Joined: Mar 2004
Posts: 526
Originally Posted By: Riamus2
... //run links.txt .


Is that what you meant to type ?


Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yes, why? Assuming you have .txt assigned to open in something, that will open the file if it exists in the location that he currently is trying to $read from. If you're talking about the period after it, that's just the end of the sentence, which is why it's spaced away from the command. I could have colored the command to make it stand out, but I didn't end up doing that.


Invision Support
#Invision on irc.irchighway.net
Joined: Mar 2013
Posts: 17
L
LCX Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Mar 2013
Posts: 17
I wanted to thank all those that assisted me in making this script work. I was able to get it to successfully work. Thanks again.


Link Copied to Clipboard