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.

Automaticly set static topic: is it realy that complicated?

Help for those learning Tcl or writing their own scripts.
Post Reply
F
Fussel1979
Voice
Posts: 4
Joined: Sun Dec 24, 2006 10:10 am

Automaticly set static topic: is it realy that complicated?

Post by Fussel1979 »

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: Select all

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...;-)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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: Select all

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.
s
smash
Halfop
Posts: 45
Joined: Mon Jul 31, 2006 12:33 pm

Post by smash »

F
Fussel1979
Voice
Posts: 4
Joined: Sun Dec 24, 2006 10:10 am

Post by Fussel1979 »

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: Select all

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: Select all

bind join - * changetopic
acts like a "greeting"-trigger an changes the topic every time a user joins the channel.

The next one

Code: Select all

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
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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: Select all

if {[isbotnick $targ]....} {
check. Did you test it, or just came to a conclusion by yourself?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

If available, simply setting 'keeptopic' would solve any problem.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
F
Fussel1979
Voice
Posts: 4
Joined: Sun Dec 24, 2006 10:10 am

Post by Fussel1979 »

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: Select all

if {[isbotnick $targ]....} {
something happens when a user enters the channel and get @.

Greetz,
Fussel
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Did you change topicchan to your channel?
F
Fussel1979
Voice
Posts: 4
Joined: Sun Dec 24, 2006 10:10 am

Post by Fussel1979 »

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: Select all

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
Post Reply