| View previous topic :: View next topic |
| Author |
Message |
 essebi

Joined: 12 May 2008 Posts: 21
|
Posted: Mon May 19, 2008 2:50 am Post subject: Message a User list |
|
|
Hi all
I need help writing a script snippet.
I want that my bot send a message to a users list, i'm adding users in this way
helpteam:*!*@essebi.users.afternet.org
| Code: | | on *:TEXT:*!Assist*:#:{.msg %helpteam Test } |
This code give me * /msg: insufficient parameters i don't know if i can do it on this way, hope it's possible...
Thanks in advance
essebi |
|
| Back to top |
|
 |
 whimp
Joined: 06 Apr 2007 Posts: 31
|
Posted: Mon May 19, 2008 8:52 am Post subject: |
|
|
Yes it's possible, you just need spaces between the brackets.
| Code: |
on *:TEXT:!Assist*:#:{ .msg %helpteam Test }
|
There was no space between your first bracket and %helpteam. Also, you shouldn't really have a * in front of the command. |
|
| Back to top |
|
 |
 essebi

Joined: 12 May 2008 Posts: 21
|
Posted: Mon May 19, 2008 9:33 am Post subject: |
|
|
Yup i forgot the space between the brackets writing the code here, bu in my mirc is wirted right, and i recive the same result: /msg: insufficient parameters also if i copy and paste your snippet.
I want to repeat that helpteam isn't a variable, but a group of users on the users window, i don't know if i can call it like a var with % i've triyed also the $ but still don't work. It's the whole day that i'm searching in the help of the mirc I hope in any help or alternative solution.
Thanks
essebi |
|
| Back to top |
|
 |
 RusselB Editor
Joined: 02 Jan 2005 Posts: 7180 Location: Sarnia, ON, Canada
|
Posted: Mon May 19, 2008 12:40 pm Post subject: |
|
|
1) %helpteam would have nothing in it, as the User List entry helpteam does not fill the %helpteam variable.
2) Even if it did fill the variable, the way you currently have it, it would fill with a wildcarded address
3) The msg command requires one or more specific nicks or channels, not an address.
If you have more to the script than what you posted, please post the rest and we'll see what we can do about fixing it up. If not, say so, and we'll work something from scratch. |
|
| Back to top |
|
 |
 xDaeMoN Editor

Joined: 27 Jan 2004 Posts: 5954 Location: United States Of Calamity
|
Posted: Mon May 19, 2008 12:43 pm Post subject: |
|
|
You would have to loop to each user in that level, then use $ialchan().nick to get the nick associated with each host then message them with your specific text. _________________ "If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!"-Rex Navarrete
#hawkee.com in Undernet |
|
| Back to top |
|
 |
 essebi

Joined: 12 May 2008 Posts: 21
|
Posted: Mon May 19, 2008 1:18 pm Post subject: |
|
|
Thanks for your help!
This is what i want to do, unfortunatly i can't install mirc on this pc and i cant test it, but basically it explain what i want to do:
| Code: | on *:TEXT:!assist*:#test: {
if ($nick ison #test) {
.set $+(%,help.,$nick) $2-
.msg **users list** $nick need help: $($+(%,help.,$nick),2)
}
} |
My users are writed in this way:
helpteam:*!*@essebi.users.afternet.org
helpteam:*!*@qwerty.users.afternet.org
helpteam:*!*@asdfg.users.afternet.org
i coul add it also in this way if it is necessary:
helpteam:essebi*!*@essebi.users.afternet.org
helpteam:qwerty*!*@qwerty.users.afternet.org
helpteam:asdfg*!*@asdfg.users.afternet.org
Also a loop routine could be a usefoull solution, maybe during a read of a ini group, but i don't know how to do it
Cheers
essebi |
|
| Back to top |
|
 |
 RusselB Editor
