egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AFK-Script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Sun Apr 20, 2008 10:04 am    Post subject: AFK-Script Reply with quote

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?

Quote:
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 Very Happy
Back to top
View user's profile Send private message
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Mon Apr 21, 2008 8:55 am    Post subject: Reply with quote

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:
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"
}

_________________
#Quiz.de @ irc.GameSurge.net
JavaChat


Last edited by tueb on Mon Apr 21, 2008 3:05 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Mon Apr 21, 2008 10:55 am    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Mon Apr 21, 2008 11:19 am    Post subject: Reply with quote

please try the updated code above.
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat
Back to top
View user's profile Send private message Visit poster's website
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Mon Apr 21, 2008 11:57 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Mon Apr 21, 2008 12:45 pm    Post subject: Reply with quote

aegh, always the same problem with my scripts. Rolling Eyes

i'll contact you over icq.



PS: Changed my first thread into the newest version.
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat
Back to top
View user's profile Send private message Visit poster's website
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Sat Jul 12, 2008 4:50 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
strikelight
Owner


Joined: 07 Oct 2002
Posts: 708

PostPosted: Sat Jul 12, 2008 12:42 pm    Post subject: Reply with quote

I would guess you would need to change this part of the code:
Code:

 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.
Back to top
View user's profile Send private message Visit poster's website
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Sun Jul 13, 2008 12:00 am    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Thu Jul 31, 2008 12:11 pm    Post subject: Reply with quote

if you want the bot to to react on part, use "bind part"...
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat
Back to top
View user's profile Send private message Visit poster's website
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Sun Aug 10, 2008 10:22 pm    Post subject: Reply with quote

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!

Very Happy
Back to top
View user's profile Send private message
Sh3ny
Voice


Joined: 05 Aug 2008
Posts: 7

PostPosted: Wed Aug 13, 2008 1:24 pm    Post subject: Reply with quote

hi

i get this error.

Code:
[15:58] Tcl error [afk_pubm]: couldn't compile regular expression pattern: quantifier operand invalid


Embarassed

can paste de fix code?

Rolling Eyes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber