| View previous topic :: View next topic |
| Author |
Message |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Mon May 29, 2006 6:40 am Post subject: Help with this array |
|
|
Hello!
I need a script which can do the following:
With a command e.g. !mods I want to check the online status of saved nicks. Maybe it is possible to save these nicks in an array(?). Then my eggdrop should write "Online: nick1, nick2, nick3" or "nobody is online".
Last edited by darton on Tue May 30, 2006 9:11 am; edited 1 time in total |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Mon May 29, 2006 3:22 pm Post subject: |
|
|
| Code: | bind pub - !mods mods
proc mods {nick uhost hand chan arg} {
array set modnames {
nick1
nick2
nick3
}
foreach {mod} [array get modnames] {
if {[onchan $mod $chan]} {
putquick "PRIVMSG $chan :The following mods are online at IRC: $mod"
}
}
} |
I have already begun with making this script. There is only one problem. With this script I made, the bot writes the following:
| Quote: | The following mods are online at IRC: nick1
The following mods are online at IRC: nick2 |
But it should write these nicks in just one line like this: "The following mods are online at IRC: nick1, nick2"
What do I have to change so that a new line is not made each time?
And the second problem is that I dont know what I must add that my bot writes "Nobody is online" when there is no user at IRC. Please help me. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue May 30, 2006 12:14 pm Post subject: |
|
|
| Code: |
set modnames {
"nick1"
"nick2"
"nick3"
}
bind pub - !mods mods
proc mods {nick uhost hand chan txt} {
global modnames
foreach user $modnames {
if {![onchan $user $chan]} continue
lappend mod($chan) $user
}
if {[info exists mod($chan)]} {
putquick "PRIVMSG $chan :The following mods are online an IRC: $mod($chan)"
} else {
putquick "PRIVMSG $chan :Nobody is online"
}
}
|
Should do. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Tue May 30, 2006 4:42 pm; edited 1 time in total |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Tue May 30, 2006 4:34 pm Post subject: |
|
|
| No, there must be something wrong. My bot writes "The following mods are online on IRC: mod(#channel)". |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue May 30, 2006 4:41 pm Post subject: |
|
|
Aghh! Forgot an $, sorry. Copy again the code, I've fixed it. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Wed May 31, 2006 11:30 am Post subject: |
|
|
| Thank you very much. Now it works. |
|
| Back to top |
|
 |
|