| View previous topic :: View next topic |
| Author |
Message |
Fussel1979 Voice
Joined: 24 Dec 2006 Posts: 4
|
Posted: Sun Dec 24, 2006 10:38 am Post subject: Automaticly set static topic: is it realy that complicated? |
|
|
Hi all,
i'm new to tcl and to eggdrop, too!
I managed to setup eggdrop on a linux vhost and get it working.
Now i'm stumbeling around while trying to get the bot setting the topic of a channel, everytime he join's the channel.
I read some scripts, that perform similiar operations, copy some - thought essential - lines from other scripts and edited them to solve the problem, but it doesn't work.
My script actualy looks like this:
| Code: |
global chan topic
set chan "#testchan"
set topic "test topic!"
if {[botonchan $chan] && [botisop $chan]} {
putquick "TOPIC $chan :$topic"
}
|
I realize that the script seems to do nothing, cause at execution time, the bot maybe isn't connected to the server or isn't on the channel yet.
Is there something like a triggerevent that is fired, when the bot is connected and in the channel?
Another idea is, to try to solve the problem with a "one-time"-timer.
I can't believe, that it should be that complicated to automaticly set a static topic. I read the documentation and searched the internet without success. Maybe i don't see the forest for the trees.
Can anyone please light up the dark?
tia
Fussel
...please excuse my poor english! I'm not used to speak/write the language due to i'm from germany... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Dec 24, 2006 1:51 pm Post subject: |
|
|
If you looked closer at the other scripts, you would've noticed the binds which trigger procedures on events (documented in Tcl-commands.doc).
| Code: | set topicchan #channel
set chantopic "Your topic here"
bind mode - "* +o" changetopic
proc changetopic {nick uhost hand chan mc targ} {
global topicchan chantopic
if {[isbotnick $targ] && [string equal -nocase $topicchan $chan]} {
putserv "TOPIC $chan :$chantopic"
}
} |
This will let the bot change the topic whenever it gains op. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
smash Halfop
Joined: 31 Jul 2006 Posts: 45
|
|
| Back to top |
|
 |
Fussel1979 Voice
Joined: 24 Dec 2006 Posts: 4
|
Posted: Mon Dec 25, 2006 5:56 pm Post subject: |
|
|
Thank's for the hints!
Sadly non of them meets my needs!
I'll try to explain my wish more detailed.
Guess there is a IRC channel, which is abandoned nearly the whole day.
The bot is the only one, who's on the channel. Then there is a netsplit or the shellprovider reboots his systems. After the system is up again and running, the bot connects to the irc, joins the channel - which is formed just in time - and finds, that there is no topic! Now i want the bot to set a topic, when he enters the channel and find, no topic is set.
The trigger
| Code: | | bind mode - "* +o" changetopic |
only set's the the topic, when ANOTHER user gets @. But this event isn't fired, when the bot "creates" the channel.
Are you with me?
So, how can i get the bot do, what i want him to?
Other advises?
I've experimented with some other triggers. e.g. the following trigger
| Code: | | bind join - * changetopic |
acts like a "greeting"-trigger an changes the topic every time a user joins the channel.
The next one
| Code: | | bind topc - * changetopic |
is fired every time, when the topic is changed.
Is there a trigger to be used, or should i use a timer?
tia
Fussel |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Dec 25, 2006 6:57 pm Post subject: |
|
|
The mode bind triggers whenever a mode change occurs even if it's done by or to the bot. And to know that the one being oped is the bot itself, I've added
| Code: | | if {[isbotnick $targ]....} { |
check. Did you test it, or just came to a conclusion by yourself? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Mon Dec 25, 2006 7:15 pm Post subject: |
|
|
If available, simply setting 'keeptopic' would solve any problem. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
Fussel1979 Voice
Joined: 24 Dec 2006 Posts: 4
|
Posted: Tue Dec 26, 2006 6:39 am Post subject: |
|
|
Hi Sr_Fz,
i've checked it out! It doesn't work as it should.
If i paste your whole snipet to my test.tcl file, which is loaded through the eggdrop config, nothing happens when a mode change (e.g. someone get @) occurs. Only when i remove the whole if-statement | Code: | | if {[isbotnick $targ]....} { | something happens when a user enters the channel and get @.
Greetz,
Fussel |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
Fussel1979 Voice
Joined: 24 Dec 2006 Posts: 4
|
Posted: Tue Dec 26, 2006 10:21 am Post subject: |
|
|
Sure!
I've right now managed to solve my problem by myself!
It's not the best solution but a workaround and meets my needs.
The script looks like that
| Code: | bind evnt - init-server starttimer
set topic "Testtopic here!"
set topicchan "#testchan"
proc starttimer {type} {
timer 1 [list settopic $type]
}
proc settopic {type} {
global topicchan topic
putserv "TOPIC $topicchan :$topic"
}
|
Thanks alot!
Greetz,
Fussel |
|
| Back to top |
|
 |
|