mIRC Home    About    Download    Register    News    Help

Print Thread
#223452 25/07/10 04:42 AM
Joined: Jan 2009
Posts: 25
F
Fernin Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jan 2009
Posts: 25
Two questions, unrelated to each other...

First off, I have a text file that I select a random line from using the $read() command, after which I was hoping to use remini to delete the line that it randomly selected. However, it looks like remini wants to know exactly what it's removing and can't go based on a variable input. Any ideas how to get this to work? (Before anyone suggests it, I did consider making it a variable and using $gettok and $remtok, for about a half second. There's over a thousand lines in the text file, and each line is usually numerous words, no way I'm taking the time to put it all into a single variable)

The other, entirely unrelated question is, is it possible to set up an emoticon as a kick trigger? As an example, I have this set up:
Code:
on 1:text:*Secret Illegal Drug Smuggling Operation*:#: {
  .kick $chan $nick Bad things happen to those who ask questions about things that don't exist. 
}

I know I can't include a ":" inside there for it to look for, and including a $chr() in there doesn't work, either. Any way possible for it to work?

Fernin #223454 25/07/10 05:35 AM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
For the second question, you need to use the $() in the text match section. For example:
Code:
on *:text:$($+($chr(58),$chr(41))):#:{
This will match the emoticon:
Quote:
smile
If you know regex, you can do this with octal numeric characters or the escape character easily to match several emoticons more efficiently.

Fernin #223457 25/07/10 07:12 AM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
For your first question you need to look at:
/help /$readn
/help /write

Fernin #223465 25/07/10 03:38 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If the file you're trying to remove lines from is an INI file, then removing a random line risks making the INI file invalid. Just something to keep in mind that you'll need to work around. If it's a text file, use

/write -dl $readn file.txt


Invision Support
#Invision on irc.irchighway.net
Fernin #223471 25/07/10 06:00 PM
Joined: Jan 2009
Posts: 25
F
Fernin Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jan 2009
Posts: 25
Thanks much, Tomao and Riamus2.

Riamus2 #223473 25/07/10 06:52 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Riamus2, I believe you meant:

/write -dl $+ $readn file.txt

OR

/write $+(-dl,$readn) file.txt

There should be no space between the switches and the line number to delete.

Tomao #223475 25/07/10 08:22 PM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
there shouldn't, but it works fine with the space there (as with -s -w and -r).


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Tomao #223477 25/07/10 08:59 PM
Joined: Jan 2009
Posts: 25
F
Fernin Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jan 2009
Posts: 25
I tried what Riamus2 had, it worked fine for me. Looks like it works either way.

Tomao #223478 25/07/10 09:04 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Like jaytea said, yes, you can use it without a space.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard