mIRC Home    About    Download    Register    News    Help

Print Thread
Script Help #1262 12/12/02 03:58 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
I am trying to track all ops in my channel to see who has been in the channel. this script I wrote writes all the ops into op.txt but it duplicates the ops within the text. What is wrong with this script?

on *:OP:#Mychan: {
var %i = 0
while (%i <= $lines(op.txt)) {
if ($opnick !isin $read(op.txt,%i)) {
write op.txt $opnick
halt
}
else { inc %i 1 }
}
}




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Script Help #1263 12/12/02 04:09 AM
Joined: Dec 2002
Posts: 144
D
Dana Offline
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2002
Posts: 144
Try this:
Code:
On *:OP:#channel:{
  var %i = 1
  while (%i &lt;= $lines(op.txt)) {
    if ($opnick !isin $read(op.txt,%i)) { inc %i }
    else { return }
  }
  write op.txt $opnick
}


"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
Re: Script Help #1264 12/12/02 04:56 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
Thanks works great now i can track all my ops to see who joins my channel and which ops i need to remove. laugh




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Script Help #1265 12/12/02 12:24 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
if the first word in the op.txt file on each line is a persons nickname then why not just do:

Code:
on *:OP:#:{
if (!$read(op.txt,s,$nick)) {
write op.txt $nick
}
}


otherwize, if the nicknames are on each line, but arent at the start, or are jumbled in with other text on the same line, like time and date of the op, along with the channel name or something, then you can do a wildcard search for the nick on the line:

Code:
on *:OP:#:{
if (!$read(op.txt,w,* $+ $nick $+ *)) {
write op.txt $nick with whatever other data you want
}
}


no need to use a loop at all, just think, what if your text file becomes quite large, then you have to loop through ALLL the lines in the file to make sure it isnt in there, slows down mirc alot more wink

Re: Script Help #1266 12/12/02 01:55 PM
Joined: Dec 2002
Posts: 143
A
Aubs Offline
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
Wouldn't it be better for you to use an .ini file?

then you could log more details that would take just as much time and (I'd have thought) not much more processing time eg Nick=time:host:NickOpedBy:TheirHost

so when if you had:
Code:
on *:OP:#Mychan: {
  /writeini -n logging.ini op $nick $+($ctime,:,$right($address($nick,0),-2),:,$opnick,$right($address($nick,0),-2))
}

you get the folowing for example:

  • [op]
  • NightChillz=1039699127:nc@host.com:ChanServ:services@dal.net
  • Aubs=1039699727:aubs@aubs.port5.com:NightChillz:nc@host.com


this way, when you use /writeini if the nick already exists in [op] it is automatically overwritten

Don't know if this is too much info, but I thought it may have been a good idea wink you could also use it for bans/kicks/voice etc...

Hope it's not too much!!!

Last edited by Aubs; 12/12/02 02:04 PM.

Aubs.
cool

Re: Auto Ops Tracker #1267 12/12/02 05:16 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
Thanks everyone for your imput. My main idea for this script was to track ops who didn't show up in my channel. now I created a script that tracks the ops an who oped them and the time they were opped and adds then nick to a mirc auto op. I like the idea of over writing the last time the op came into the channel to maintain a current list. It helps when running a large channel to track ops who never come to a channel.

menu @Ops {
Auto Add Autoop %auto.op :{ if ( %auto.op == ON ) { set %auto.op OFF | /.auto OFF | /echo 1 1415 12 Auto Ops 4OFF.... } | else { set %auto.op ON | /.auto ON | /echo 1 1415 12 Auto Ops 4ON.... } | { Halt } }
-
Ops List:/run op.txt
-
Clear:/clear @Ops
-
Close:/window -c @Ops
}
ON *:OP:#Mpglovers: {
var %i = 1
while (%i <= $lines(op.txt)) {
if ($opnick !isin $read(op.txt,%i)) { inc %i }
else { return }
}
if ($window(@Ops) == $null) { //window -el @Ops }
aline @Ops 2Op3 ->12 $opnick 2-5 $asctime(ddd mmm d hh:nn:ssTT) 2-4 $nick
write op.txt $opnick - $asctime(ddd mmm d hh:nn:ssTT) - $nick
if (( %auto.op == ON ) && ( $nick == Chanserv )) { /auto $opnick # 1 }
}




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Auto Ops Tracker #1268 13/12/02 01:11 AM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
Yeah ok, but like i said, when you run the while loop, if your file is large then you may lag your script if it has to scan the whole file just to see if the nick isnt in the file, the better way to do what you want is either the way i showed you, or the way aubs showed you, both would suffice just fine,

i made the on i gave you because you said you only wanted to add the nick if it wasnt already there,

the one he showed, will update the information each time the same nick is opped, but only have one entry for the nick,


[color:blue]both our formats to get what you want are fine, just depends on what exactly you want, but what your doing is like i said, may lag your script, and cause things to "malfuction" if the file is too large, and every time someone gets opped, it has to read EACH line from the file, cause thats what it does![color]