|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
ok , i am working ona script ..and i want it to search the $read file from the ontext i specify to it i want it to use wildcard so it picks up what i have it my txt file, so if its in txt file it does the next cmd in my script..if it isnt in the txt file it does nothing..i hope yall understand what i am saying,ive tryed using the w, in the $read but it dosnt seem to be working..could any1 point me in the right direction..thx in advance .
the next cmd after it finds the wildcard match would be a msg to chan. at present it is messeaging chan on every line i try when it should just be doing it when it finds a match in the txt file
Last edited by chump; 24/09/06 01:08 AM.
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
;assume $1- == in
on *:TEXT:*:#: {
var %text = $1-
;using *text* will find whatever matches in a line
;using text* would match from beginning of line
;using *text * would match ending of word or area and have a space after that word
;using * text * matchs that word surrounded by spaces
;below you type "in" and if you have "info" or any word with i+n next to each other would be found)
;var %findtext = $read(learnt.txt,w,* $+ %text $+ *)
;below would match only "in" on the first line it finds it on
var %findtext = $read(learnt.txt,w, * %text *)
if (%findtext) {
msg $chan %text found on line $readn $+ : %findtext
}
if (!%findtext) {
msg $chan not found
}
}
I guess that would be something you're talking about. Hope that gets you somewhere.
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
on *:TEXT:TV-XVID*boat*:#test: { if ( $nick == bot && bot1 == $me ) { $read tv-test.txt { goto tv-xvid-group-nuke } goto end
:tv-xvid-group-nuke /msg #test 4[9AUTO-NUKE WARNING4] [GROUP NOT ALLOWED IN TV_XVID] [9 $left($strip($2), $calc($len($strip($2))-1)) 4 ] [9 30 SECONDS TO DELETE BEFORE NUKE X3 4 ] .timer $+ xvid 1 30 /msg #test-NUKE !nuke $left($strip($2), $calc($len($strip($2))-1))) 3 GROUP.NOT.ALLOWED echo -d 4Nuking xvid 8 $left($strip($2), $calc($len($strip($2))-1))) for GROUP NOT ALLOWED at 9 $time on $day goto end :end } }
this is what i have at present...it needs to search the line TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat dude.
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
hrm... This works for me, i created the file: tv-test.txt and these are the lines of that file: TV-XVID 7th.Heaven.S10E17.Horse.Camden.PDTV.XviD-FQM. Can of worms. TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat dude. TV-XVID 7th.Heaven.S10E19.Street.Corner.Confession.PDTV.XviD-FQM. Hookers are nice. Making sure that tv-test.txt file is in the mirc directory.
on *:TEXT:*:#test: {
if (($nick == bot) && (bot1 == $me)) {
;assuming what you type is: TV-XVID*boat
var %text = $1-
var %filename = tv-test.txt
var %readfile = $read(%filename,w, * $+ %text $+ *)
if (%readfile) { msg $chan found %text in %filename, on line $readn $+ : %readfile }
if (!%readfile) { msg $chan not found }
}
}
results as this: <bot> TV-XVID*boat <bot1> found TV-XVID*boat in on line 2: TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat dude.
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
thanks for your help so far i appreciate it my txt files contains just examples such as -FQM thats what i was trying to achieve so it searches this line TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat dude. and finds *-FQM* returns it
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
Your Welcome. Anything else don't hesitate to ask.
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
how can i change it to do what i want to do in above post?
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
oh, I thought that solved your problem. Sorry, eh could you explain exactly what your wanting it to do? Little more detail? Is this line in a text file? -> TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat dude. you want it to search the text file for *-FQM*? Then return the whole line that's matched?
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
ok my txt file contains -FQM -LOL -RIVER TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat chump. this is what the line is taken from bot etc etc in that format..on my ontext line i need it to read from whole line then find the -RIVER etc from the line in my txt file so it will execute the next cmd in script....the script posted kept telling me not found..even when i placed a direct match in the txt file..still told me not found Is this line in a text file? -> TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat dude. nope thats the bot saying that..onlt thing in my txt is -FQM -LOL etc etc
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
I think i'm following along, I'll do some coding and get back with you in a bit.
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
sweet thx m8..i appreciate it..this part of it is the only part i cant crack :\
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
textfile.txt has the following lines: -FQM -LOL -RIVER
on *:text:*:#test: {
if (($nick == bot) && (bot1 == $me)) {
var %text = $1-
var %filename = textfile.txt
var %filelines = $lines(%filename)
var %found = false, %foundline, %matched, %i = 1
while (%i <= %filelines) {
var %readfile = $read(%filename,%i)
if (%readfile isin %text) { %found = true | %foundline = $readn | %matched = %readfile }
inc %i
}
if (%found == true) {
msg $chan matched %text in %filename $+ , on line %foundline $+ : %matched
}
if (%found == false) {
msg $chan not found
}
}
}
Results:
<bot> TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat chump.
<bot1> matched TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat chump. in textfile.txt, on line 1: -FQM
Is that it ?
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
ummm there must be a prb with my mirc sumwhere..its still telling me not found :\
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
what is the exact location of the text file?
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
its my my main excursion folder..hold that ist working now and by the looks of it..ist working [email]f@@king[/email] great just waht i was looking for...cant thank you enough m8
Last edited by chump; 24/09/06 06:00 AM.
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
hrm, weird. But cool . Again welcome.
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
oo there was more lil thing..is it poss in the ontxt line to trigger it like *tv-xvid* etc and still have it read from the full line from bot?
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
It will match whatever line is in the file.
Say textfile.txt contains these lines: -FQM -LOL -RIVER tv-xvid tv.xvid-FQM etc...
if any of these are in any line recieved it will return it.
the bot says "some.show.tv-xvid-LOL" the script will search each line in the file and if "tv-xvid" is in what the bot said, then it should return matched. Many scripters would see this as a flawed way of getting the match correctly. But it works.
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Sep 2006
Posts: 35
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2006
Posts: 35 |
cool thx again
|
|
|
|
|