Joined: 02 Jan 2005 Posts: 7180 Location: Sarnia, ON, Canada
|
Posted: Mon May 19, 2008 1:38 pm Post subject: |
|
|
This code does not differentiate between specific channels and/or networks.
| Code: | on *:join:#:{
if helpteam isin $ulist($wildsite) {
set %helpteam $addtok(%helpteam,$nick,44)
}
}
on *:part:#:{
set %helpteam $remtok(%helpteam,$nick,1,44)
}
on *:quit:{
set %helpteam $remtok(%helpteam,$nick,1,44)
}
on *:kick:#:{
set %helpteam $remtok(%helpteam,$knick,1,44)
}
on *:text:!assist*:#test:{
set $+(%,help.,$nick) $2-
.msg %helpteam $nick need help: $($+(%,help.,$nick),2)
}
|
Most channels are automatically set to +n when they are registered, which means "no outside messages", therefore making your if statement in the ON TEXT event irrelevant. |
|
| Back to top |
|
 |
 xDaeMoN Editor

Joined: 27 Jan 2004 Posts: 5954 Location: United States Of Calamity
|
Posted: Mon May 19, 2008 4:05 pm Post subject: |
|
|
Here's a sample on looping thru your userlist
| Code: | alias hteam {
var %a = $ulist(*,helpteam,0)
while %a {
if ( $ialchan($ulist(*,helpteam,%a),$1,1) ) .msg $gettok($v1,1,33) $2-
dec %a
}
} |
Syntax: /hteam #channel_name message_here _________________ "If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!"-Rex Navarrete
#hawkee.com in Undernet |
|
| Back to top |
|
 |
 essebi

Joined: 12 May 2008 Posts: 21
|
Posted: Tue May 20, 2008 12:41 am Post subject: |
|
|
Thanks again to both of you, i've decided to fet the RusselB solution that for me seems much simple integrate it in a bot.
Tho only problema that i've now is that the onjoin event don't work, all the other code works perfect.
| RusselB wrote: |
| Code: | on *:join:#:{
if helpteam isin $ulist($wildsite) {
set %helpteam $addtok(%helpteam,$nick,44)
}
}
|
|
I'm not able to fix it, but i continue to try waiting your reply
essebi |
|
| Back to top |
|
 |
 PunkTuReD
Joined: 07 Apr 2008 Posts: 522
|
Posted: Tue May 20, 2008 1:14 am Post subject: |
|
|
have u got 2 on join events in the same remote ? _________________
 |
|
| Back to top |
|
 |
 essebi

Joined: 12 May 2008 Posts: 21
|
Posted: Tue May 20, 2008 5:51 am Post subject: |
|
|
| Nope i've only this snippet loaded on the remote. |
|
| Back to top |
|
 |
 xDaeMoN Editor

Joined: 27 Jan 2004 Posts: 5954 Location: United States Of Calamity
|
Posted: Tue May 20, 2008 9:24 pm Post subject: |
|
|
Still using my code, the only event you would need is the ON Text event
| Code: |
On *:TEXT:!assist ?*:#Channel: hteam $chan $2-
alias hteam {
var %a = $ulist(*,helpteam,0)
while %a {
if ( $ialchan($ulist(*,helpteam,%a),$1,1) ) .msg $gettok($v1,1,33) $2-
dec %a
}
} |
To answer your problem on Russelb's code:
| Code: | | on helpteam:join:#: set %helpteam $addtok(%helpteam,$nick,44) |
_________________ "If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!"-Rex Navarrete
#hawkee.com in Undernet |
|
| Back to top |
|
 |
 essebi

Joined: 12 May 2008 Posts: 21
|
Posted: Wed May 21, 2008 6:57 am Post subject: |
|
|
Thanks again xDaeMoN for your help, but now i've another problem on this script with thiat userlist:
Here is the script that i need to add on the bot:
| Code: | on *:TEXT:!owned *:?:{
if $($+(%,owned),2) == $null {
set %owned 1
set %owner $nick
}
else .msg $($+(%,owner),2) $nick is triyng to own me
on *:TEXT:!addhelper *:?:{
if $($+(%,owner),2) == $nick {
.guser helpteam $2 2
}
else .msg $nick You can't add Helper! Only my owner can do it
}
On *:TEXT:!assist ?*:#:{
if $($+(%,help),2) == 1 .msg $chan You need to wait, there's another request pending
else {
set %help.nick $nick
set %help.chan $chan
set -u30 %help 1
hteam $chan $2-
.msg $chan $nick your request is sent to the Help Team
.timerhelp 1 30 msg $chan Sorry $nick cant find no one online
}
}
on helpteam:TEXT:!givehelp:?:{
if $($+(%,help),2) == 1 {
set %help.Last $nick
msg $($+(%,help.,chan),2) $nick will help you soon, wait here his reply
.timerhelp off
unset %help.nick %help.chan %help
}
else .msg $nick There's no help request pending, last one was taken by $($+(%,help.,last),2)
}
;----- ALIAS ----
alias hteam {
var %a = $ulist(*,helpteam,0)
while %a {
if ( $ialchan($ulist(*,helpteam,%a),$1,1) ) .msg $gettok($v1,1,33) $($+(%,help.,nick),2) need help on $($+(%,help.,chan),2): $2-
dec %a
}
} |
Now the problem is that like i said before i've my users added in this way:
helpteam:*!*@essebi.users.afternet.org
but on the same user list you can find also:
helpteam:*!*@essebi.users.afternet.org
and it recognize the user only on the first time for example:
helpteam:*!*@essebi.users.afternet.org
90:*!*@essebi.users.afternet.org
helpteam:*!*@qwerty.users.afternet.org
In this way show me a helpteam user, but on this way:
90:*!*@essebi.users.afternet.org
helpteam:*!*@essebi.users.afternet.org
helpteam:*!*@qwerty.users.afternet.org
Show me a level 90 user.
It's possible for an user to be level 90 AND helpteam?
Cheers
essebi |
|
| Back to top |
|
 |
 RusselB Editor
Joined: 02 Jan 2005 Posts: 7180 Location: Sarnia, ON, Canada
|
Posted: Wed May 21, 2008 4:48 pm Post subject: |
|
|
Yes it's possible.. the problem you're running into is with the way the information is being added to the User List.
See /help User and Level Commands
If you still need more help, post the code(s) that actually adds the information to the User List. Ooops.. you did post it... simply add the -a switch to the guser command (I like to think of it as append) |
|
| Back to top |
|
 |
 essebi

Joined: 12 May 2008 Posts: 21
|
Posted: Tue May 27, 2008 7:32 am Post subject: |
|
|
Hi all,
I'm here again with my problem.
I've definitly leaved the IAL becouse it has problem with others custom level active on the bot, so i'm back to the first suggestion from RusselB but now i've some problem on the ON events, here is my snippets:
| Code: | on *:join:#:{
if $address($nick,2) isin $read(d:\mirc\skyhelp.txt) {
set %helpteam $addtok(%helpteam,$nick,44)
.msg $chan Added
}
}
on *:nick:{
if $address($newnick,2) isin $read(d:\mirc\skyhelp.txt) {
set %helpteam $addtok(%helpteam,$newnick,44)
set %helpteam $remtok(%helpteam,$nick,1,44)
.msg #test123 cambiato
}
}
on *:part:#:{
set %helpteam $remtok(%helpteam,$nick,1,44)
}
on *:quit:{
set %helpteam $remtok(%helpteam,$nick,1,44)
}
on *:kick:#:{
set %helpteam $remtok(%helpteam,$knick,1,44)
}
|
All works fine but sometimes (randomly) it miss some events, for example the onjoin miss to addtoken near 1 times every 4/5
Here is a log from the chan:
| Code: |
[05:07p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:07p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:07p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:07p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:07p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:07p] <Zurli> Added
[05:07p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:07p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] <Zurli> Added
[05:08p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] <Zurli> Added
[05:08p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:08p] <Zurli> Added
[05:09p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:09p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:09p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:09p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:09p] <Zurli> Added
[05:09p] * Parts: essebi (kvirc@essebi.Users.AfterNET.Org)
[05:09p] * Joins: essebi (kvirc@essebi.Users.AfterNET.Org) |
Hope you could help me.
Thanks
essebi |
|
| Back to top |
|
 |
|