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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
BigToe
Halfop
Posts: 99 Joined: Thu Dec 30, 2010 4:49 pm
Post
by BigToe » Tue Jul 09, 2013 1:10 pm
Hello I need your help loyal tcl fans!
I need your help with matching a text when written in a certain chat room, the text is usually in the following snytax
<Nickname> Have you been a victim of meeting malpractice? -
http://www.bbc.com/capital/story/201307 ... s-go-wrong (culture)
Which is actually the article headline, itself link and the 'category'.
I want a script that I can define for each category to which channel the line will be relayed
for example, culture would go to #culture, weather would go to #weather and Economy could go to #allfriends - so you can actually define for each category where to relay the message
I request your help dear tcl fans!!
thanxx
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jul 10, 2013 1:13 am
Give this a try.
Code: Select all
bind pubm * * pubm:category
proc pubm:category {nick uhost hand chan text} {
if {![string match -nocase $chan "#channel"]} return
set category [string trim [lindex [split $text] end] {()}]
switch -nocase -- $category {
default {
return
}
"culture" {
puthelp "PRIVMSG #culture :$text"
}
"weather" {
puthelp "PRIVMSG #weather :$text"
}
"economy" {
puthelp "PRIVMSG #allfriends :$text"
}
}
}
Replace #channel with the actual channel name you get the lines.
PS: Haven't tested so reply back if you get any errors or it's not working.
Once the game is over, the king and the pawn go back in the same box.
BigToe
Halfop
Posts: 99 Joined: Thu Dec 30, 2010 4:49 pm
Post
by BigToe » Wed Jul 10, 2013 5:05 am
Thank you caesar
I am getting this error:
[11:05] Tcl error [pubm:category]: bad option "-nocase": must be -exact, -glob, -regexp, or --
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jul 10, 2013 7:30 am
This means you have an older version of TCL, most likely 8.4. Anyway, replace:
with:
Code: Select all
switch -- [string tolower $category] {
and should work fine.
Once the game is over, the king and the pawn go back in the same box.
BigToe
Halfop
Posts: 99 Joined: Thu Dec 30, 2010 4:49 pm
Post
by BigToe » Wed Jul 10, 2013 8:53 am
Hi now there are no errors but it doesnt work either
BigToe
Halfop
Posts: 99 Joined: Thu Dec 30, 2010 4:49 pm
Post
by BigToe » Wed Jul 10, 2013 9:51 am
Oh it does work - you didnt mention i should use lowercase
thank you very much for your help!!
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jul 10, 2013 12:01 pm
The
string tolower should take care of the letter cases so should match the text without doing any changes to it.
Anyway, glad it got sorted out and it's working.
Once the game is over, the king and the pawn go back in the same box.