mIRC Home    About    Download    Register    News    Help

Print Thread
#133785 25/10/05 06:35 AM
Joined: Aug 2005
Posts: 14
Eddy2k5 Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Aug 2005
Posts: 14
k, db looks like rls\$ctime section

the problem i got it say the same rls 5times in a row but it should say the matches or on !dupe *
it should say the last 5 presents. ive been trying and trying and cant it get fixed thats why i go on inet with it. my last try.
and if only one result is found it should halt but it loop the same rls again..

Code:
on *:TEXT:!dupe *:#: {
  if ($2 == $null) {
   msg $chan 10-> SEARCHING FOR SOMETHING WOULD HELP! 10<-
    halt
  }
  else {
  set %x 1
  set %y 0
  while (%x <= 5) {
  set %var001 $read(db.txt, w, * $+ $replace($strip($2),$chr(32),*) $+ *,%y)
  set %y $calc($readn+1)
  inc %x
   if ($gettok(%var001,1,92) == $null) {
     msg $chan 10-> NOTHING More  10<-
    }
    else {
     msg $chan 10-> $gettok(%var001,1,92) 10|07 $+ $gettok(%var001,2,32) $+ 10|07 $+ $replace($duration($calc($ctime - $gettok(%foundline,2,92))),days,d,day,d,hrs,h,mins,m,secs,s,wks,w) $+ 10|07 $+ $asctime($gettok(%var001,2,92),ddmm-yyyy $+ ) $+ 10|
  }
}

 


and some small things is when i do !dupe aaaaaaaaaaaaaaaaaa
it says -> NOTHING Found! <- 5times is it possible to make it to say one time?

best regards Andreas

Last edited by Eddy2k5; 25/10/05 06:38 AM.
#133786 25/10/05 01:12 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
1) You aren't unsetting %var001. So, if you had one match, then the remaining times through, it will still have a value, even if there isn't a match. That's why it is not going to the "no more" section.

2) You need to halt the script, or BREAK out of the while loop, if you hit the "no more" section. Otherwise, it will repeat until you get to the 5th round of the loop.

3) You should use RETURN to halt a script prematurely, rather than HALT.

4) You probably don't need to SET a variable... I think your variables are all local and not global. Use VAR instead for all your variables.

5) I made a similar search script (though, mine is really a remade @find script that output all the data from anyone who has files to a single query window). Anyhow, I would recommend changing your replace so that it replaces spaces with ? instead of *. That allows you to search for something like Star Wars, and get results for Star_Wars and Star-Wars and Star Wars (and so on). Otherwise, you can also get results for something like Star Trek - The Klingon Wars. (I don't think that's a real name of a show/movie/book, but it's just an example).

Example:
/var %x = 1


For additional help on these commands:
/help /var
/help /return
/help /break
/help /unset

Last edited by Riamus2; 25/10/05 01:22 PM.

Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard