Jump to content

Notify Listing Snippet Help


Josh`

Recommended Posts

Hello,

This really doesn't pertain just to IRCX I don't think, but I've been coding it for VSIXc, so I posted this here. Anyway, I'm trying to get a snippet to echo my notify list depending on their online/offline status. E.g. Here is my current notify list:

 

User1 (Online)

User2 (Offline)

User3 (Online)

 

What I want to do is make it so I can echo the notify list with the online users first and then the offline users. E.g.:

 

User1 (Online)

User3 (Online)

User2 (Offline)

 

the code I'm using is totally stumping me because the output of it is this:

 

err0r (Online)

ik000ike (Online)

ozzy10 (Online)

Warrior124 (Online)

X-Fusion (Online)

0 (Offline)

----------------------------------------------------------

 

Now that last person who is offline's name is really 'fdsa' yet the script is returning '0'. I don't know why it's returning 0, but it is. If anyone can take a look at my code, review it, edit and fix it, it would be greatly appreciated. Thanks to X-Fusion for giving me a handle on how to actually start this while loop. I never knew about $notify untill he told me about it. You will be credited in source code of a script that will never be released. :\

 

alias nlist.gen { 
 var %i 1
 var %x 0
 var %y 1
 while (%i <= $notify(0)) {
   if ($notify(%i).ison) {
     echo -a $notify(%i) (Online)
   }
   elseif (!$notify(%i).ison) {   
     set %notify.offline. $+ %x $notify(%i)
     inc %x
   }
   inc %i
 }
 while (%y <= %x) {
  ;echo -a %x
  ;echo -a %y
   echo -a $+(%notify.offline.,$calc(%y-1)) (Offline)
   unset %notify.offline. $+ %y
   inc %y
 }
 echo -a ----------------------------------------------------------
}

 

Thanks in advanced,

Josh

Link to comment
Share on other sites

Guest X-Fusion
Try to not to unset the last variable. Whenever you use the alias nlist.gen again, it will re-do the variable to correspond. So, you can try that. It doesnt look like you have an elseif or if for that, or a goto. So, that could be why its doing that. Just take out the unset, and see where that gets you.
Link to comment
Share on other sites

nope....this is now the output.

 

err0r (Online)

ik000ike (Online)

ozzy10 (Online)

X-Fusion (Online)

0 (Offline)

0 (Offline)

---------------------------------------------------------

 

Warrior124 and fdsa are offline.

Link to comment
Share on other sites

Guest X-Fusion

You can try something like this .. if your echoing it ...

on *:notify: { notify.list }
alias -l notify.list {
 var %i 1, %x 0
 while (%i <= $notify(0)) {
   if ($server) { 
     if ($notify(%i).ison) { echo -s $notify(%i).note | inc %x }
     elseif ($rini(notify.sort) != online) { echo -s $notify(%i).note }
   }
   else { echo -s $notify(%i) Offline $chr(9) $notify(%i).note }
   inc %i
 }
}

I know its not exactly how you wrote yours, but, you can edit it and i based all that off the aliases that I gave yesterday. You can try it, hopefully it works.

Link to comment
Share on other sites

Guest X-Fusion
No, go back and look at the alias I put yesterday. Put the directory with it. Would probably make things easier if you did it through an actual settings file like an ini.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...