mIRC Home    About    Download    Register    News    Help

Topic Options
#160197 - 24/09/06 01:56 AM HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
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


Edited by chump (24/09/06 02:08 AM)

Top
#160198 - 24/09/06 02:28 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
Code:
;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)

Top
#160199 - 24/09/06 02:41 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
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.

Top
#160200 - 24/09/06 02:54 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
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.
Code:
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)

Top
#160201 - 24/09/06 03:08 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
Posts: 35
thanks for your help so far smile 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 smile

Top
#160202 - 24/09/06 03:23 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
Your Welcome. Anything else don't hesitate to ask.
_________________________
We don't just write the scripts, we put them to the test! (ScriptBusters)

Top
#160203 - 24/09/06 03:35 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
Posts: 35
how can i change it to do what i want to do in above post?

Top
#160204 - 24/09/06 05:48 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
oh, I thought that solved your problem. Sorry, eh could you explain exactly what your wanting it to do? Little more detail? frown

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)

Top
#160205 - 24/09/06 06:03 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
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 frown


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 smile

Top
#160206 - 24/09/06 06:27 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
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)

Top
#160207 - 24/09/06 06:28 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
Posts: 35
sweet thx m8..i appreciate it..this part of it is the only part i cant crack :\

Top
#160208 - 24/09/06 06:46 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
textfile.txt has the following lines:
-FQM
-LOL
-RIVER

Code:
on *:text:*:#test: {
  if (($nick == bot) &amp;&amp; (bot1 == $me)) {
    var %text = $1-
    var %filename = textfile.txt
    var %filelines = $lines(%filename)
    var %found = false, %foundline, %matched, %i = 1
    while (%i &lt;= %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:
&lt;bot&gt; TV-XVID 7th.Heaven.S10E18.Invitation.to.Disaster.PDTV.XviD-FQM. Fill the boat chump.
&lt;bot1&gt; 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 smile?
_________________________
We don't just write the scripts, we put them to the test! (ScriptBusters)

Top
#160209 - 24/09/06 06:52 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
Posts: 35
ummm there must be a prb with my mirc sumwhere..its still telling me not found :\

Top
#160210 - 24/09/06 06:56 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
what is the exact location of the text file?
_________________________
We don't just write the scripts, we put them to the test! (ScriptBusters)

Top
#160211 - 24/09/06 06:57 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
Posts: 35
its my my main excursion folder..hold that ist working now smile
and by the looks of it..ist working [email]f@@king[/email] great just waht i was looking for...cant thank you enough m8 smile


Edited by chump (24/09/06 07:00 AM)

Top
#160212 - 24/09/06 07:01 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
hrm, weird. But cool smile. Again welcome.
_________________________
We don't just write the scripts, we put them to the test! (ScriptBusters)

Top
#160213 - 24/09/06 07:04 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
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?

Top
#160214 - 24/09/06 07:16 AM Re: HELP WITH A $READ FILE
Scorpwanna Offline
Fjord artisan

Registered: 20/09/03
Posts: 261
Loc: Arkansas, US
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)

Top
#160215 - 24/09/06 07:20 AM Re: HELP WITH A $READ FILE
chump Offline
Ameglian cow

Registered: 24/09/06
Posts: 35
cool smile thx again

Top