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.

[SOLVED] only from nick i choose

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

[SOLVED] only from nick i choose

Post by Fire-Fox »

Can i get some help in adding a function so i can choose what nicks to listen to?

Code: Select all

bind pubm - "*!rss*" send:rss

proc send:rss {nick host hand chan text} {
set trigger [join [lrange [split $text] 0 0]]
set message [join [lrange [split $text] 1 end]]

putlog "sent $text"
putbot "rssdb" "addrss $trigger $message"
}
putlog "SentAddrss.Tcl"
Edit:

can i do :

Code: Select all

if nick == "nick" {
bind pubm - "*!rss*" send:rss
}
proc send:rss {nick host hand chan text} {
set trigger [join [lrange [split $text] 0 0]]
set message [join [lrange [split $text] 1 end]]

putlog "sent $text"
putbot "rssdb" "addrss $trigger $message"
}
putlog "SentAddrss.Tcl"
Last edited by Fire-Fox on Fri Mar 13, 2015 9:47 am, edited 1 time in total.
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

You will want the process to figure out if the text is from an allowed nick.

Maybe something more like this...

Code: Select all

set allowedNicks "ted bart Fire-Fox"

#### END OF SETTINGS ####

bind pubm - "*!rss*" send:rss 

proc send:rss {nick host hand chan text} { 

  if {[lsearch -exact -nocase [split $::allowedNicks] $nick] == "-1"} {  return 0  }

  set trigger [join [lrange [split $text] 0 0]] 
  set message [join [lrange [split $text] 1 end]] 

  putlog "sent $text" 
  putbot "rssdb" "addrss $trigger $message" 
} 

putlog "SentAddrss.Tcl"

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

Thanks :)

I'll have a go at it :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Other ways to get this without much hassle, meaning having to edit the script when you wish to maintain the list:

- add a new user and add it a custom flag that the bind will trigger on
- make a custom channel flag (setudef str) and have the nicks in there

Code: Select all

setudef str myTrigger
add nicks to this from DCC Chat with .chanset #channel myTrigger "ted bart Fire-Fox" for instance, and in the proc:

Code: Select all

if {[lsearch -nocase [channel get $chan myTrigger] $nick] == -1} return
Btw, what's with the pubm bind instead of pub and splitting text twice and not reuse it?

Edit: Fixed typo.
Last edited by caesar on Fri Mar 13, 2015 11:22 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

@SpiKe^^

Works fine :)

@caesar

Thanks for the input :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Post Reply