|
Joined: Sep 2007
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2007
Posts: 7 |
Hi,
I'm trying to make a botscript, and one of his options must be something like this: When I type !list the bot scans a list of users (User List, level 1)and write on the $chan those who are NOT in the $chan and IS connected on the server.
I've been looking some info about that, and I didn't find anything, when I can find something lyke this?
Thanks a lot,
|
|
|
|
Joined: Jan 2006
Posts: 111
Vogon poet
|
Vogon poet
Joined: Jan 2006
Posts: 111 |
(1) If people have mode invisible on, your bot can't see them. (2) What do you want if 500 visible people are on the server and only 5 of them are in your channel? A list of 495 people?
Last edited by noMen; 10/09/07 05:38 PM.
|
|
|
|
Joined: Sep 2007
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2007
Posts: 7 |
Well, if they are invisible, what can I do?
The list is not so huge, they are nicks that usually enters in my channel, and I only want the bot to return me those are connected (the result will be small).
This is because they have a status in the channel, and I want to know if they want it or not.
Thanks
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
Unreal ircd (I tested only unreal) provides the "ison" command; you can look up at least a dozen nicks at once. Even if usermode +i is set you can /who the nicks... but if you're only interested in a reply of some nicks being online or not, use ison.
Scenario: Checking the nicks Mary Jack Susan Joe Paul. Online are: Susan and Paul
command: "/ison Mary Jack Susan Joe Paul" reply: "ison: Susan Paul" (thats raw 303; the nicks are token(s) $2-)
|
|
|
|
Joined: Jan 2006
Posts: 111
Vogon poet
|
Vogon poet
Joined: Jan 2006
Posts: 111 |
It is a good idea to look only for people that you know. Note that /whois <partialnick>* and /who <partialnick>* give more results, especially when people who you are looking for changed their nick into something like nick|away or nick_gone. They only "problem" is that /whois and /who can only be applied to one nick at the time.
|
|
|
|
Joined: Sep 2007
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2007
Posts: 7 |
Thanks for answer but, haw can I scan for all users from User List ? I've been trying some but it fails?, any example please?
Thanx
|
|
|
|
Joined: Sep 2007
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2007
Posts: 7 |
Well, any way to scan each user in user list at level 1 to look if he is online and in the $chan or any example to do what I ask for?
Thanks a lot.
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
To perform something on all level 1 users, the essence is a loop like: while ($ulist(*,1,%nr)) {
- do something with $ifmatch -
inc %nr
} Here's a script using /ison (hope your network features that command ) It's looking up all users with level 1, that is their nicknames, as /ison works only with nicks. Enter your channels name for "#channel" at the initial line. on *:text:!list:#channel: {
set %ison.chan $chan
; set variables (containing strings of nicks) for all users in the users list
; that have user-level "1" and that are not on %ison.chan
var %u.nr = 1, %v.nr = 0
while ($ulist(*,1,%u.nr)) {
var %nick = $gettok($v1,1,33)
if ((!$regex(%nick,/\*/)) && (%nick !ison %ison.chan)) {
; each var holds max. 12 nicks
if ((!$($+(%,ison.checkstring.,%v.nr),2)) || ($numtok($($+(%,ison.checkstring.,%v.nr),2),32) > 11)) { inc %v.nr }
set -e $+(%,ison.checkstring.,%v.nr) $addtok($($+(%,ison.checkstring.,%v.nr),2),%nick,32)
}
inc %u.nr
}
; no var had been set? (are no nicks with level 1 absent on %chan?)
if (!$($+(%,ison.checkstring.,1),2)) { MSG %ison.chan Nobody is absent. }
; else perform an ison commandm start with the first string (first variable)
else {
.enable #isonusers
ison $($+(%,ison.checkstring.,1),2)
}
}
#isonusers off
; ison reply
raw 303:*: {
; set variables for all looked-up nicks that are on the net
var %ison = $2-, %n.nr = 1
while ($gettok(%ison,%n.nr,32)) {
var %nick = $v1, %v.nr = $var(ison.users.*,0)
; again, each var holds max. 12 nicks
if ((!$($+(%,ison.users.,%v.nr),2)) || ($numtok($($+(%,ison.users.,%v.nr),2),32) > 11)) { inc %v.nr }
set -e $+(%,ison.users.,%v.nr) $addtok($($+(%,ison.users.,%v.nr),2),%nick,32)
inc %n.nr
}
; unset the var (nickstring) of the nicks that had been just looked up
unset $var(%ison.checkstring.*,1)
; continue with the next nickstring until all strings (all users) had been looked up.
if ($var(%ison.checkstring.*,1)) { ison $($v1,2) }
; all nicks had been looked up
else {
; output results: had a var been set? (are some of the absent nicks on the net?)
if ($($+(%ison.users.1))) {
MSG %ison.chan The following users are absent on %ison.chan but are on the network right now:
var %v.nr = 1
while ($var(%ison.users.*,%v.nr)) {
MSG %ison.chan $($v1,2)
inc %v.nr
}
}
else { MSG %ison.chan None of the absent users are on the network right now. }
.disable #isonusers
unset %ison.*
}
; halt the output of the default ison reply
haltdef
}
#isonusers end After writing this, I cannot deny myself stating that the notify list would be a more apt place to store nicks for checking whether or not they are connected right now: $notify(NICK).ison
Last edited by Horstl; 12/09/07 09:36 PM.
|
|
|
|
Joined: Sep 2007
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2007
Posts: 7 |
Thanks for the code, but it doesn't work, it allways returns me a Nobody is absent. message. The userlist I have is set 1:trynick , this nick is not connected, and my nick 1:guaitaku, that is on the channel and finally a connected nick that is not in the chan and level 1.
My problem is that it looks like it don't looks the user list.
Thanks
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
Try this
alias scan.users {
set -e %#userscan #CHANNEL
set -e %#userlevl 1
var %i = 1,%a,%b,%t = 1
while $ulist(*,%#userlevl,%i) {
var %b = $gettok($v1,1,33)
if * isin %b { inc %i | continue }
if %b !ison %#userscan { var %a = %a %b }
inc %i
if $numtok(%a,32) == 40 || !$ulist(*,%#userlevl,%i) || $len(%a) > 470 {
inc -e %#userlist
var %a,%t = %t + 1
.enable #userlist
$iif(%t > 2,.timer 1 $calc(%t -2)) ison %a
}
}
}
#userlist off
raw 303:*:{
echo -itc info %#userscan * Users online but not on %#userscan : $iif($2,$2-,None.)
dec %#userlist | if !%#userlist { .disable #userlist | unset %#user???? }
halt
}
#userlist end
Note: There may be more than one "Users online but not on #.." echo if you have a lot of level 1 users in your userlist You must change what is below in red- set -e %#userscan #CHANNEL
Change #CHANNEL to your channel name - set -e %#userlevl 1
Change the 1 to the userlevel you need.
Also, I used 40 as the number of users for each /ison command. This shouldn't need to be changed, from my experience (more than) 40 is acceptable on most networks. - if $numtok(%a,32) == 40 || !$ulist(*,%#userlevl,%i) || $len(%a) > 470 {
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
My problem is that it looks like it don't looks the user list. Hum worked for me. To verify this, change "set -e $+(%,ison.checkstring.,%v.nr) " to: "set - se $+(%,ison.checkstring.,%v.nr)" (this var is a list of those users with level1 not being on #channel, thus you should see an echo in the status window) deegee used that approach as well, having just a different flood protection method
|
|
|
|
Joined: Sep 2007
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2007
Posts: 7 |
The code from Horstl, I 've changed the -e to -se and didn't change anything.
The other code, it says, in status, ISON Not enough parameters
I'm having so many problems...sorry
Anyway...thanks for the help.
|
|
|
|
Joined: Jul 2006
Posts: 107
Vogon poet
|
Vogon poet
Joined: Jul 2006
Posts: 107 |
The point of using the -s switch is to show what the variables are being set to. It's a common debugging measure. The suspicion is that the variables are not being set as expected, which would account for the error messages you're getting, and/or the msg that No one is absent.
The script (either one here) and the User List must be on the bot. The level 1 User List entries must each contain a nick. (i.e. NOT *!ident@host)
Not trying to be condescending... I know from experience that small simple details can easily be overlooked (especially when frustrated) and totally derail a script.
LonDart
|
|
|
|
Joined: Sep 2007
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2007
Posts: 7 |
The variables it seems to be set, the user list are set as : 1:guaitaku 1:othernick
With the second example, the alias one, the variables are set
* Set %#userscan to #mychannel * Set %#userlevl to 1
But in status it says:
ISON Not enough parameters
I don't know if the variables are set why it returns me that message? PD: My server allows ISON command.
Thanks
|
|
|
|
|