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 

[SOLVED] only from nick i choose

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


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Wed Mar 11, 2015 9:57 am    Post subject: [SOLVED] only from nick i choose Reply with quote

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

Code:
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:

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"

_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze


Last edited by Fire-Fox on Fri Mar 13, 2015 9:47 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Wed Mar 11, 2015 11:02 am    Post subject: Reply with quote

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

Maybe something more like this...
Code:

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
.
Back to top
View user's profile Send private message Visit poster's website
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Wed Mar 11, 2015 3:53 pm    Post subject: Reply with quote

Thanks Smile

I'll have a go at it Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Mar 12, 2015 1:45 am    Post subject: Reply with quote

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:

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:

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.
_________________
Once the game is over, the king and the pawn go back in the same box.


Last edited by caesar on Fri Mar 13, 2015 11:22 am; edited 1 time in total
Back to top
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri Mar 13, 2015 9:46 am    Post subject: Reply with quote

@SpiKe^^

Works fine Smile

@caesar

Thanks for the input Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
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