mIRC Homepage
Posted By: nexux Read file to mirc - 16/10/15 07:14 PM
My code is

Code:


on *:TEXT:!leer:*: {
  notice $nick Completo
  msg $nick - Completo
  var %c = 1, %line
  while (%c <= $lines(leer.txt)) {
    set %line %line $+ $iif(%line,$chr(44)) $read(leer.txt,%c)
    if ($numtok(%line,44) >= 20) {
      notice $nick %line $+ ,
      unset %line
    }
    inc %c
  }
  if (%line) msg $nick %line $+ .
  msg $nick - Completo Fin
}




But, not working :S

My file leer.txt contain

Code:
blablabla - blablab1 - nick1
blablabla - blablab1 - nick1
blablabla - blablab2 - nick2


I have to search in my text file leer.txt

Nick2 : !search nick1
Bot: result search 2 found Nick1

How make an script work?

My code is:

Code:
on *:text:!search *:#:{
  notice $nick [Found]-> $read(leer.txt)
}


But no working

My code is:



Code:
on *:TEXT:!search*:#: {
  $readn = $read(leer.txt,w,$+(*,$2-,*))
  if ( $readn != 0 ) {
    set %find $readn
    notice $nick Found--> $read(leer.txt, %find $+ )
    set %calcfind $calc(%find + 1)
    $readn = $read(leer.txt,w,$+(*,$2-,*), %calcfind)
    set %findn $readn
    notice $nick Found--> $read(leer.txt, %findn $+ )
    set %calcfind2 $calc(%find + 2)
    $readn = $read(leer.txt,w,$+(*,$2-,*), %calcfind2)
    set %findn2 $readn
    notice $nick Found--> $read(leer.txt, %findn2 $+ )
    set %calcfind3 $calc(%find + 3)
    $readn = $read(leer.txt,w,$+(*,$2-,*), %calcfind3)   
    set %findn3 $readn
    notice $nick Found--> $read(leer.txt, %findn3 $+ )
    set %calcfind4 $calc(%find + 4)
    $readn = $read(leer.txt,w,$+(*,$2-,*), %calcfind4)
    set %findn4 $readn
    notice $nick Found--> $read(leer.txt, %findn4 $+ )
    notice $nick These Are The First Five Results For $2-
  }
}


Not working
Posted By: OrFeAsGr Re: Read file to mirc - 16/10/15 07:56 PM
If you have less than 20 lines in leer.txt that's the reason it isn't working. If not try replacing this line
Code:
set %line %line $+ $iif(%line,$chr(44)) $read(leer.txt,%c)

With this:
Code:
set %line $addtok(%line,$read(leer.txt,%c),44)

For the Search Script use this
Code:
On *:text:!search &:#: {
var %x = 1
while (%x <= $lines(leer.txt)) {
var %f = $read(leer.txt,%x)
var %t = $gettok(%f,3,45)
if ($strip($2) == %t) {
inc $+(%,res,$strip($2)) 1
}
inc %x
}
msg $chan $($+(%,res,$strip($2)),2) Results Found For $strip($2) 
unset $+(%,res,$strip($2))
}
Posted By: nexux Re: Read file to mirc - 16/10/15 08:01 PM
I'll try and then tell you!

Thank you!!
Posted By: nexux Re: Read file to mirc - 19/10/15 11:54 AM
No working !search

Code:
On *:text:!search &:#: {
var %x = 1
while (%x <= $lines(leer.txt)) {
var %f = $read(leer.txt,%x)
var %t = $gettok(%f,3,45)
if ($strip($2) == %t) {
inc $+(%,res,$strip($2)) 1
}
inc %x
}
msg $chan $($+(%,res,$strip($2)),2) Results Found For $strip($2) 
unset $+(%,res,$strip($2))
}
© mIRC Discussion Forums