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.

Preset topics

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Preset topics

Post by neilpkemp »

i would like to have say 3 preset topics which could be used by a command in 1 chat room to change another chat rooms topic, any idea how i would do this?
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

This should work:

Code: Select all

bind pub n "!topic" pub:topic

set topic1 "topic 1"
set topic2 "topic 2"
set topic3 "topic 3"

set topicchan "#yourchan"

proc pub:topic {nick uhost hand chan text}
{
   switch -- [string tolower [lindex $text 0]] 
   {
   
	"1"
    {
       putquick "TOPIC $::topicchan :$::topic1"
       return
    }
   
    "2"
    {
       putquick "TOPIC $::topicchan :$::topic2"
       return
    }
   
    "3"
    {
       putquick "TOPIC $::topicchan :$::topic3"
       return
    }
  }
}
      
Use command !topic 1 or !topic 2 or !topic 3 in any channel you want and bot will set topic for channel you defined in variable $topicchan.
Last edited by ]Kami[ on Sun Nov 13, 2005 11:42 am, edited 1 time in total.
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Post by neilpkemp »

i get this when i try to rehash the bot

[15:36] <ToF> [07:35] Tcl error in file 'bot.conf':
[15:36] <ToF> [07:35] wrong # args: should be "proc name args body"
[15:36] <ToF> while executing
[15:36] <ToF> "proc pub:topic {nick uhost hand chan text}"
[15:36] <ToF> (file "scripts/Topic.tcl" line 9)
[15:36] <ToF> invoked from within
[15:36] <ToF> "source scripts/Topic.tcl"
[15:36] <ToF> (file "bot.conf" line 177)
[15:36] <ToF> [07:35] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

proc pub:topic {nick uhost hand chan text}
{
should be

Code: Select all

proc pub:topic {nick uhost hand chan text} {
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Post by neilpkemp »

getting this error now :/

<ToF> [11:53] Tcl error [pub:topic]: wrong # args: should be "switch ?switches? string pattern body ... ?default body?"
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I guess ]Kami[ got used to C or something :P

Code: Select all

bind pub n "!topic" pub:topic

set topic1 "topic 1"
set topic2 "topic 2"
set topic3 "topic 3"

set topicchan "#yourchan"

proc pub:topic {nick uhost hand chan text} {
   switch -- [string tolower [lindex $text 0]] {
   "1" {
       putquick "TOPIC $::topicchan :$::topic1"
       return
    }
    "2" {
       putquick "TOPIC $::topicchan :$::topic2"
       return
    }
    "3" {
       putquick "TOPIC $::topicchan :$::topic3"
       return
    }
  }
}
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Post by neilpkemp »

thank you works now :)
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

You are right, didn't use TCL for some time now (only C++) :)
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Post by neilpkemp »

sorry o be a pain, is thier anyway i can have public command like !topic and it shows the topic either in a message or notice on the channel?
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

Don't understand what you want.

Please explain it better :)
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Seems we want a variation on the original request. The topic not only being set but also when !topic is used the topic on the channel is sent to the user who triggered it?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Post by neilpkemp »

ye when someone says does !topic in a channel i would like the bot to either msg the channel the topic or notice the person , just wondered if anyone could show me how to do this :)
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

If i understood you good:

Code: Select all

bind pub n "!topic" pub:topic

set topic1 "topic 1"
set topic2 "topic 2"
set topic3 "topic 3"

set topicchan "#yourchan"

proc pub:topic {nick uhost hand chan text} {
   switch -- [string tolower [lindex $text 0]] {
   "1" {
       putquick "TOPIC $::topicchan :$::topic1"
       putquick "NOTICE $nick :Topic for channel $::topicchan is now $::topic1"	   
       return
    }
    "2" {
       putquick "TOPIC $::topicchan :$::topic2"
       putquick "NOTICE $nick :Topic for channel $::topicchan is now $::topic2"	 
       return
    }
    "3" {
       putquick "TOPIC $::topicchan :$::topic3"
       putquick "NOTICE $nick :Topic for channel $::topicchan is now $::topic3"	 
       return
    }
  } 
n
neilpkemp
Voice
Posts: 21
Joined: Sun Nov 13, 2005 10:52 am

Post by neilpkemp »

i just need it so if anyone wishes to view the topic in the channel they can just do a certain command like !topic and the bot will message them it :) (sorry if im not making sense)
Post Reply