|
Joined: Jul 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2003
Posts: 27 |
I'm trying to write all online/offline nicks to a txt file....im writing them (online/offline) to a .txt file and want to delete any of the matches if they are offline and leave only 1 and if that nick isnt online for another server...heres what im using so far...any help greatly appreciated:
code: alias list.notifys { write -c notify.txt var %x = 1 while $scon(%x) { scon %x var %notify = 1 while ($notify(%notify)) { if ($notify(%notify).ison) { echo -s Online: $notify(%notify) ( $+ $notify(%notify).note $+ ) write notify.txt $server Online: $notify(%notify) } else { echo -s Offline: $notify(%notify) ( $+ $notify(%notify).note $+ ) write notify.txt Offline: $notify(%notify) } inc %notify } inc %x } }
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
not 100% sure I understand 1. you wanna write to file if they are online or offline, but only 1 entry per user, which network they're on doesn't matter 2. if a user is already listed as ofline, but you find him online somewhere else you wanna overwrite 3. if a user is online but offline somewhere else you do not wanna overwrite That right? If so, I suggest you switch to an inifile or hashtable. Both have the advantage they only allow one of each item, which makes overwriting simple.
if ($notify(%notify).ison) && ($readini([color:blue]filename.ini[/color],[color:blue]SECTION[/color],$notify(%notify) == offline)) {
writeini [color:blue]filename.ini[/color] [color:blue]SECTION[/color] $nick online $notify(%notify).note
}
elseif (!$readini([color:blue]filename.ini[/color],[color:blue]SECTION[/color],$notify(%notify)) {
writeini [color:blue]filename.ini[/color] [color:blue]SECTION[/color] $nick online $notify(%notify).note
}
This will, if the nick is online, check if he is listed as offline in the inifile, and change that if he is. If he already is listed as online, we will skip rewriting that info. If he is not online, we don't need to do anything -- if he is written as online, we don't want to change that, and if he is listed as offline we don't need to change that, so we don't need to use an else... We just need an else to check if the user has not been written yet when found offline, so we write him as offline then. The $notify(nick).note you added remains in tact in the inifile...
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Jul 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2003
Posts: 27 |
well what im trying to get at is list the notifies just like your default notify list is in mIRC for multiple servers ie: irc-m07.icq.com chanserv nickserv memoserv me calvino.freenode.net chanserv nickserv memoserv me Offline nick nick
i can get the online ones no prob for each server just the offlines are a lil more tricky....cause you have to make sure the nick isnt online say for another server and offline for another...hope this explains what im after
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
So you only want the list of nicks, but each nick should appear only once? If the list is small, you can simply dump it into a variable then:
alias list.notifys {
var %x = 1
while $scon(%x) {
scon %x
var %notify = 1
unset %list
while ($notify(%notify)) {
%list = $addtok(%list,$notify(%notify),32)
inc %notify
}
inc %x
echo -a notified nicks for $server : %list
}
}
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Jul 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2003
Posts: 27 |
well the object of this is to make my own window docked on the left side of my mIRC showing each servers Online nicks and the remaining as Offline....just need steered in the right direction of how to delete a notify nick from say my hastable/ini file if the nick is online on another server im on ..now heres what i got: code: alias list.notifys { var %x = 1 while $scon(%x) { scon %x var %notify = 1 while ($notify(%notify)) { if ($notify(%notify).ison) { echo -s $server Online: $notify(%notify) } inc %notify } var %unotify = 1 while ($notify(%unotify)) { if (!$notify(%unotify).ison) { echo -s $server Offline: $notify(%unotify) } inc %unotify } inc %x } } which will show in my status: irc-m07.icq.aol.com Online: ChanServ irc-m07.icq.aol.com Online: MemoServ irc-m07.icq.aol.com Online: NickServ irc-m07.icq.aol.com Online: |3|acK_Kn|G||T irc-m07.icq.aol.com Offline: God irc-m07.icq.aol.com Offline: Jason irc-m07.icq.aol.com Offline: {Sweet-N-Sassy}
calvino.freenode.net Online: ChanServ calvino.freenode.net Online: MemoServ calvino.freenode.net Online: NickServ calvino.freenode.net Online: |3|acK_Kn|G||T calvino.freenode.net Offline: God calvino.freenode.net Offline: Jason calvino.freenode.net Offline: {Sweet-N-Sassy}
...now i need to combine the offlines and delete say one of the notifys if theres 2 showing as offline or if say theres one showing offline on one server and the notify is online on another...hope i didnt lose you yet..lol
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
Maybe this is what you mean? It should output something like: online on servername1 : nicks-that-are-onlineonline on servername2 : nicks-that-are-onlineonline on servername3 : nicks-that-are-onlineoffline : nicks-that-are-not-online-on-any-server
alias list.notifys {
var %x = 1
while $scon(%x) {
scon %x
var %notify = 1
while ($notify(%notify)) {
if ($notify(%notify).ison) $+(%,online,%x) = $addtok$+(%,online,%x),$notify(%notify),32)
elseif (!$istok(%offline,$notify(%notify),32) %offline = $addtok(%offline,$notify(%notify),32)
inc %notify
}
inc %x
}
%x = 1
while $scon(%x) {
scon %x
echo -s online on $server : $eval($+(%,online,%x),2)
inc %x
}
echo -s offline: %offline
unset %online* %offline
}
Should work if I didn't mess up anything.
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Jul 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2003
Posts: 27 |
well i went to hashtables which is faster anyways....heres what i got...but im tryin to delete the offline nick if its online for another server but its not /hdel the nick from the offline hashtable if its there....i pry have the code wrong but im not getting any errors tho code: alias list.notifys { hfree -w offline hfree -w *.com hfree -w *.net hmake offline var %x = 1 while $scon(%x) { scon %x hmake $server var %unotify = 1 while ($notify(%unotify)) { if (!$notify(%unotify).ison) { hadd -m offline $notify(%unotify) echo -s Offline: $notify(%unotify) } inc %unotify } var %notify = 1 while ($notify(%notify)) { if ($notify(%notify).ison) { if ($hfind(offline,$notify(%notify),w) == 0) { hadd -m $server $notify(%notify) } else { hdel -w offline $notify(%notify) } echo -s $server Online: $notify(%notify) } inc %notify } inc %x } }
any help please?
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
Before I spend more time on this two things:
1. the code I gave you last, does that do sorta what you want to do?
2. one big problem you have with your code that keeps coming back is that you echo the nick the moment you are detecting it is offline, therefor it will always echo regardless of whether he's online on another server. You have to fix that the way I described in my last post.
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Jul 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2003
Posts: 27 |
Well yes it echoes the online/offline for each server im on to there status windows..but when it /hadds them itll list the online for the certain server and list offline all offlines for every server /hadd wont add info twice so im set there...heres what im getting in ircqnets status Offline: God Offline: Jason Offline: {Sweet-N-Sassy} irc-m04.icq.aol.com Online: ChanServ irc-m04.icq.aol.com Online: MemoServ irc-m04.icq.aol.com Online: NickServ irc-m04.icq.aol.com Online: |3|acK_Kn|G||T
and in freenodes
Offline: God Offline: {Sweet-N-Sassy} Offline: |3|acK_Kn|G||T sterling.freenode.net Online: ChanServ sterling.freenode.net Online: Jason sterling.freenode.net Online: MemoServ sterling.freenode.net Online: NickServ
but in the hashtable all ill get for offline is God,Jason,{Sweet-N-Sassy},|3|acK_Kn|G||T
what i need to do now is delete the nick from offline hastable if the nick is online for another server....and the code ya showed earlier i got errors with the elseif and a %NOTIFY1 and %NOTIFY2 error
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
I really should urge you to switch to my variables based script and leave the hash tables. You are only saving very little data. Hash tables are designed for large amounts of data, and there is nothing to gain when you only have small amounts of data. The elseif error is fixed by adding a ) at the designated place. What exactly are the other errors you get?
elseif (!$istok(%offline,$notify(%notify),32[color:red])[/color])
Actually it will need some extra fixing: everytime you add a nick to %onlineN, check if it is in %offline via the $istok identifier similar to what I used, and if found, use $deltok or $remtok to delete the nick from %offline.
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Jul 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2003
Posts: 27 |
heres what im getting for errors in my status:
online on irc-m04.icq.aol.com : - %ONLINE1 Unknown command - %ONLINE1 Unknown command - %ONLINE1 Unknown command - %ONLINE1 Unknown command
representing the 4 onlin nicks and..
online on sterling.freenode.net : offline: God Jason {Sweet-N-Sassy} - %ONLINE2 Unknown command - %ONLINE2 Unknown command - %ONLINE2 Unknown command - %ONLINE2 Unknown command
for the 4 online for that server
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
Hmm. remote debugging. neat. There should be a ( after the $addtok and before the $+ in my line 7.
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Jul 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2003
Posts: 27 |
already tryed that...with same results
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
Ok, it took some time, but this works for me:
alias list.notifys {
[color:green]; ------------------------------------------------------------------------------[/color]
[color:green]; This part reads the nick's statuses[/color]
[color:green]; ------------------------------------------------------------------------------[/color]
[color:green] [/color]
[color:green]; set number of connections[/color]
var %x = $scon(0)
[color:green]; loop through the connections[/color]
while (%x) {
[color:green]; set active connection[/color]
scon %x
[color:green]; set number of notified nicks[/color]
var %notify = $notify(0)
[color:green]; loop through the nicks[/color]
while (%notify) {
[color:green]; if online, add to %onlineN (N = connection id)[/color]
if ($notify(%notify).ison) set $+(%,online,%x) $eval($+(%,online,%x),2) $notify(%notify)
[color:green]; if not, add the user to %offline[/color]
elseif (!$istok(%offline,$notify(%notify),32)) set %offline %offline $notify(%notify)
dec %notify
}
dec %x
}
[color:green] [/color]
[color:green]; ------------------------------------------------------------------------------[/color]
[color:green]; This part displays the online nicks[/color]
[color:green]; ------------------------------------------------------------------------------[/color]
[color:green] [/color]
[color:green]; set number of connections[/color]
var %x = $scon(0)
[color:green]; loop through the connections[/color]
while (%x) {
[color:green]; set active connection[/color]
scon %x
echo -a online users on $scon(%x).network :
[color:green]; set number of online nicks for this connection id[/color]
var %y = $numtok($eval($+(%,online,%x),2),32)
[color:green]; loop through the nicks[/color]
while (%y) {
[color:green]; display the nick[/color]
echo -a $gettok($eval($+(%,online,%x),2),%y,32)
[color:green]; if the nick is also listed in %offline, remove it[/color]
if ($istok(%offline,$gettok($eval($+(%,online,%x),2),%y,32),32)) set %offline $remtok(%offline,$gettok($eval($+(%,online,%x),2),%y,32),1,32)
dec %y
}
dec %x
}
[color:green] [/color]
[color:green]; ------------------------------------------------------------------------------[/color]
[color:green]; This part displays the offline nicks[/color]
[color:green]; ------------------------------------------------------------------------------[/color]
[color:green] [/color]
echo -a offline users :
[color:green]; set number of offline nicks[/color]
var %y = $numtok(%offline,32)
[color:green]; loop through the nicks[/color]
while (%y) {
[color:green]; display the nick[/color]
echo -a $gettok(%offline,%y,32)
dec %y
}
[color:green]; clean up your mess[/color]
unset %*line*
}
No doubt this isn't the cleanest version of the code, byt heck, it works.
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
|