mIRC Home    About    Download    Register    News    Help

Print Thread
#255384 16/10/15 07:14 PM
Joined: Nov 2014
Posts: 27
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 27
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

Last edited by nexux; 16/10/15 07:29 PM.
nexux #255385 16/10/15 07:56 PM
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
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))
}

nexux #255386 16/10/15 08:01 PM
Joined: Nov 2014
Posts: 27
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 27
I'll try and then tell you!

Thank you!!

nexux #255392 19/10/15 11:54 AM
Joined: Nov 2014
Posts: 27
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 27
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))
}

Last edited by nexux; 19/10/15 11:57 AM.

Link Copied to Clipboard