This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Nimos
Halfop
Posts: 80 Joined: Sun Apr 20, 2008 9:58 am
Post
by Nimos » Sun Apr 20, 2008 10:04 am
Is it possible to make a scripte where Users can set theirselves afk, and when this users name is said in the Channel the bot says that the user is afk?
Example:
User1: !afk eating
Bot(MSG): Status set!
User2 comes into the channel
User2: Hi User1, whats up?
Bot: User1 is afk at the moment: eating
User2: back
Bot(MSG): You are no longer marked as being afk!
If its possible, i would be glad if someone here could script it
tueb
Halfop
Posts: 76 Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:
Post
by tueb » Mon Apr 21, 2008 8:55 am
Hi,
interesting script you requested. I tried to fill it: The commands are "!afk" and "!back".
There are most likely a few bugs in it. Please contact me after testing, so I can try to fix them.
Code: Select all
bind pub - !afk afk_set
bind pub - !back afk_back
#bind pub - afk afk_set
#bind pub - back afk_back
bind pubm - * afk_pubm
variable afkarray
variable whoarray
proc afk_back {nick host handle channel text} {
global afkarray whoarray
if {[info exists afkarray($nick)]} {
unset afkarray($nick)
afk_notc $nick "Du bist nicht länger \"!afk\"."
if {[info exists whoarray($nick)]} {
#this needs to be changed in case more than one person has been looking for you
afk_notc $nick "$whoarray($nick) hat/haben Dich in Deiner Abwesenheit gesucht."
unset whoarray($nick)
}
} else {
afk_notc $nick "Du warst nicht \"!afk\"."
}
}
proc afk_set {nick host handle channel text} {
global afkarray whoarray
if {$text == ""} {
set text "."
} else {
set text ": \002$text\002"
}
if {![info exists afkarray($nick)]} {
set afkarray($nick) $text
} else {
set entry $afkarray($nick)
set afkarray($nick) $text
}
afk_notc $nick "Du bist auf \002away from keyboard\002 gesetzt. Grund${text}. Zurück setzt Du Dich mit \002!back\002."
}
proc afk_pubm {nick host handle channel text} {
global afkarray whoarray
if {$text=="^"||$text=="^^"||$text=="^^^"||$text=="*"} {
return
}
foreach name [array names afkarray] {
regsub -all {\(} $text "" text
regsub -all {\)} $text "" text
regsub -all {\{} $text "" text
regsub -all {\}} $text "" text
regsub -all {\[} $text "" text
regsub -all {\]} $text "" text
if {[regexp -nocase -- $text $name]} {
set afkmsg "$name ist away from keyboard"
afk_notc $nick "${afkmsg}. Grund$afkarray($name). Eine eigene away-Nachricht setzt Du Dir mit !away <text>."
regsub -all {\|} $nick {} whonick
if {[info exists whoarray($name)]} {
set who $whoarray($name)
set entry $whoarray($name)
set whoarray($name) "$who and $whonick"
} else {
set whoarray($name) $whonick
}
#break
}
}
}
proc afk_say {channel text} {
putquick "PRIVMSG $channel :$text"
}
proc afk_notc {nick text} {
putquick "NOTICE $nick :$text"
}
Last edited by
tueb on Mon Apr 21, 2008 3:05 pm, edited 2 times in total.
Nimos
Halfop
Posts: 80 Joined: Sun Apr 20, 2008 9:58 am
Post
by Nimos » Mon Apr 21, 2008 10:55 am
hm....thanks for your work, but. . .
!afk -- Seems to work (the bot anwers with You have been...)
!back -- shows no reaction
and the nick call shows no reaction, too...
tueb
Halfop
Posts: 76 Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:
Post
by tueb » Mon Apr 21, 2008 11:19 am
please try the updated code above.
Nimos
Halfop
Posts: 80 Joined: Sun Apr 20, 2008 9:58 am
Post
by Nimos » Mon Apr 21, 2008 11:57 am
wow its working now! thank you
a little error is left: in partyline appears, everytime someone talks:
[17:56] Tcl error [afk_pubm]: couldn't compile regular expression pattern: quantifier operand invalid
tueb
Halfop
Posts: 76 Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:
Post
by tueb » Mon Apr 21, 2008 12:45 pm
aegh, always the same problem with my scripts.
i'll contact you over icq.
PS: Changed my first thread into the newest version.
holycrap
Op
Posts: 152 Joined: Mon Jan 21, 2008 11:19 pm
Post
by holycrap » Sat Jul 12, 2008 4:50 am
It won't work if the nick is mentioned in a sentence. It only works if the nick is mentioned by itself.
Anyway to fix this?
Last edited by
holycrap on Sat Jul 12, 2008 11:47 pm, edited 1 time in total.
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Sat Jul 12, 2008 12:42 pm
I would guess you would need to change this part of the code:
Code: Select all
regsub -all {\(} $text "" text
regsub -all {\)} $text "" text
regsub -all {\{} $text "" text
regsub -all {\}} $text "" text
regsub -all {\[} $text "" text
regsub -all {\]} $text "" text
if {[regexp -nocase -- $text $name]} {
Change $text and text into $name and name in the regsub's.. And swap $name with $text in the regexp.
holycrap
Op
Posts: 152 Joined: Mon Jan 21, 2008 11:19 pm
Post
by holycrap » Sun Jul 13, 2008 12:00 am
Thanks strikelight for your time. But this script still has too many bugs, for example if you part the channel without setting !back, it will think that you are still away when you rejoin. It does not reset and will just keep saything the away message untill you change to that nick and set !back. Weird...
tueb
Halfop
Posts: 76 Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:
Post
by tueb » Thu Jul 31, 2008 12:11 pm
if you want the bot to to react on part, use "bind part"...
holycrap
Op
Posts: 152 Joined: Mon Jan 21, 2008 11:19 pm
Post
by holycrap » Sun Aug 10, 2008 10:22 pm
tueb, can you do me a favor and paste the new code on here? I don't know what "blind part" that you're talking about.
Thanks!
Sh3ny
Voice
Posts: 7 Joined: Tue Aug 05, 2008 6:15 pm
Post
by Sh3ny » Wed Aug 13, 2008 1:24 pm
hi
i get this error.
Code: Select all
[15:58] Tcl error [afk_pubm]: couldn't compile regular expression pattern: quantifier operand invalid
can paste de fix code?