mIRC Home    About    Download    Register    News    Help

Print Thread
#252399 08/04/15 01:56 PM
Joined: Mar 2015
Posts: 4
L
Lejonel Offline OP
Self-satisified door
OP Offline
Self-satisified door
L
Joined: Mar 2015
Posts: 4
i'm trying to do a if(%id !isin $read(id.txt))

if (%id !isin $read(id.txt)) {
var %file = scripts/blah/id.txt
var %a = write %file
%a %id
}

%id is part of a socket that takes id:s from urls.
so if the %id isin id.txt i don't want it to write it again.
id.txt:
1fb26ee
e84086
etc etc


my brain is gone.

Lejonel #252403 08/04/15 03:24 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
if (!$read(%file,w,%id)) {
  write %file %id
}


Unordered text files are not efficient, I would suggest using hash tables for this purpose.

Joined: Mar 2015
Posts: 4
L
Lejonel Offline OP
Self-satisified door
OP Offline
Self-satisified door
L
Joined: Mar 2015
Posts: 4
What's %file in your solution?
and where do i put /hmake or /hadd.

this is my socket:

Code:
on *:sockread:ann {
  m_error.check sockread
  var %s
  sockread -f %s
  if (*/* *-* *:* iswm %s) { set %date $gettok($gettok(%s,1,32),-1,62) | set %time $gettok($gettok(%s,3,32),1,60) }
  if (%date >= $date(dd/mm) && %time >= $time) {
    if ( href isin %s ) { 
    set %id $gettok($gettok(%s,2,95),1,46) 
    if (%id !isin $read(id.txt)) { 
    var %file = scripts/blah/id.txt
    var %a = write %file
     %a %id 
     }
    }
  }
}


Brain is now known as B|Gone


Link Copied to Clipboard