mIRC Home    About    Download    Register    News    Help

Print Thread
#68820 22/01/04 01:26 AM
Joined: Dec 2003
Posts: 261
M
milosh Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Good morning/afternoon/evening/night. My question is: Is there a way to list all the users with the same level on my userlist? example, i need a list that looks like this:

Level 5 users: nick1, nick2, *!blabla@*exa.mp.le
Level 10 users: nick1, nick3, nick4
Level 15 users: nick2, nick5, nick6

Also, is there a way to list all the variables that are set and their values?

thanx!


velicha dusha moja Gospoda
#68821 22/01/04 01:33 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
/help $ulist

$ulist(*!*@*, 5, 0) - Total number of users at level 5
$ulist(*!*@*, 5, 1) - First user name with level 5


-KingTomato
#68822 22/01/04 01:42 AM
Joined: Dec 2003
Posts: 261
M
milosh Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Thanx a lot, KingTomato, that's what i needed... just didn't know where to search for it. :tongue:


velicha dusha moja Gospoda
#68823 23/01/04 12:21 AM
Joined: Dec 2003
Posts: 261
M
milosh Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Sorry, that doesn't work. frown When I do $ulist(*!*@*, %level, 0), I get 0 for every value of %level. And I have this in my userlist:

5:*!*bg@191.250.80.*
5:*!*bg@*.bg.ptt.yu

I could not solve this problem.
thanx!


velicha dusha moja Gospoda
#68824 23/01/04 06:02 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Use * to match any address.
  • $ulist(*,%level,0)


#68825 15/03/04 12:48 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
This is wierd...i tried to post this once, it appeared that it had been posted...but i dont see it smirk I'll try again..

That tip works great! I used it to do sth very much like to the /ulist command, but better looking :P
Code:
/listusers {
  set %level $$1
  set %uz 1
  echo -ag -
  echo -ag *** Beginning of List: User level %level
  while (%uz <= $ulist(*,0)) && ($ulist(*,%level,%uz).info != $null) {
    echo -ag User number %uz is $ulist(*,%level,%uz).info ( $ulist(*,%level,%uz) )
    inc %uz
  }   
  echo -ag *** End of List: Users level %level
  echo -ag -
}
Here i search and list the address and the name(info part) of the users with the level i choose.

Is ther anyway to search and list the users by the INFO part in the userlist?


"All we are saying is give peace a chance" -- John Lennon
#68826 15/03/04 02:27 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Not sure if you want to list ALL users of that level, or only if they have info set.

This lists all N level users if they have userlist info.
Code:
listusers {
  var %level = $$1, %uz = 1
  ; ^^ use /var to make local variables [color:green]/help local variables[/color]
  echo -ag -
  echo -ag *** Beginning of List: User level %level
  ; find all users of that level
  while $ulist(*,%level,%uz) {
    var %a = $ifmatch
    ; check for .info and display if it is there.
    if $ulist(%a,%level,1).info { echo -ag * %uz $+ : $ifmatch ( $+ %a $+ ) }
    inc %uz
  } 
  echo -ag *** End of List: Users level %level
  echo -ag -
}

#68827 15/03/04 08:54 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Everyone in my userlist has the INFO set... I put their nicks on the info part so i can be sure who is who there smile

I'm looking for something that looks only in the INFO part and that returns those who match the search..

For example, if i have John set as lvl 10 is would be
10:*!*userid@*.host John

Now, i want to see if John is already in my list.. so i'll have to look into the Info part for "John", and then i want the script to show me his level and address...
Is that possible and relatively simple? :P


"All we are saying is give peace a chance" -- John Lennon
#68828 15/03/04 09:42 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
listuser {
  var %i = 1
  while $ulist(*,%i).info {
    if $$1 == $ifmatch {
      echo -eag * Level $level($ulist(*,%i)) $ifmatch ( $+ $ulist(*,%i) $+ )
      return
    }
    inc %i
  }
  echo -eag * $1 was not found in the userlist
}

#68829 16/03/04 12:13 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
That's a very cool code, but on some cases i have more than one address for each user, and it wont look for the rest if it finds the 1st matching one..

Why wont this work?
Code:
/listuser {
  var %i = 1
  while $ulist(*,%i).info {
    if ($$1 == $ifmatch) {
      echo -eag * Level $level($ulist(*,%i)) $ifmatch ( $+ $ulist(*,%i) $+ )
    }
    elseif ($$1 != $ifmatch) {
      echo -eag * User $ifmatch was NOT found | halt
    }
    inc %i
  }
}


Thanks for the help! laugh


"All we are saying is give peace a chance" -- John Lennon
#68830 16/03/04 12:20 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Here ya go.. smile
Code:
listuser {
  var %i = 1,%x
  linesep -a
  while $ulist(*,%i).info {
    if $1 == $ifmatch {
      echo -ag * Level $level($ulist(*,%i)) $ifmatch ( $+ $ulist(*,%i) $+ )
      inc %x      
    }
    inc %i
  }
  if !%x { echo -ag * $1 was not found in the userlist }
  linesep -a
}


#68831 16/03/04 12:35 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
It works fantastic!! Thanks a lot! laugh

If it isnt much trouble, would you mind explaining me the use of the %x variable, please? smile

Thanks again for the huge help!!! laugh


"All we are saying is give peace a chance" -- John Lennon
#68832 16/03/04 12:59 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Sure, it is only to check that at least one match was found. If there was no matches, %x would be empty and !%x (!%x = NOT%x) would be $true, so you would want the "no matches" line echoed. laugh.

#68833 16/03/04 01:13 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oic... wink

Thanks again! laugh


"All we are saying is give peace a chance" -- John Lennon

Link Copied to Clipboard