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 

Automaticly set static topic: is it realy that complicated?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fussel1979
Voice


Joined: 24 Dec 2006
Posts: 4

PostPosted: Sun Dec 24, 2006 10:38 am    Post subject: Automaticly set static topic: is it realy that complicated? Reply with quote

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...Wink
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 24, 2006 1:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
smash
Halfop


Joined: 31 Jul 2006
Posts: 45

PostPosted: Sun Dec 24, 2006 6:24 pm    Post subject: Reply with quote

http://www.egghelp.org/tclhtml/3478-4-0-0-1-chris-topic.htm
Back to top
View user's profile Send private message
Fussel1979
Voice


Joined: 24 Dec 2006
Posts: 4

PostPosted: Mon Dec 25, 2006 5:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Dec 25, 2006 6:57 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Dec 25, 2006 7:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Fussel1979
Voice


Joined: 24 Dec 2006
Posts: 4

PostPosted: Tue Dec 26, 2006 6:39 am    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Dec 26, 2006 9:52 am    Post subject: Reply with quote

Did you change topicchan to your channel?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Fussel1979
Voice


Joined: 24 Dec 2006
Posts: 4

PostPosted: Tue Dec 26, 2006 10:21 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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